Categorygithub.com/wenzzyx/go-ushort
module
0.7.4
Repository: https://github.com/wenzzyx/go-ushort.git
Documentation: pkg.go.dev

# README

CI-CD pipeline  
My pet project that shortens long links ;)
 
Front-end: go-ushort
Design: figma  
 
https://very-long-site-subdomain.long-domain-ffff.com/my-best-blog
-> https://ushort.us/7R

Todo

  • JWT Authentication (access,refresh)
  • Create/update link by user
  • Configure JSON-only logger on IsProduction mode
  • Create script (alias) for migration creation
  • Add pagination for links
  • Add a collection of metrics and a dashboard to monitor them (prom-app -> victoriametrics -> grafana)
  • Add LICENSE
  • Write tests
  • Write the rules for making a contribution
  • Change db diagram svg generation (replace images)
  • Configure CI/CD
  • Configure dev_full docker-compose
  • Configure deploy (render.com)
  • Link domain
  • Configure git-crypt

For simple run scripts - make alias alias gr="sh run.sh"

General

gr
# or `sh run.sh`
# Get list of scripts and description for each script
docker build . \
	--platform=linux/amd64 \
	-t go-ushort \
	--build-arg NEXT_PUBLIC_USHORT_DOMAIN="ushort.us"
# build for amd64

docker build . -t go-ushort
# build docker image
docker rm go-ushort && \
docker run -it -p 5005:8000 \
	--name go-ushort \
	-e ALLOWED_ORIGINS="https://go-ushort.vercel.app" \
	-e DB_HOST="localhost" \
	-e DB_NAME="ushorter" \
	-e DB_PASS="dev" \
	-e DB_PORT="5432" \
	-e DB_USER="dev_user" \
	-e DOMAIN="ushort.us" \
	-e IS_DEBUG="false" \
	-e IS_ENABLE_PROM="false" \
	-e IS_PRODUCTION="true" \
	-e JWT_ACCESS_EXP_TIME="1m" \
	-e JWT_ACCESS_SECRET="ocSbpF5qQjBbutPR85g7VHfQn1v7dGYO0IVEoH9xq2hmWDa6bVxX8NWk6OcpdEZN" \
	-e JWT_REFRESH_EXP_TIME="30d" \
	-e JWT_REFRESH_SECRET="mwgqOZsFf8hWNdOtbKQQLGPhwWXQQQ0hHOKZvypj82uJuENwjNPqXLBMdKRYsqBq" \
	-e MIGRATIONS_PATH="./migraions" \
	go-ushort \
	&& docker logs -f go-ushort
# run docker container

Environment

Server config

paramtyperequireddefaultdescription
JWT_ACCESS_SECRETstringyes-Secret for generating accessToken
JWT_ACCESS_EXP_TIMEstringyes-life duration of accessToken (ex.: "20s", "2d")
JWT_REFRESH_SECRETstringyes-Secret for generating refreshToken
JWT_REFRESH_EXP_TIMEstringyes-life duration of accessToken (ex.: "20s", "2d")
IS_PRODUCTIONbooleannotrueRun-mode is production? (ex.: "true")
IS_DEBUGbooleannofalsePrint sensitive info and prettify log messages? (ex.: "true")
IS_ENABLE_PROMbooleannofalseEnable prometheus? (ex.: "false")
DOMAINstringyes-Domain for setting cookies (ex.: "localhost")
ALLOWED_HOSTSstringno0.0.0.0Hosts who can send requst to server (ex.: "0.0.0.0,192.168.1.1")
ALLOWED_ORIGINSstringno*CORS - origin (ex.: "https://ushort.us,http://localhost:3000")
SERVER_HOSTstringno0.0.0.0Host, where server will run (ex.: "0.0.0.0")
LIMIT_COUNT_PER_REQUESTintno10Temporarly not using

 
 

Database config

paramtyperequireddefaultdescription
DB_NAMEstringyes-DB name
DB_USERstringyes-DB user
DB_PASSstringyes-DB password
DB_HOSTstringnolocalhostDB host (ex.: "localhost")
DB_PORTintno5432DB port (ex.: "5432")
DB_LOG_MODEbooleannofalseOutput SQL and other query information? (ex.: "true")
DB_SSL_MODEstringnofalseUse SSL mode (ex.: "disable", "enable")
MIGRATIONS_PATHstringno./app/common/database/migrationsMigrations folder path (ex.: "./app/common/database/migrations")

Database diagram

DB-diagram image

# Packages

No description provided by the author
No description provided by the author
No description provided by the author