Product-Hub is a high-performance e-commerce backend service implemented in Go. It utilizes PostgreSQL for transactional data persistence and Redis for distributed caching to ensure scalability under high load.
View Comprehensive Technical Specifications
The system is optimized for low-latency response times and high throughput:
- p95 Latency: < 1000ms under 100 concurrent virtual users.
- Error Rate: < 1% during peak load testing.
- Database Transactions: 100% ACID compliance for order processing.
- Caching: Redis-backed product retrieval with 10-minute TTL.
- POST /api/v1/register: User account creation.
- POST /api/v1/login: Authentication and JWT issuance.
- GET /api/v1/health: System and database health status.
- GET /api/v1/product: Retrieve product catalog (cached).
- POST /api/v1/cart/checkout: Process order and manage inventory (authenticated).
- Runtime: Go 1.21+
- Database: PostgreSQL (Persistence), Redis (Distributed Cache)
- API: Gorilla Mux (Routing), JWT (Authentication)
- Persistence Layer: SQLC (Type-safe query generation), pgx (Driver)
- Validation: go-playground/validator
Initialize the environment configuration:
cp .env.example .envDownload dependencies and start the service:
go mod tidy
go run cmd/main.goExecute the health check:
curl http://localhost:8080/api/v1/healthUnit Testing:
go test ./...Load Testing (k6):
k6 run load_test.js