Production-ready E-Commerce platform showcasing best practices in software architecture, scalability, and modern development patterns.
- Language: Go (Golang) 1.22+
- Framework: Gin
- Database: PostgreSQL 16
- Cache: Redis 7
- Architecture: Clean Architecture (Simplified)
- Framework: Next.js 14+ (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Containerization: Docker & Docker Compose
- Database GUI: pgAdmin
- API Testing: REST Client (VS Code)
- Clean Architecture implementation
- Rate limiting & throttling
- JWT authentication with refresh tokens
- Role-based access control (RBAC)
- Product catalog with search
- Shopping cart (guest & authenticated)
- Order management & checkout
- Admin dashboard with CRUD operations
- Payment integration (Midtrans Sandbox)
- Frontend development
- Pessimistic & optimistic locking
- Idempotency for critical operations
- Self-healing slug generation
- Database connection pooling
- Full-text search (PostgreSQL)
- Message queue for async processing
- Real-time notifications
- Caching strategy (Redis)
- Unit tests (>80% coverage)
- Integration tests
- E2E tests (Playwright)
- Load testing (K6)
- API documentation (Swagger)
- Go: 1.22 or higher (Download)
- Node.js: 18+ (Download)
- Docker Desktop: Latest version (Download)
- Git: Latest version
git clone <repository-url>
cd E-Commerce# Start PostgreSQL, Redis, and pgAdmin
docker-compose up -d
# Check if containers are running
docker-compose ps
# View logs
docker-compose logs -fAccess Points:
- PostgreSQL:
localhost:5432 - Redis:
localhost:6379 - pgAdmin:
http://localhost:5050- Email:
admin@admin.com - Password:
admin
- Email:
cd backend
# Install dependencies
go mod download
# Copy environment file
copy .env.example .env
# Run migrations
go run cmd/migrate/main.go up
# Start development server
go run cmd/api/main.goBackend will run on: http://localhost:8080
cd frontend
# Install dependencies
npm install
# Copy environment file
copy .env.example .env.local
# Start development server
npm run devFrontend will run on: http://localhost:3000
E-Commerce/
βββ backend/ # Go backend application
β βββ cmd/ # Application entry points
β β βββ api/ # Main API server
β β βββ migrate/ # Database migrations
β βββ internal/ # Private application code
β β βββ models/ # Domain entities & data structures
β β βββ services/ # Business logic layer
β β βββ handlers/ # HTTP controllers
β β βββ repositories/ # Data access layer
β β βββ middleware/ # Auth, rate limit, etc.
β βββ pkg/ # Shared utilities
β β βββ jwt/ # JWT token management
β β βββ password/ # Password hashing
β β βββ response/ # HTTP response helpers
β βββ migrations/ # SQL migration files
βββ frontend/ # Next.js frontend
β βββ app/ # App Router pages
β βββ components/ # React components
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utilities & API client
β βββ types/ # TypeScript types
βββ docker/ # Docker configurations
β βββ postgres/ # PostgreSQL init scripts
β βββ redis/ # Redis configs
βββ docs/ # Documentation
βββ scripts/ # Utility scripts
βββ docker-compose.yml # Docker orchestration
cd backend
# Run all tests
go test ./...
# Run with coverage
go test -cover ./...
# Run specific package
go test ./internal/services/...cd frontend
# Run unit tests
npm test
# Run E2E tests
npm run test:e2eComplete project documentation is available in the /docs folder:
| Document | Purpose |
|---|---|
| ARCHITECTURE.md | System design, layer architecture, design patterns |
| API.md | Complete API endpoint documentation with examples |
| DEPLOYMENT.md | Setup, deployment, and troubleshooting guide |
Authentication
POST /api/v1/auth/register # Register new user
POST /api/v1/auth/login # Login user
POST /api/v1/auth/refresh # Refresh access token
GET /api/v1/auth/me # Get current user (protected)Products
GET /api/v1/products # List products with filters
GET /api/v1/products/:id # Get product detail
GET /api/v1/products/featured # Get featured products
GET /api/v1/categories # List categoriesShopping Cart & Orders
GET /api/v1/cart # Get user cart (protected)
POST /api/v1/cart/items # Add to cart (protected)
PUT /api/v1/cart/items/:id # Update cart item (protected)
POST /api/v1/checkout # Create order (protected)
GET /api/v1/orders # Get user orders (protected)For complete API documentation, see docs/API.md
Environment configuration details are in DEPLOYMENT.md.
Copy .env.example and configure:
PORT- Server port (default: 8080)DB_*- PostgreSQL connection settingsREDIS_*- Redis connection settingsJWT_SECRET- Secret key for JWT tokens (min 32 chars)
Copy .env.example and configure:
NEXT_PUBLIC_API_URL- Backend API URL
# Start all services
docker-compose up -d
# Stop all services
docker-compose down
# View logs
docker-compose logs -f [service-name]
# Rebuild services
docker-compose up -d --build
# Remove volumes (β οΈ deletes data)
docker-compose down -vThis project follows GitHub Flow for clean, maintainable code:
main (production-ready)
βββ develop (integration branch)
βββ feature/* (new features)
βββ bugfix/* (bug fixes)
βββ hotfix/* (critical production fixes)
Workflow:
- Create feature branch from
develop:git checkout -b feature/feature-name - Make commits frequently with clear messages
- Push and create Pull Request for review
- Merge to
developafter review - Periodically merge
developβmainfor releases
- Copilot CLI: Used for code scaffolding, architecture planning, and development assistance
- VS Code: Primary IDE with REST Client extension for API testing
- Docker: Local development environment management
- Git: Version control with clean commit history
Local Development:
- Start Docker services:
docker-compose up -d - Run backend:
cd backend && go run cmd/api/main.go - Run frontend:
cd frontend && npm run dev - Test APIs using VS Code REST Client (
.httpfiles)
Phase 1 & 2: Foundation & Backend Setup
- Monorepo structure (frontend + backend)
- Go backend with Gin framework
- PostgreSQL database with migrations
- Docker Compose setup for local development
- Clean Architecture implementation
Phase 3: Authentication System
- User model and database schema
- JWT authentication (access + refresh tokens)
- User registration and login endpoints
- Password hashing with bcrypt
- Auth middleware for protected routes
Phase 4: Product & Cart Features
- Product CRUD operations
- Category management
- Product search with filters
- Shopping cart (session-based)
- Self-healing slug generation
- Optimistic & pessimistic locking for stock
Phase 5: Frontend Setup
- Next.js 14 with App Router
- TypeScript strict mode
- shadcn/ui component library setup
- Tailwind CSS configuration
- Custom hooks (useAuth, useCart, etc)
- Zustand store for state management
Phase 6: Frontend Pages (In Progress)
- Homepage with hero section, categories, featured products
- Products listing page with filters & search
- Product detail page
- Shopping cart page
- Checkout page (multi-step)
- Order history page
- User profile page
- Authentication pages (login, register)
- Navigation & layouts
Phase 7: UI/UX Fixes (Completed)
- Filter dropdown showing readable labels
- Removed AI-template style elements (Sparkles icon, generic features section)
- Fixed product card hover animations
- Database query fixes (is_active β status, stock β stock_quantity)
- CORS header configuration
Phase 8: Backend Cleanup (Completed)
- Removed duplicate folders (delivery, domain, repository, usecase)
- Cleaned up orphaned files
- Verified clean architecture structure
- Build verification completed
Backend Tasks:
- Homepage API endpoints (featured products, categories, banners)
- Image upload handler (product images, avatar)
- Newsletter subscription endpoint
- Payment webhook integration (Midtrans)
- Promo code / discount system (admin)
- Order status workflow automation
- Email notifications queue system
- Admin dashboard endpoints (analytics, reports)
Frontend Tasks:
- Wishlist/favorites feature
- Product reviews and ratings
- Live chat integration
- Admin dashboard build
- Payment page integration
- Email verification flow
- Notification system
Testing & Deployment:
- Unit tests (>80% coverage)
- Integration tests
- E2E tests (Playwright)
- Load testing (K6)
- API documentation (Swagger)
- Docker production builds
- CI/CD pipeline (GitHub Actions)
Implemented Best Practices:
- β Clean Code: Consistent naming, modular structure, SOLID principles
- β Architecture: Clean Architecture with clear layer separation
- β Security: JWT auth, rate limiting, input validation
- β Concurrency: Pessimistic & optimistic locking patterns
- β Scalability: Stateless design, horizontal scaling ready
- β Database: Migrations, connection pooling, query optimization
- β DevOps: Docker containerization, environment management
- Performance: Compiled, concurrent, low memory footprint
- Industry Adoption: Used by Gojek, Tokopedia (Indonesia), Google, Uber, Netflix
- Global Demand: High salary range, growing adoption
- Scalability: Built-in goroutines for concurrency
- Deployment: Single binary, no dependencies
- Full-stack capability: API routes for BFF pattern
- Performance: Server-side rendering, static generation, optimized images
- Developer Experience: TypeScript support, hot reload, extensive ecosystem
- SEO-friendly: Server-side rendering for better crawling
- Modern tooling: Built-in testing, CSS support, environment variables
- Handlers β HTTP request/response handling
- Services β Business logic & validation
- Repositories β Database operations
- Models β Domain entities
- Rate limiting with Redis
- JWT with refresh tokens
- Optimistic locking for concurrent updates
- Idempotent checkout operations
- Self-healing slugs for SEO
This is a portfolio project, but suggestions and feedback are welcome!
MIT License - see LICENSE file for details
Nandana
- GitHub: @Daarns
- Email: nandana219@gmail.com
- Portfolio Project: Full-stack E-Commerce with Go + Next.js
Project Highlights for Portfolio:
- Production-ready architecture with Clean Code principles
- Implemented advanced patterns (rate limiting, optimistic locking, idempotency)
-
80% test coverage target with unit & integration tests
- Containerized with Docker, ready for deployment
- Modern tech stack showcasing current industry standards