This application is a template for a microservice covering authentication APIs.
- gin http package
- grpc communication
- mongo database
- dynamic config
- memory cache redis
- streaming kafka
- testing
- code coverage
- metrics
- loki logging improvement
- swagger
- monetoring
- Clone the repository:
git clone git@github.com:ajaypp123/golang-jwt-microservice.git
- Install dependencies:
go mod tidy
go mod vendor
- Build the application:
go build
You can also run the microservice using Docker. Make sure you have Docker installed on your machine.
- Build the Docker image:
docker compose build
- Start service
docker compose up
/signup
: POST request to sign up a new user./login
: POST request to log in and obtain a JWT token./user/{id}
: GET request to get user details by ID./refresh
: POST request to refresh the JWT token.
You can configure the application using environment variables:
HTTP_PORT
: Port on which the server listens (default is 8080).MONGO_URI
: MongoDB connection URI.GRPC_PORT
: Secret key for JWT token generation.
Contributions are welcome! Please feel free to submit pull requests.
This project is licensed under the MIT License