This README is available in multiple languages:
Go-reusable-api is a highly performant, reusable, and easy-to-understand API built with Golang, Gin, and Gorm. This API is designed to offer a robust feature set while ensuring optimized performance and security.
- Cache Support: Utilizes Redis for caching.
- Database: PostgreSQL.
- Rate Limiting: Built-in rate limiter to prevent spam and service crashes.
- Docker Support: Includes Dockerfile for containerization.
- Monitoring: Prometheus integration for performance monitoring.
- Authentication: Bearer token and hashed passwords for security.
- Golang
- Docker
- PostgreSQL
- Redis
Execute the following commands to build and run the Docker container:
docker build -t go-reusable-api .
docker run -p 8080:8080 go-reusable-apiThis file should contain one function called SetSalt that returns the salt in byte type.
func SetSalt() []byte {
your_salt := "Hey"
return []byte(your_salt)
}It also should contain a function called envGo, so that you can set your database information.
func envGo() {
os.Setenv("database", "host=example-db server user=fakeuser password=fakepassword dbname=fakedb port=1234 sslmode=require")
}To ensure the highest level of performance, the API has:
- Cache optimization through Redis.
- Database indexes and optimized queries in PostgreSQL.
- Clean and efficient codebase.
- Passwords are hashed for secure storage.
- Bearer token is used for system authorization.
The API includes a Prometheus setup within the Docker container for real-time performance monitoring.
Examples for making API requests can be found in the config/rest folder. This should guide you on how to properly make requests to the API.
EmailPasswordBearer Token
Remember to include your email, password, and the appropriate bearer token when making API calls.
- Adding Swagger docummentation with swaggo
- Adding govalidator
- Load-Balancer
- Add Feature Flags