RESTful API backend for DuckParty - where ducks come to party and show off their style.
A robust, scalable backend service powering the DuckParty platform. Handles duck creation, customization, user authentication, leaderboards, and interactions with a modern tech stack.
This backend powers the DuckParty frontend application. For frontend setup and documentation, visit:
- User Authentication - JWT-based auth with email OTP verification
- Duck Management - Create, customize, and manage duck collections
- Leaderboard System - Ranking based on reactions
- Reaction System - Like/dislike ducks with rate limiting
- Image Storage - AWS S3 integration for duck image hosting
- Email Service - AWS SES for OTP delivery
- API Documentation - Swagger/OpenAPI documentation
- Scheduled Tasks - Cron jobs for automated operations
- Go - High-performance backend language
- Gin - Fast HTTP web framework
- GORM - ORM for database operations
- PostgreSQL - Relational database
- Redis - Caching and rate limiting
- AWS S3 - Object storage for images
- AWS SES - Email delivery service
- JWT - Token-based authentication
- Swagger - API documentation
- Go 1.24.4 or higher
- PostgreSQL 16 or higher
- Redis 7 or higher
- AWS account with S3 and SES configured
- Docker and Docker Compose (optional, for containerized setup)
# Clone the repository
git clone https://github.com/omidnikrah/duckparty-backend.git
cd duckparty-backend
# Install dependencies
go mod download
# Set up environment variables (see Environment Variables section)
cp .env.example .env
# Edit .env with your configuration
# Start the server
airCreate a .env file in the root directory with the following variables:
APP_PORT=4030
API_PREFIX=/api
# Database
DB_HOST=localhost
DB_PORT=5432
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=duckparty
# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your_redis_password
# AWS
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
S3_BUCKET=your_s3_bucket
S3_REGION=your_s3_region
S3_BASE_URL=your_s3_base_url
# JWT
JWT_SECRET=your_jwt_secret_key
# Email
AUTH_SENDER_EMAIL=your_verified_ses_email# Start all services (PostgreSQL, Redis, and App)
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downOnce the server is running, access the interactive API documentation at:
http://localhost:4030/swagger/index.html
duckparty-backend/
βββ cmd/
β βββ server/ # Server setup and initialization
βββ internal/
β βββ client/ # External service clients (Redis, SES, Cron)
β βββ config/ # Configuration management
β βββ database/ # Database connection and migrations
β βββ dto/ # Data transfer objects
β βββ handler/ # HTTP request handlers
β βββ middleware/ # HTTP middleware (auth, rate limiting, validation)
β βββ model/ # Database models
β βββ routes/ # API route definitions
β βββ service/ # Business logic layer
β βββ storage/ # Storage abstractions (S3)
β βββ templates/ # Email templates
β βββ types/ # Type definitions
β βββ utils/ # Utility functions
βββ docs/ # Swagger documentation
βββ docker-compose.yml # Docker services configuration
βββ Dockerfile # Container build configuration
βββ main.go # Application entry point
This project is deployed using Coolify.
Made with β€οΈβπ₯ for the duck community