Skip to content

omidnikrah/duckparty-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦† DuckParty Back-end

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.

πŸ”— Front-end

This backend powers the DuckParty frontend application. For frontend setup and documentation, visit:

duckparty-frontend

✨ Features

  • 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

πŸ› οΈ Tech Stack

  • 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

πŸš€ Getting Started

Prerequisites

  • 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)

Installation

# 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
air

Environment Variables

Create 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

Docker Setup

# Start all services (PostgreSQL, Redis, and App)
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

πŸ“š API Documentation

Once the server is running, access the interactive API documentation at:

http://localhost:4030/swagger/index.html

πŸ“ Project Structure

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

🚒 Deployment

This project is deployed using Coolify.


Made with ❀️‍πŸ”₯ for the duck community

About

Build a ridiculous duck, give it style, and flex it like it owns the internet. πŸ¦†

Topics

Resources

License

Stars

Watchers

Forks

Contributors