A high-performance Go backend for KTV song request systems with multi-role support and payment integration.
KTVRequest is a modern, scalable backend system for KTV venues and live streaming platforms. Built with Go, it provides robust APIs for song requests, payment processing, and real-time notifications.
- Administrators: Manage songs, orders, performers, and analytics
- Customers: Browse songs, make requests, process payments
- Performers: Accept/reject requests, manage performance status
- Multiple payment provider support
- Secure transaction handling
- Webhook processing for payment confirmation
- JWT-based authentication with refresh tokens
- Redis caching for performance
- Kafka messaging for real-time events
- Rate limiting and security middleware
- Comprehensive logging and monitoring
ktvrequest/
├── cmd/ # Application entry points
│ ├── server/ # Main API server
│ ├── migrate/ # Database migrations
│ ├── seed/ # Data seeding
│ └── init-db/ # Database initialization
├── internal/ # Private application code
│ ├── handlers/ # HTTP request handlers
│ ├── services/ # Business logic layer
│ ├── models/ # Data models and repositories
│ ├── middleware/ # HTTP middleware
│ ├── config/ # Configuration management
│ ├── cache/ # Redis caching
│ ├── messaging/ # Kafka event handling
│ ├── notify/ # Notification services
│ └── utils/ # Utility functions
├── pkg/ # Public library code
│ ├── database/ # PostgreSQL database layer
│ └── logger/ # Logging utilities
├── sql/ # Database schemas and seeds
├── api/ # API specifications
└── docker-compose.yaml # Development environment
- Go 1.21+
- PostgreSQL 15+
- Redis 6+
- (Optional) Kafka for messaging
# Clone repository
git clone https://github.com/your-username/ktvrequest.git
cd ktvrequest
# Install dependencies
go mod download
# Set up environment
cp config.json.example config.json
# Edit config.json with your settings
# Initialize database
go run cmd/init-db/main.go
# Run migrations
go run cmd/migrate/main.go
# Seed initial data
go run cmd/seed/main.go
# Start development server
go run cmd/server/main.go# Start all services
docker-compose up -d
# View logs
docker-compose logs -f server# Build all binaries
make build
# Run tests
make test
# Start development
make dev
# Run with hot reload (if air is installed)
make watchCreate config.json:
{
"server": {
"port": 8080,
"env": "development"
},
"database": {
"host": "localhost",
"port": 5432,
"user": "ktvrequest",
"password": "password",
"dbname": "ktvrequest",
"sslmode": "disable"
},
"redis": {
"host": "localhost",
"port": 6379,
"password": ""
},
"jwt": {
"secret": "your-jwt-secret",
"expiry_hours": 24
}
}