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