A comprehensive marketplace API for buying and selling CS:GO skins, built with Go, featuring user authentication, transaction management, automated invoice generation, and email notifications.
# Clone and setup
git clone <repository-url>
cd finalProject
# Minimal setup (only 2 required variables!)
cp env.example .env
echo "JWT_SECRET=your-secret-key-here" >> .env
echo "MIGRATIONS_PATH=./migrations" >> .env
# Run with Docker
docker-compose up --buildAccess: http://localhost:8080 | API Docs: http://localhost:8080/swagger/index.html
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ API Server โ โ Worker โ โ Database โ
โ (Gin) โ โ (Asynq) โ โ (PostgreSQL) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Redis โ โ Email Service โ โ Migrations โ
โ (Queue) โ โ (Mailgun) โ โ (Golang) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
| Category | Technology |
|---|---|
| Language | Go 1.23.1 |
| Framework | Gin (HTTP server) |
| Database | PostgreSQL 16 |
| Cache/Queue | Redis 7 |
| ORM | SQLx |
| Auth | JWT |
| Background Jobs | Asynq |
| Mailgun | |
| gofpdf | |
| Docs | Swagger/OpenAPI |
| Containerization | Docker & Docker Compose |
finalProject/
โโโ cmd/ # Application entry points
โ โโโ api/ # API server
โ โโโ worker/ # Background worker
โโโ internal/ # Application code
โ โโโ auth/ # Authentication
โ โโโ handlers/ # HTTP handlers
โ โโโ models/ # Data models
โ โโโ http_server/ # Server initilization, endpoints
โ โโโ middleware/ # Auth checks
โ โโโ repositories/ # Data access layer
โ โโโ services/ # Business logic
โ โโโ queue/ # Background jobs
โโโ pkg/ # Shared packages
โโโ migrations/ # Database migrations
โโโ docs/ # Swagger documentation
โโโ Dockerfile* # Container configs
| Variable | Description | Example |
|---|---|---|
JWT_SECRET |
JWT signing secret | your-secret-key-here |
MIGRATIONS_PATH |
Path to migrations | ./migrations |
| Variable | Default | Description |
|---|---|---|
LISTEN_ADDR |
:8080 |
HTTP server address |
REDIS_ADDR |
:6379 |
Redis connection |
DB_URL |
postgres://postgres:postgres@db:5432/postgres?sslmode=disable |
Database URL |
MAILGUN_DOMAIN |
- | Email domain (optional) |
MAILGUN_API_KEY |
- | Email API key (optional) |
Full Documentation: http://localhost:8080/swagger/index.html
| Method | Endpoint | Description |
|---|---|---|
POST |
/signup |
Register user |
POST |
/login |
Authenticate user |
GET |
/profile |
Get user profile |
GET |
/marketplace/skins |
List available skins |
POST |
/marketplace/purchase |
Purchase skin |
POST |
/marketplace/sell |
List skin for sale |
POST |
/transactions/deposit |
Deposit funds |
POST |
/transactions/withdraw |
Withdraw funds |
# Run all tests
make test
# Run with coverage
make test-coverage
# Run specific service tests
go test ./internal/services -v# Build and start
docker-compose up --build
# Start in background
docker-compose up -d
# Stop services
docker-compose down
# View logs
docker-compose logs -f# Setup development environment
make dev-setup
# Run locally (requires PostgreSQL & Redis)
make run
# Database migrations
make migrate-up
make migrate-down
# Code generation
make wire
make swagger- JWT Authentication with secure token management
- Password Hashing using bcrypt
- Input Validation and sanitization
- SQL Injection Protection with parameterized queries
- Non-root Containers for security hardening
- Environment Variables for secure configuration
- Multi-stage Docker builds (80% image size reduction)
- Database connection pooling
- Redis caching and background job queue
- Asynchronous processing for emails and PDFs
- Structured logging with slog
- Alpine-based images for smaller footprint
| Issue | Solution |
|---|---|
| Email not sending | Check Mailgun credentials in .env |
| Database connection | Verify PostgreSQL is running |
| Build issues | Clear Docker cache: docker system prune -a |
- API Documentation: http://localhost:8080/swagger/index.html
- Application Logs:
docker-compose logs - Worker Logs:
docker-compose logs worker
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License.
Built with joy using Go (while being sick) and modern DevOps practices