This is a basic and easy to use boilerplate for a Golang project using Gin and JWT.
- JWT Authentication
- JWT Authorization
- Bearer Token
- Refresh Token
- User CRUD
- User Login
- User Logout
- MongoDB Database
- Docker TestContainers
Each package contains a readme with more information about the package.
Create a .env
file in the internal/service directory and add the following environment variables:
MONGODB_URI={YOUR_MONGODB_URI}
DB_NAME={YOUR_DB_NAME}
JWT_SECRET={YOUR_JWT_SECRET}
JWT_EXPIRES_IN_HOUR={YOUR_JWT_EXPIRES_IN_HOUR}
JWT_REFRESH_EXPIRES_IN_HOUR={YOUR_JWT_REFRESH_EXPIRES_IN_HOUR}