Kubernetes Redis Docker Postgres Golang—KuReDoPoGo is a backend API service built using Golang and Gin Framework. It uses Redis for rate limiting and Postgres for storing data. It is deployed on Kubernetes. For local development, it uses Docker Compose.
- Go
- Postgres (local, remote, or Docker instance)
- Redis (local, remote, or Docker instance)
- Copy the
.env.example
file to.env
and update the values like postgres connection string, redis connection string, and other values as needed. You can use the following command to copy the file:
cp .env.example .env
- Install the Go dependencies and run the application:
go mod download
go run main.go
You can access the application at http://localhost:8080
.
- Docker
- Docker Compose
- Run the following command to start the application:
docker compose up
If you're using the latest version of Docker Compose, you can leverage the Compose Watch feature. This will automatically rebuild the application when code changes are made:
docker compose up --watch
docker compose up --build --watch
You can access the application at http://localhost:8080
and Postgres at http://localhost:5432
.
One the application is running, you can use the following endpoints to interact with the API. By default, the rate limit is set to 10 per hour. You can change this in the .env
file.
GET /users
: Get all usersGET /users/:id
: Get a user by IDPOST /users
: Create a new userPUT /users/:id
: Update a user by IDDELETE /users/:id
: Delete a user by IDGET /health
: Get the health status of the application
POST and PUT requests require a JSON body with the following structure:
{
"name": "John Doe",
"email": "[email protected]"
}
This project is licensed under the GNU General Public License v3.0.
If you discover a security vulnerability within this project, please refer to the security policy for more information.