Giter Club home page Giter Club logo

go-ushort's Introduction

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

param type required default description
JWT_ACCESS_SECRET string yes - Secret for generating accessToken
JWT_ACCESS_EXP_TIME string yes - life duration of accessToken (ex.: "20s", "2d")
JWT_REFRESH_SECRET string yes - Secret for generating refreshToken
JWT_REFRESH_EXP_TIME string yes - life duration of accessToken (ex.: "20s", "2d")
IS_PRODUCTION boolean no true Run-mode is production? (ex.: "true")
IS_DEBUG boolean no false Print sensitive info and prettify log messages? (ex.: "true")
IS_ENABLE_PROM boolean no false Enable prometheus? (ex.: "false")
DOMAIN string yes - Domain for setting cookies (ex.: "localhost")
ALLOWED_HOSTS string no 0.0.0.0 Hosts who can send requst to server (ex.: "0.0.0.0,192.168.1.1")
ALLOWED_ORIGINS string no * CORS - origin (ex.: "https://ushort.us,http://localhost:3000")
SERVER_HOST string no 0.0.0.0 Host, where server will run (ex.: "0.0.0.0")
LIMIT_COUNT_PER_REQUEST int no 10 Temporarly not using

 
 

Database config

param type required default description
DB_NAME string yes - DB name
DB_USER string yes - DB user
DB_PASS string yes - DB password
DB_HOST string no localhost DB host (ex.: "localhost")
DB_PORT int no 5432 DB port (ex.: "5432")
DB_LOG_MODE boolean no false Output SQL and other query information? (ex.: "true")
DB_SSL_MODE string no false Use SSL mode (ex.: "disable", "enable")
MIGRATIONS_PATH string no ./app/common/database/migrations Migrations folder path (ex.: "./app/common/database/migrations")

Database diagram

DB-diagram image

go-ushort's People

Contributors

wenzzy avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.