Fresqo adalah platform e-commerce supermarket modern dengan arsitektur microservices production-grade, dibangun menggunakan Node.js + Next.js dengan design bold & vibrant yang memukau.
Live Demo: https://fresqo-supermarket.vercel.app/
- 🎨 Design: Neubrutalism modern dengan warna-warna vibrant (hot pink, sunshine yellow, mint green)
- ⚡ Performance: Inter-service communication yang efisien via API Gateway
- 🔒 Security: JWT authentication, rate limiting, Helmet.js
- 📱 Responsive: Mobile-first design, mulus di semua device
┌─────────────────────────────────────────────────────────────────────┐
│ CLIENT (Next.js 14) │
│ http://localhost:3000 │
└──────────────────────────────┬──────────────────────────────────────┘
│ HTTPS
▼
┌─────────────────────────────────────────────────────────────────────┐
│ API GATEWAY (Port 4000) │
│ • Request routing • Rate limiting • Security (Helmet, CORS) │
└─┬────────────┬────────────┬────────────┬────────────┬──────────────┘
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
┌──────┐ ┌───────┐ ┌──────┐ ┌───────┐ ┌─────────┐
│ AUTH │ │PRODUCT│ │ CART │◄──┤ ORDER │──►│ PAYMENT │
│ 4001 │ │ 4002 │◄──┤ 4003 │ │ 4004 │ │ 4005 │
└──────┘ └───────┘ └──────┘ └───────┘ └─────────┘
JWT 28 products Carts Orders 9 methods
Users 8 categories per user Timeline Simulated
| Service | Port | Responsibility |
|---|---|---|
| 🚪 API Gateway | 4000 | Single entry point, routing, rate limiting, security headers |
| 🔐 Auth Service | 4001 | Register, login, JWT issuance, profile management |
| 📦 Product Service | 4002 | Product catalog, search, filters, categories, stock |
| 🛒 Cart Service | 4003 | Shopping cart management per user (calls Product Service) |
| 📋 Order Service | 4004 | Checkout orchestration (calls Cart → Payment → Product) |
| 💳 Payment Service | 4005 | Payment simulation (9 methods: BCA, GoPay, OVO, COD, dll) |
User clicks "Checkout"
│
▼
[Frontend] ──POST──► [API Gateway] ──► [Order Service]
│
├──GET──► [Cart Service] ──GET──► [Product Service]
│
├──POST──► [Payment Service]
│
├──DELETE──► [Cart Service] (clear cart)
│
└──PATCH──► [Product Service] (update stock)
- ✅ Katalog Produk — 28+ produk realistis dalam 8 kategori (buah, sayur, daging, dairy, dll)
- ✅ Search & Filter — Cari by name/tag, filter by kategori & harga, sort by rating/harga/diskon
- ✅ Shopping Cart — Add/update/remove items dengan real-time subtotal calculation
- ✅ Checkout Flow — Form alamat, pilih payment method, review order, submit
- ✅ Payment Simulation — 9 metode: BCA/Mandiri/BNI VA, GoPay, OVO, DANA, ShopeePay, Credit Card, COD
- ✅ Order Tracking — Real-time timeline dengan auto-refresh setiap 5 detik
- ✅ Authentication — JWT-based, register/login/profile
- 📊 Dashboard — Revenue, total orders, status breakdown, recent orders
- 📦 Product Management — View all products dengan stock monitoring
- 📋 Order Management — Update order status (pending → confirmed → processing → shipped → delivered)
- 👥 User Management — View all registered users
- 🔐 JWT authentication dengan middleware di semua protected services
- 🛡️ Rate limiting (500 req / 15 min) dan Helmet security headers
- 🌐 Centralized CORS configuration di API Gateway
- 📝 Standardized response format di seluruh microservices
- 🎯 In-memory databases (easy setup, mudah di-swap ke PostgreSQL/MongoDB)
- 📦 Service discovery via environment variables
- 🧪 Health check endpoints di setiap service (
/health)
- Node.js ≥ 18.x (download)
- npm ≥ 9.x (sudah termasuk di Node.js)
- Git (untuk clone)
1. Clone atau extract project:
cd fresqo-supermarket2. Setup environment variables:
cp .env.example .env3. Install semua dependencies sekaligus:
npm run install:allScript ini akan install dependencies untuk:
- Root project (concurrently)
- 6 microservices
- Frontend Next.js
Waktu instalasi: ~2-3 menit tergantung koneksi.
4. Jalankan semua services sekaligus:
npm run devSelesai! 🎉 Buka browser:
- 🌐 Frontend: http://localhost:3000
- 🚪 API Gateway: http://localhost:4000/api
Untuk testing cepat, gunakan akun demo berikut:
| Role | Password | |
|---|---|---|
| 🔑 Admin | admin@fresqo.com |
admin123 |
| 👤 Customer | user@fresqo.com |
user123 |
fresqo-supermarket/
├── 📄 package.json # Root workspace
├── 📄 .env.example # Environment template
├── 📄 README.md # Dokumentasi ini
│
├── 📁 shared/ # Shared utilities
│ ├── logger.js # Colored logger
│ └── response.js # Standardized response format
│
├── 📁 services/ # All microservices
│ ├── 📁 api-gateway/ # Port 4000
│ │ ├── package.json
│ │ └── src/server.js # Gateway + proxy routing
│ │
│ ├── 📁 auth-service/ # Port 4001
│ │ ├── package.json
│ │ └── src/
│ │ ├── server.js # Auth endpoints
│ │ └── db.js # In-memory user DB
│ │
│ ├── 📁 product-service/ # Port 4002
│ │ ├── package.json
│ │ └── src/
│ │ ├── server.js # Product CRUD + search
│ │ └── data.js # 28 seeded products
│ │
│ ├── 📁 cart-service/ # Port 4003
│ │ ├── package.json
│ │ └── src/server.js # Cart + inter-service call
│ │
│ ├── 📁 order-service/ # Port 4004
│ │ ├── package.json
│ │ └── src/server.js # Order orchestration
│ │
│ └── 📁 payment-service/ # Port 4005
│ ├── package.json
│ └── src/server.js # Payment simulation
│
└── 📁 frontend/ # Next.js 14 (App Router)
├── package.json
├── next.config.js
├── tailwind.config.js # Custom Fresqo theme
└── src/
├── app/ # Next.js app router
│ ├── layout.jsx
│ ├── page.jsx # Homepage (landing)
│ ├── globals.css # Global styles + animations
│ ├── products/ # Catalog + [id]
│ ├── cart/ # Shopping cart
│ ├── checkout/ # Checkout flow
│ ├── orders/ # Orders list + [id]
│ ├── login/
│ ├── register/
│ ├── admin/ # Admin dashboard
│ └── about/
├── components/ # Reusable components
│ ├── Navbar.jsx
│ ├── Footer.jsx
│ └── ProductCard.jsx
├── lib/
│ ├── api.js # Axios API client
│ └── utils.js # Helpers (formatCurrency, dll)
└── store/ # Zustand stores
├── authStore.js
└── cartStore.js
Kalau mau run 1 service saja untuk debugging:
# Individual service
npm run dev:gateway # Port 4000
npm run dev:auth # Port 4001
npm run dev:product # Port 4002
npm run dev:cart # Port 4003
npm run dev:order # Port 4004
npm run dev:payment # Port 4005
npm run dev:frontend # Port 3000Health check:
curl http://localhost:4000/healthGet products:
curl http://localhost:4000/api/products?limit=5Login:
curl -X POST http://localhost:4000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"user@fresqo.com","password":"user123"}'Add to cart (replace TOKEN):
curl -X POST http://localhost:4000/api/cart/add \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"productId":"prod-001","quantity":2}'Coba flow lengkap ini untuk merasakan pengalaman microservices in action:
- 🏠 Buka homepage → browse produk featured
- 📦 Klik kategori "Buah-buahan" → explore products dengan filter
- 🔐 Klik login → pakai
user@fresqo.com/user123 - 🛒 Tambahkan 3-4 produk ke keranjang
- 💳 Klik "Checkout" → isi alamat → pilih GoPay → bayar
- 📋 Otomatis redirect ke order detail → lihat timeline tracking
- ⏱️ Tunggu 5 detik → status berubah ke "processing"
- ⏱️ Tunggu 15 detik → status berubah ke "shipped"
- 🔑 Logout, login sebagai admin → lihat dashboard dengan revenue stats
- 📦 Admin tab "Orders" → ubah status pesanan ke "delivered"
Warna (Vibrant Palette):
- 🔴 Primary:
#FF3366(Hot Pink) - 🟡 Secondary:
#FFB627(Sunshine Yellow) - 🟢 Accent:
#00D9A3(Mint Green) - 🟣 Purple:
#9775FA - 🔵 Blue:
#4DABF7 - ⚫ Dark:
#1A1A2E - 🤍 Cream:
#FFF8F0
Typography:
- Display: Fraunces (serif, untuk heading)
- Body: Plus Jakarta Sans (sans-serif)
- Mono: JetBrains Mono (kode & angka)
Design Style: Neubrutalism — bold borders (2px black), hard shadows (brutal 4-10px), playful micro-animations (wiggle, float, marquee).
- Runtime: Node.js 18+
- Framework: Express.js
- Auth: jsonwebtoken + bcryptjs
- Validation: express-validator
- Proxy: http-proxy-middleware (API Gateway)
- Security: Helmet, CORS, express-rate-limit
- HTTP Client: Axios (inter-service)
- Framework: Next.js 14 (App Router)
- Language: JavaScript + JSX
- Styling: Tailwind CSS dengan custom theme
- State: Zustand (lightweight, with persistence)
- HTTP: Axios dengan JWT interceptor
- UI: Lucide React icons, Framer Motion animations
- Forms: React hooks + validation
- Notifications: react-hot-toast
Project ini adalah demo / portfolio project. Untuk production, pertimbangkan:
Database:
- Ganti in-memory storage dengan PostgreSQL / MongoDB
- Setiap service punya database sendiri (database per service pattern)
Infrastructure:
- Containerize dengan Docker, orchestrate dengan Kubernetes atau Docker Compose
- Service mesh (Istio/Linkerd) untuk observability yang better
- API Gateway production-grade (Kong/Tyk) dengan caching
Security:
- Refresh tokens + token rotation
- Rate limiting per user/IP yang lebih granular
- Secret management dengan Vault / AWS Secrets Manager
- HTTPS everywhere
Observability:
- Distributed tracing (Jaeger/Zipkin)
- Centralized logging (ELK Stack / Loki)
- Metrics (Prometheus + Grafana)
Resilience:
- Circuit breakers (opossum) untuk inter-service calls
- Message queues (RabbitMQ/Kafka) untuk async workflows
- Retry logic dengan exponential backoff
Payment (real):
- Integrate dengan Midtrans, Xendit, atau Stripe
- Webhook handlers untuk payment confirmation
Port sudah dipakai?
# Cari process di port 4000
npx kill-port 4000 4001 4002 4003 4004 4005 3000Dependencies gagal install?
# Bersihkan node_modules dan coba lagi
rm -rf node_modules services/*/node_modules frontend/node_modules
npm run install:allService tidak bisa diakses?
- Pastikan semua 7 services (6 backend + 1 frontend) running
- Check log masing-masing service di terminal untuk error
- Test
/healthendpoint tiap service
CORS error di browser?
- API Gateway sudah handle CORS untuk
localhost:3000 - Kalau pakai port berbeda di frontend, update
corsconfig diapi-gateway/src/server.js
MIT License — feel free untuk pakai project ini sebagai belajar / portfolio / template proyek Anda sendiri.
Built with ❤️ by Rayhan — sebagai showcase arsitektur microservices modern.
Images: Unsplash Icons: Lucide Fonts: Google Fonts
Punya saran, pertanyaan, atau menemukan bug? Project ini masih bisa di-improve terus!
Happy coding! 🚀