- DEMO (GraphQL Playground): https://go-gin-postgres-api.herokuapp.com/graphql
- DEMO (REST API Swagger): https://go-gin-postgres-api.herokuapp.com/swagger/index.html
Note: in demo, I disabled email
Used libraries:
- Components Diagram
- See Swagger Doc
http://localhost:3000/swagger/index.html
- See GraphQL Playground
http://localhost:3000/graphql
- User Auth functionality (Signup, Login, Forgot Password, Reset Password)
- JWT Authentication
- REST API
- GraphQL API
- Gorm (Golang SQL DB ORM) with Postgres implementation and auto migration
- Configs via environmental variables
- Email notification (Welcome email, Reset password email)
- Swagger REST API documentation
- GraphQL playground
- Unit tests
- Dependency injection
Create .env
at root, i.e.
MAILGUN_API_KEY=key-b9jksfh8s9843uhfsdhds
MAILGUN_DOMAIN=xxxxx.mailgun.org
EMAIL_FROM=support@go_api_boilerplate.com
DB_HOST=localhost
DB_PORT=5432
DB_USER=your-user
DB_PASSWORD=your-password
DB_NAME=local-dev-db
JWT_SIGN_KEY=secret
HAMC_KEY=secret
PEPPER=secret
ENV=development
APP_PORT=3000
APP_HOST=http://localhost
Run
# Terminal 1
docker-compose up # docker-compose up (Run postgres)
docker-compose down # docker-compose down (Shutdown postgres)
# Terminal 2
go run github.com/99designs/gqlgen -v # Generate Graphql stuff
swag init -g app/app.go # Generates Swagger
go run *.go # Run application
go test -v -cover ./... # Run go test
- Input Validations
- Custom Error messages
- Logger
- More unit tests
maybe?
- gRPC
- Redis Streams
- Redis PubSub
- WebSocket
- MongoDB
Welcome for suggestions