A fullstack multi-role marketplace built for COMPFEST 18 Software Engineering Academy. Supports buyers, sellers, drivers, and admins in one unified platform β from product listing to wallet-based checkout to delivery tracking.
π Live Demo β’ π Documentation β’ π οΈ Setup Guide β’ ποΈ Architecture
- About The Project
- Prerequisites
- Quick Start
- Tech Stack
- Architecture
- Features
- API Documentation
- Demo Accounts
- Available Scripts
- Development Roadmap
- Contributing
- License
SEAPEDIA is a comprehensive, production-style fullstack marketplace inspired by Tokopedia and Shopee. It supports four distinct roles in one account system β Buyer, Seller, Driver, and Admin β each with their own dashboard and permissions. Built with React on the frontend and Express + Prisma on the backend, SEAPEDIA covers the entire e-commerce lifecycle: browsing, cart, checkout with tax and delivery fee calculation, order fulfillment, and last-mile delivery.
- π Multi-Role System: One account, multiple roles β switch between Buyer, Seller, Driver, and Admin instantly
- π¨ Modern UI/UX: Built with shadcn/ui and Lucide icons for a clean, Tokopedia-style storefront
- π Secure Authentication: JWT-based auth with role-based route protection
- π° Wallet System: Built-in wallet with top-up, payment, refund, and driver earnings
- π¦ Full Order Lifecycle: From cart to checkout to delivery, with PPN tax and weight-based shipping fees
- π§ͺ Type Safety: Full TypeScript coverage on both frontend and backend
- π‘οΈ Security Hardened: Rate limiting, XSS sanitization, and Zod input validation
- Marketplace β Public product catalog, store pages, search and filters
- Buyer β Cart, addresses, wallet, checkout, order tracking, vouchers
- Seller β Store management, product CRUD, order processing, revenue reports
- Driver β Available delivery jobs, pickup/delivery flow, earnings tracking
- Admin β Marketplace overview, user management, voucher/promo control, overdue order handling
Before you begin, ensure you have the following installed:
| Software | Version | Download Link | Notes |
|---|---|---|---|
| Node.js | 18.0+ | Download | LTS version recommended |
| npm | 10.0+ | Included with Node.js | Package manager |
| PostgreSQL | 15.0+ | Download | Primary database |
| Git | 2.30+ | Download | Version control |
| Platform | Minimum Requirements |
|---|---|
| Windows | Windows 10+ |
| macOS | macOS 10.15+ |
| Linux | Ubuntu 18.04+ or equivalent |
| Browser | Version |
|---|---|
| Chrome | 90+ |
| Firefox | 88+ |
| Safari | 14+ |
| Edge | 90+ |
- Code Editor: VS Code (recommended) with extensions:
- ES7+ React/Redux/React-Native snippets
- TypeScript Importer
- Tailwind CSS IntelliSense
- Prettier - Code formatter
- ESLint
- Prisma
git clone https://github.com/Radityaaa27/Seapedia.git
cd Seapediacd backend
# Install dependencies
npm install
# Copy environment variables
cp .env.example .envEdit .env:
DATABASE_URL="postgresql://postgres:yourpassword@localhost:5432/seapedia"
JWT_SECRET="your-super-secret-key"
JWT_EXPIRES_IN=7d
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:5173Run database migration and seed:
npx prisma generate
npx prisma migrate dev
node -r ts-node/register prisma/seed.tsStart backend server:
npm run devcd ../frontend
# Install dependencies
npm install
# Copy environment variables
cp .env.example .envEdit .env:
VITE_API_URL=http://localhost:5000/apiStart frontend:
npm run devOpen your browser and navigate to http://localhost:5173. You should see:
- β Landing Page with hero section and product categories
- β Product Catalog with search and category filters
- β Login with demo accounts (see below)
- β Role Selector to switch between Buyer, Seller, Driver, Admin
- β Wallet with top-up and transaction history
- β Cart & Checkout with PPN tax and delivery fee calculation
The app will be available at:
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:5000/api - Prisma Studio:
npx prisma studio(database GUI)
| Category | Technology | Version | Purpose |
|---|---|---|---|
| Framework | React | 19.0+ | UI library |
| Language | TypeScript | 5.0+ | Type safety |
| Build Tool | Vite | 7.0+ | Development & build |
| Styling | Tailwind CSS | 3.4+ | Utility-first CSS |
| UI Library | shadcn/ui | Latest | Component system (Nova preset) |
| Icons | Lucide React | Latest | Icon set |
| State | TanStack Query | 5.0+ | Server state management |
| HTTP | Axios | 1.0+ | API calls |
| Routing | React Router | 6.0+ | Client-side routing |
| Toasts | Sonner | Latest | Notifications |
| Category | Technology | Version | Purpose |
|---|---|---|---|
| Runtime | Node.js | 18.0+ | JavaScript runtime |
| Framework | Express | 4.0+ | REST API |
| Language | TypeScript | 5.0+ | Type safety |
| ORM | Prisma | 7.0+ | Database ORM (driver adapters) |
| Database | PostgreSQL | 15.0+ | Primary database |
| Auth | JWT + bcryptjs | β | Authentication |
| Validation | Zod | 4.0+ | Schema validation |
| Security | express-rate-limit, xss | β | Rate limiting & sanitization |
| Tool | Purpose |
|---|---|
| Nodemon | Auto-restart on file change |
| ts-node | TypeScript execution |
| Prisma Studio | Visual database browser |
Seapedia/
βββ π frontend/ # React application
β βββ π src/
β β βββ π pages/ # Route-level pages
β β β βββ π buyer/ # Cart, checkout, wallet, orders
β β β βββ π seller/ # Store, products, reports
β β β βββ π driver/ # Jobs, earnings
β β β βββ π admin/ # Overview, users, vouchers
β β βββ π components/ # Reusable UI components
β β βββ π contexts/ # Auth & Cart global state
β β βββ π hooks/ # Custom React hooks
β β βββ π services/ # API call functions
β β βββ π types/ # TypeScript types
β β βββ π layouts/ # Navbar, Footer, MainLayout
β βββ π package.json
β
βββ π backend/ # Express application
β βββ π prisma/
β β βββ π schema.prisma # Database models
β β βββ π seed.ts # Demo data seeding
β βββ π src/
β β βββ π controllers/ # Request handlers
β β βββ π services/ # Business logic
β β βββ π repositories/ # Database queries
β β βββ π routes/ # API route definitions
β β βββ π middleware/ # Auth, RBAC, rate limit, sanitize
β β βββ π validators/ # Zod schemas
β β βββ π utils/ # Helpers (ApiError, ApiResponse, JWT)
β β βββ π lib/ # Prisma client instance
β βββ π package.json
β
βββ π .gitignore
βββ π README.md
User βββ¬ββ Store ββ Product ββ ProductImage
βββ Wallet ββ WalletTransaction
βββ Cart ββ CartItem
βββ Address
βββ Order ββ OrderItem
β βββ Delivery
βββ Review
Voucher / Promo ββ Order
React (Frontend)
β axios + JWT
Express (Backend)
β authenticate & requireRole middleware
Controllers β Services β Repositories
β Prisma ORM
PostgreSQL
- Public product catalog with search, category, and price filters
- Product detail pages with reviews and ratings
- Store pages with seller info and product listings
- One account, multiple roles (Buyer, Seller, Driver, Admin)
- Instant role switching without re-login
- Role-based protected routes on both frontend and backend
- Wallet top-up with preset and custom amounts
- Full transaction history (top-up, payment, refund, earning)
- Checkout with PPN tax (12%), weight-based delivery fee, and voucher discounts
- Single-store-per-order checkout flow
- Order status flow: Pending β Paid β Processing β Ready for Pickup β On Delivery β Delivered β Completed
- Buyer-side order cancellation with automatic refund and stock restoration
- Seller order processing dashboard
- Browse and accept available delivery jobs
- Pickup confirmation and delivery completion flow
- Automatic wallet earnings credit on completed delivery
- Percentage or fixed-amount discount vouchers
- Usage limits and minimum order requirements
- Platform-wide promotional banners
- Marketplace-wide stats (users, orders, revenue)
- User management with role assignment and account toggling
- Voucher and promo creation/management
- Overdue order detection with force-refund capability
- JWT authentication with bcrypt password hashing
- Rate limiting on auth and wallet top-up endpoints
- XSS input sanitization on all request bodies
- Zod schema validation across every endpoint
- Helmet security headers + strict CORS policy
| Method | Endpoint | Description | Access |
|---|---|---|---|
POST |
/api/auth/register |
Register new account | Public |
POST |
/api/auth/login |
Login and get JWT token | Public |
GET |
/api/auth/me |
Get current user profile | Authenticated |
| Method | Endpoint | Description | Access |
|---|---|---|---|
GET |
/api/roles |
Get my roles | Authenticated |
POST |
/api/roles/switch |
Switch active role | Authenticated |
POST |
/api/roles/add |
Add a new role to account | Authenticated |
| Method | Endpoint | Description | Access |
|---|---|---|---|
GET |
/api/products |
Get product list with filters | Public |
GET |
/api/products/:storeSlug/:productSlug |
Get product detail | Public |
POST |
/api/stores |
Create a store | Authenticated |
POST |
/api/products |
Create product | Seller |
PUT |
/api/products/:id |
Update product | Seller |
DELETE |
/api/products/:id |
Delete product | Seller |
| Method | Endpoint | Description | Access |
|---|---|---|---|
GET |
/api/cart |
Get my cart | Authenticated |
POST |
/api/cart/items |
Add item to cart | Authenticated |
POST |
/api/orders |
Create order from cart | Buyer |
GET |
/api/orders |
Get my orders | Buyer |
PATCH |
/api/orders/:id/cancel |
Cancel order | Buyer |
GET |
/api/orders/seller/orders |
Get seller's incoming orders | Seller |
| Method | Endpoint | Description | Access |
|---|---|---|---|
GET |
/api/wallet |
Get wallet balance | Authenticated |
POST |
/api/wallet/topup |
Top up wallet | Authenticated |
GET |
/api/wallet/transactions |
Get transaction history | Authenticated |
| Method | Endpoint | Description | Access |
|---|---|---|---|
GET |
/api/driver/jobs/available |
Get available delivery jobs | Driver |
POST |
/api/driver/jobs/:id/accept |
Accept a job | Driver |
PATCH |
/api/driver/jobs/:id/complete |
Complete delivery | Driver |
GET |
/api/driver/earnings |
Get earnings summary | Driver |
| Method | Endpoint | Description | Access |
|---|---|---|---|
GET |
/api/admin/overview |
Marketplace stats | Admin |
GET |
/api/admin/users |
List all users | Admin |
PATCH |
/api/admin/users/:id/toggle |
Activate/deactivate user | Admin |
POST |
/api/admin/vouchers |
Create voucher | Admin |
// Login
const response = await axios.post('http://localhost:5000/api/auth/login', {
email: 'buyer@seapedia.com',
password: 'Password123'
})
// Get products (public)
const products = await axios.get('http://localhost:5000/api/products')
// Create order (with JWT token)
const order = await axios.post(
'http://localhost:5000/api/orders',
{ addressId, storeId, items },
{ headers: { Authorization: `Bearer ${token}` } }
)All passwords: Password123
| Role | Wallet Balance | |
|---|---|---|
| π Admin | admin@seapedia.com | Rp 0 |
| ποΈ Buyer | buyer@seapedia.com | Rp 500.000 |
| πͺ Seller | seller@seapedia.com | Rp 250.000 |
| π Driver | driver@seapedia.com | Rp 150.000 |
| Code | Discount |
|---|---|
WELCOME10 |
10% off (min Rp 50.000, max Rp 25.000) |
FLAT20K |
Rp 20.000 off (min Rp 100.000) |
COMPFEST18 |
18% off (max Rp 50.000, 7 days) |
| Command | Description | Use Case |
|---|---|---|
npm run dev |
Start development server | Daily development |
npm run build |
Build for production | Production deployment |
npm run preview |
Preview production build | Pre-deployment testing |
npm run lint |
Run ESLint | Code quality check |
| Command | Description | Use Case |
|---|---|---|
npm run dev |
Start server with nodemon | Daily development |
npm run build |
Compile TypeScript | Production build |
npm start |
Run compiled JS | Production |
npx prisma studio |
Open database GUI | Database inspection |
npx prisma migrate dev |
Run migrations | Schema changes |
npx prisma generate |
Generate Prisma client | After schema changes |
node -r ts-node/register prisma/seed.ts |
Seed demo data | Initial setup |
- Phase 0 β Project Setup & Database Schema
- Phase 1 β Authentication, Multi-Role System, UI Foundation
- Phase 2 β Store Management & Product CRUD
- Phase 3 β Wallet, Cart, Address, Checkout & Orders
- Phase 4 β Vouchers, Promos & Seller Reports
- Phase 5 β Driver Dashboard & Delivery Flow
- Phase 6 β Admin Dashboard & Marketplace Management
- Phase 7 β Security Hardening, Seed Data & Documentation
- Phase 8 β Deployment (Render + Neon + Vercel)
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature- Make your changes
- Run quality checks:
npm run lint
npm run build- Commit your changes:
git commit -m 'feat: add amazing feature'- Push to your branch:
git push origin feature/amazing-feature- Open a Pull Request
We follow Conventional Commits:
| Prefix | Description |
|---|---|
feat: |
New features |
fix: |
Bug fixes |
docs: |
Documentation changes |
style: |
Code style changes |
refactor: |
Code refactoring |
chore: |
Maintenance tasks |
npx prisma migrate reset
npx prisma migrate dev --name initPrisma v7 requires a driver adapter. Make sure @prisma/adapter-pg is installed and your Prisma client is initialized with new PrismaClient({ adapter }).
Ctrl+Shift+P > "TypeScript: Restart TS Server"
rm -rf node_modules package-lock.json
npm installThis project is licensed under the MIT License. See the LICENSE file for details.
Built with β€οΈ by Radityaaa27
A fullstack marketplace project built for COMPFEST 18 Software Engineering Academy.