ShopHub is a comprehensive fullstack e-commerce platform built to deliver a seamless online shopping experience. Designed for customers and administrators, ShopHub enables users to browse products, manage shopping carts, place orders, process payments, and track shipments β all from an intuitive web interface.
The platform supports role-based access control, automated inventory management, real-time notifications, and secure payment processing with Midtrans integration. With a powerful admin dashboard, administrators can manage products, categories, orders, users, and monitor sales analytics efficiently. ShopHub aims to provide a complete, scalable e-commerce solution through modern web technologies.
ShopHub was developed to create a modern, full-featured e-commerce platform that addresses the complexities of online retail. Traditional e-commerce solutions often lack flexibility in product management, have limited customization options, and offer poor integration capabilities. ShopHub was designed as a comprehensive, scalable solution that unifies product management, order processing, payment handling, and customer relationship management into one cohesive platform.
The platform serves as a complete e-commerce ecosystem for managing products, processing orders, handling payments, and providing excellent customer service β reducing operational complexity while improving user experience and business efficiency.
- Enable customers to browse and search products with advanced filtering capabilities
- Support comprehensive shopping cart and wishlist functionality
- Implement secure checkout process with multiple payment options
- Handle order management with real-time status tracking
- Integrate shipping cost calculation and delivery tracking
- Provide role-based dashboards (customer, admin)
- Send automated notifications for order updates and promotions
The main challenge in developing ShopHub was creating a scalable e-commerce architecture that could handle complex product catalogs, real-time inventory management, secure payment processing, and efficient order fulfillment. The application needed to support multiple user roles, provide responsive product search, handle concurrent transactions, and integrate with external payment and shipping services β all while maintaining optimal performance and user experience.
To address these challenges, I built a fullstack web application using Go (Gin) for the backend and React for the frontend. The system features a robust product management system with categorization, advanced search capabilities, and real-time inventory tracking. Users can browse products, add items to cart, apply vouchers, and complete purchases through secure payment processing. The platform includes automated order processing, shipping integration, and comprehensive admin tools for managing the entire e-commerce operation.
-
JWT Authentication β Secure user authentication with role-based access control
-
Google OAuth Integration β Seamless social login for enhanced user experience
-
Advanced Product Search & Filtering β Comprehensive product discovery with category, price, and rating filters
-
Shopping Cart & Wishlist β Persistent cart management with real-time price calculations
-
Voucher & Discount System β Flexible promotion management with percentage and fixed discounts
-
Secure Payment Processing β Integrated Midtrans payment gateway for multiple payment methods
-
Order Management System β Complete order lifecycle from placement to delivery
-
Shipping Cost Calculator β Real-time shipping cost calculation with multiple courier options
-
Inventory Management β Automated stock tracking and low-stock alerts
-
Review & Rating System β Customer feedback system for products and sellers
-
Admin Dashboard β Comprehensive analytics, sales reports, and system management
-
Real-time Notifications β Automated email and in-app notifications for order updates
-
Automated Cron Jobs β Background tasks for payment processing and system maintenance
- React 18 with React Router v7
- TailwindCSS + Radix UI + ShadCN UI
- React Hook Form + Zod (form validation)
- Zustand (state management)
- TanStack React Query (data fetching and caching)
- Stripe.js (payment processing)
- Axios (HTTP client)
- Vite (build tool)
- Golang (Gin Framework)
- GORM (ORM for MySQL)
- MySQL (Main database)
- Redis (Caching & session store)
- Midtrans (Payment gateway)
- JWT Auth (Access & Refresh Token)
- Google OAuth2 (Social authentication)
- Cloudinary (Image storage)
- Cron Jobs (Scheduled tasks)
- VPS Hosting
- Docker + Docker Compose
- Nginx (Reverse proxy)
- GitHub Actions (CI/CD)
src/
βββ assets/ # Static files such as images, icons, and fonts
βββ components/ # Reusable global UI components
β βββ admin/ # Admin-specific components
β βββ customer/ # Customer-specific components
β βββ form/ # Form components
β βββ header/ # Header and navigation components
β βββ input/ # Input field components
β βββ loading/ # Loading indicators
β βββ product-detail/ # Product detail components
β βββ product-results/ # Product listing components
β βββ public/ # Public page components
β βββ ui/ # Base UI components (shadcn/ui)
βββ pages/ # Page-level modules organized by main features
β βββ admin/ # Admin dashboard pages
β βββ customer/ # Customer account pages
β βββ CartPage.jsx # Shopping cart page
β βββ Checkout.jsx # Checkout process page
β βββ Home.jsx # Homepage
β βββ InvoicePage.jsx # Order invoice page
β βββ ProductDetail.jsx # Product detail page
β βββ ProductResults.jsx # Product search results
β βββ SignIn.jsx # User login page
β βββ SignUp.jsx # User registration page
βββ hooks/ # Global custom React hooks
β βββ useAddress.js # Address management hooks
β βββ useAuthQuery.js # Authentication query hooks
β βββ useCart.js # Shopping cart hooks
β βββ useCategory.js # Category management hooks
β βββ useOrder.js # Order management hooks
β βββ usePayment.js # Payment processing hooks
β βββ useProduct.js # Product data hooks
β βββ useVouchers.js # Voucher management hooks
βββ lib/ # Utility functions and configuration files
β βββ constant.js # Constants used across the app
β βββ react-query.js # React Query configuration
β βββ schema.js # Zod schemas for validation
β βββ utils.js # General utility functions
βββ middleware/ # Client-side route guards
β βββ index.jsx # Protected route middleware
βββ services/ # API service modules to interact with the backend
β βββ addresses.js # Address API services
β βββ auth.js # Authentication services
β βββ banners.js # Banner management services
β βββ cart.js # Cart API services
β βββ categories.js # Category services
β βββ dashboard.js # Dashboard analytics services
β βββ location.js # Location services
β βββ notification.js # Notification services
β βββ orders.js # Order management services
β βββ payment.js # Payment processing services
β βββ product.js # Product API services
β βββ profile.js # User profile services
β βββ reviews.js # Review and rating services
β βββ voucher.js # Voucher services
βββ store/ # Global state management (Zustand stores)
β βββ useAuthStore.jsx # Authentication state
β βββ useCategoryStore.jsx # Category state
β βββ useCheckoutStore.jsx # Checkout process state
β βββ useOrderStore.jsx # Order state
β βββ useProductStore.jsx # Product state
β βββ useQueryStore.jsx # Query state management
β βββ useTransactionStore.jsx # Transaction state
β βββ useUserStore.jsx # User data state
βββ App.jsx # Root component defining app layout and routes
βββ main.jsx # Entry point for rendering the React app
βββ index.html # HTML template used by Vite
server/
βββ cmd/ # Main entry point of the application
β βββ main.go # The main file that runs the server
βββ internal/
β βββ config/ # Configuration and initialization
β β βββ cloudinary.go # Cloudinary image storage config
β β βββ database.go # Database connection setup
β βββ cron/ # Scheduled background jobs
β β βββ payment_cron.go # Payment processing cron jobs
β βββ dto/ # Data Transfer Objects
β β βββ auth_dto.go # Authentication DTOs
β β βββ order_dto.go # Order DTOs
β β βββ payment_dto.go # Payment DTOs
β β βββ product_dto.go # Product DTOs
β βββ handlers/ # HTTP handlers for each feature (Controller layer)
β β βββ address_handler.go # Address management handlers
β β βββ admin_handler.go # Admin dashboard handlers
β β βββ auth_handler.go # Authentication handlers
β β βββ banner_handler.go # Banner management handlers
β β βββ cart_handler.go # Shopping cart handlers
β β βββ category_handler.go # Category management handlers
β β βββ location_handler.go # Location services handlers
β β βββ notification_handler.go # Notification handlers
β β βββ order_handler.go # Order management handlers
β β βββ payment_handler.go # Payment processing handlers
β β βββ product_handler.go # Product management handlers
β β βββ profile_handler.go # User profile handlers
β β βββ review_handler.go # Review and rating handlers
β β βββ voucher_handler.go # Voucher management handlers
β βββ middleware/ # HTTP middleware
β β βββ auth.go # Authentication middleware
β β βββ cors.go # CORS configuration
β β βββ rate_limiter.go # Rate limiting
β β βββ logger.go # Request logging
β βββ models/ # GORM model definitions
β β βββ models.go # All database models
β βββ repositories/ # Data access layer (Repository pattern)
β β βββ address_repository.go # Address data access
β β βββ auth_repository.go # Authentication data access
β β βββ banner_repository.go # Banner data access
β β βββ cart_repository.go # Cart data access
β β βββ category_repository.go # Category data access
β β βββ location_repository.go # Location data access
β β βββ notification_repository.go # Notification data access
β β βββ order_repository.go # Order data access
β β βββ payment_repository.go # Payment data access
β β βββ product_repository.go # Product data access
β β βββ profile_repository.go # Profile data access
β β βββ review_repository.go # Review data access
β β βββ voucher_repository.go # Voucher data access
β βββ routes/ # Route grouping initialization per feature
β β βββ address_route.go # Address routes
β β βββ admin_route.go # Admin routes
β β βββ auth_route.go # Authentication routes
β β βββ banner_route.go # Banner routes
β β βββ cart_route.go # Cart routes
β β βββ category_route.go # Category routes
β β βββ location_route.go # Location routes
β β βββ notification_route.go # Notification routes
β β βββ order_route.go # Order routes
β β βββ payment_route.go # Payment routes
β β βββ product_route.go # Product routes
β β βββ profile_route.go # Profile routes
β β βββ review_route.go # Review routes
β β βββ voucher_route.go # Voucher routes
β βββ seeders/ # Database seeders for initial data
β β βββ seeder.go # Database seeding functions
β βββ services/ # Core business logic of the application
β β βββ address_service.go # Address business logic
β β βββ auth_service.go # Authentication business logic
β β βββ banner_service.go # Banner business logic
β β βββ cart_service.go # Cart business logic
β β βββ category_service.go # Category business logic
β β βββ location_service.go # Location business logic
β β βββ notification_service.go # Notification business logic
β β βββ order_service.go # Order business logic
β β βββ payment_service.go # Payment business logic
β β βββ product_service.go # Product business logic
β β βββ profile_service.go # Profile business logic
β β βββ review_service.go # Review business logic
β β βββ voucher_service.go # Voucher business logic
β βββ utils/ # Common utility functions
β βββ cloudinary.go # Image upload utilities
β βββ email.go # Email sending utilities
β βββ jwt.go # JWT token utilities
β βββ response.go # Response formatting utilities
βββ go.mod # Go module dependency configuration
βββ go.sum # Go module checksum file
βββ Dockerfile # Docker build instructions
βββ docker-compose.yml # Multi-container setup for local development
βββ deploy.sh # Script for automated deployment
βββ credentials.json # Service account credentials (gitignored)
- JWT Authentication β Secure token-based authentication with access and refresh tokens
- Google OAuth Integration β Social login for enhanced user experience and onboarding
- Role-Based Access Control β Protects routes based on user roles (customer, admin) with middleware
- API Key Gateway β Secures specific endpoints with API key validation for webhook and external access
- Session Management β Redis-based session storage for scalable user session handling
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/login | User login |
| POST | /api/auth/logout | User logout |
| POST | /api/auth/register | User registration |
| POST | /api/auth/send-otp | Send OTP for verification |
| POST | /api/auth/verify-otp | Verify OTP |
| POST | /api/auth/refresh-token | Refresh access token |
| GET | /api/auth/google | Google OAuth login |
| GET | /api/auth/google/callback | Google OAuth callback |
| GET | /api/auth/me | Get current user profile |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/product | Search and filter products |
| GET | /api/product/:slug | Get product detail by slug |
| POST | /api/product | Create new product (admin) |
| PUT | /api/product/:id | Update product (admin) |
| DELETE | /api/product/:id | Delete product (admin) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/categories | Get all categories |
| GET | /api/categories/:id | Get category detail |
| POST | /api/categories | Create category (admin) |
| PUT | /api/categories/:id | Update category (admin) |
| DELETE | /api/categories/:id | Delete category (admin) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/cart | Get user cart items |
| POST | /api/cart | Add item to cart |
| PUT | /api/cart/:id | Update cart item quantity |
| DELETE | /api/cart/:id | Remove item from cart |
| DELETE | /api/cart | Clear entire cart |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/orders | Create new order (checkout) |
| GET | /api/orders | Get user orders |
| GET | /api/orders/:orderID | Get order detail |
| POST | /api/orders/check-shipping | Calculate shipping cost |
| POST | /api/orders/:orderID/shipment | Create shipment info (admin) |
| PUT | /api/orders/:orderID/shipment | Update shipment status (admin) |
| GET | /api/orders/:orderID/shipment | Get shipment info |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/payments | Get user payment history |
| POST | /api/payments/notifications | Payment webhook (Midtrans) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/profile | Get user profile |
| PUT | /api/profile | Update user profile |
| PUT | /api/profile/avatar | Update user avatar |
| GET | /api/addresses | Get user addresses |
| POST | /api/addresses | Add new address |
| PUT | /api/addresses/:id | Update address |
| DELETE | /api/addresses/:id | Delete address |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/reviews/:productID | Get product reviews |
| POST | /api/reviews | Submit product review |
| PUT | /api/reviews/:id | Update review |
| DELETE | /api/reviews/:id | Delete review |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/vouchers | Get available vouchers |
| POST | /api/vouchers/apply | Apply voucher to order |
| POST | /api/vouchers | Create voucher (admin) |
| PUT | /api/vouchers/:id | Update voucher (admin) |
| DELETE | /api/vouchers/:id | Delete voucher (admin) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/banners | Get all banners |
| POST | /api/banners | Create banner (admin) |
| PUT | /api/banners/:id | Update banner (admin) |
| DELETE | /api/banners/:id | Delete banner (admin) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/locations/provinces | Get all provinces |
| GET | /api/locations/cities/:id | Get cities by province |
| GET | /api/locations/districts/:id | Get districts by city |
| GET | /api/locations/subdistricts/:id | Get subdistricts by district |
| GET | /api/locations/postal-codes/:id | Get postal codes by subdistrict |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/notifications | Get user notifications |
| PUT | /api/notifications/read | Mark notifications as read |
| POST | /api/notifications/broadcast | Send broadcast (admin) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/dashboard | Get dashboard analytics |
| GET | /api/admin/users | Get all users |
| GET | /api/admin/orders | Get all orders |
| GET | /api/admin/sales | Get sales statistics |
VITE_API_SERVICES=https://your-api-domain.com/api
VITE_API_KEY=your-api-key
VITE_GOOGLE_CLIENT_ID=your-google-client-id# ==== MySQL Database ====
DB_HOST=your-database-host # e.g. localhost or db
DB_PORT=3306
DB_USERNAME=your-database-username # e.g. root
DB_NAME=your-database-name # e.g. ecommerce_db
DB_PASSWORD=your-database-password
# ==== Cloudinary (Image Storage) ====
CLOUDINARY_CLOUD_NAME=your-cloudinary-cloud-name
CLOUDINARY_API_KEY=your-cloudinary-api-key
CLOUDINARY_API_SECRET=your-cloudinary-api-secret
CLOUDINARY_FOLDER_NAME=your-cloudinary-folder-name
# ==== Email Service ====
USER_EMAIL=your-email-address
USER_PASSWORD=your-email-app-password # e.g. App Password from Gmail
# ==== Redis ====
REDIS_ADDR=your-redis-host:6379 # e.g. redis:6379 or localhost:6379
REDIS_PASSWORD=your-redis-password # leave blank if not used
# ==== Application Config ====
PORT=5002
API_KEY=your-api-key
JWT_ACCESS_SECRET=your-jwt-access-secret
JWT_REFRESH_SECRET=your-jwt-refresh-secret
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# ==== Midtrans Payment ====
MIDTRANS_SERVER_KEY=your-midtrans-server-key
MIDTRANS_CLIENT_KEY=your-midtrans-client-key
MIDTRANS_ENVIRONMENT=sandbox # or production
# ==== Shipping API ====
RAJAONGKIR_API_KEY=your-rajaongkir-api-key
# ==== Deployment (Optional) ====
# TRUSTED_PROXIES=your-vps-ip
# FRONTEND_REDIRECT_URL=https://yourdomain.com
# GOOGLE_REDIRECT_URL=https://your-api.yourdomain.com/api/auth/google/callbackFor this project, the backend is deployed on a VPS using Docker and Nginx, while the frontend can be deployed on various platforms like Vercel, Netlify, or traditional web hosting.
-
Provision a VPS (e.g., Ubuntu-based)
-
Install Docker and Docker Compose
-
Clone the repository into your VPS
-
Configure .env file with your production credentials
-
Run the app with Docker Compose:
docker-compose up -d --build-
Configure Nginx as reverse proxy and set up SSL with Certbot
-
Access your API via custom domain (e.g., https://api.yourdomain.com)
-
Connect your Git repository
-
Add environment variables to the hosting dashboard
-
Set build command:
npm run build- Set output directory:
dist
- Build the project locally:
npm run build-
Upload the
distfolder to your web hosting provider -
Configure environment variables through hosting control panel
- Node.js (v18 or higher)
- Go (v1.19 or higher)
- MySQL (v8.0 or higher)
- Redis (optional, for caching)
cd client
npm install
cp .env.example .env
# Configure environment variables
npm run devcd server
go mod download
cp .env.example .env
# Configure environment variables
go run cmd/main.go- Create MySQL database
- Update database credentials in
.env - Run the application - it will auto-migrate tables and seed initial data
Contributions are welcome! If you'd like to improve or extend this project:
-
Fork this repository
-
Create a new branch:
git checkout -b feature/your-feature-name- Commit your changes:
git commit -m "feat: add new feature"- Push to your branch:
git push origin feature/your-feature-name- Open a Pull Request
This project is licensed under the MIT License. Feel free to use, modify, and distribute it for personal or commercial purposes.
MIT License
- π€ Name: Ahmad Fiqri Oemry
- π§ Email: fiqrioemry@gmail.com
- π LinkedIn: https://www.linkedin.com/in/ahmadfiqrioemry
- πΌοΈ Live Preview: [Coming Soon]