Backend API service for DiscountDB - the open-source coupon and discount database.
- Language: Go
- Cache: Redis
- Database: PostgreSQL
- API Documentation: Swagger/OpenAPI
- Go 1.21+
- Docker and Docker Compose
- swag (for API documentation)
git clone https://github.com/ImGajeed76/discountdb-api.git
cd discountdb-api
go mod download
cp .env.example .env
Configure the following in your .env
:
- PostgreSQL connection details
- Redis connection details
# Install swag if you haven't already
go install github.com/swaggo/swag/cmd/swag@latest
swag init -g ./cmd/api/main.go
To simplify the setup of Redis and PostgreSQL, use the provided docker-compose.yml
file:
- Start the services using Docker Compose:
docker-compose up -d
This will spin up Redis and PostgreSQL containers.
Once Redis and PostgreSQL are running via Docker Compose, you can run the API:
go run cmd/api/main.go
- Ensure Docker is running and the containers are healthy (
docker ps
to check their status). - If ports 5432 or 6379 are already in use, update the
docker-compose.yml
file to use different host ports.
To stop the services:
docker-compose down
This will stop and remove the containers.
This project is licensed under the GNU General Public License v3 (GPL-3.0). See the LICENSE file for details.
- DiscountDB Frontend - Main repository containing the SvelteKit frontend
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Submit a pull request
For questions and support:
- Open an issue
- Visit the main project repository