Skip to content
0xAlpha01Public

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ChopLife Kitchen ๐Ÿฒ

Fresh meals. Fast delivery. No stress.

ChopLife Kitchen is a full-stack Nigerian restaurant ordering platform built to provide a smooth food-ordering experience for customers and a practical operations dashboard for restaurant staff.

Customers can browse meals, customize orders, check out as guests, choose a payment method, receive an order number, and track their order. Restaurant staff can manage orders, menu items, categories, customers, restaurant settings, and order status from a protected admin dashboard.

Built as a real-world portfolio project โ€” focused on usability, responsive UI, API design, authentication, database integration, and restaurant operations.


๐ŸŒ Live Demo

Frontend: https://choplife-lime.vercel.app


โœจ Highlights

  • ๐Ÿ› Modern Nigerian food-focused restaurant storefront
  • ๐Ÿ”Ž Menu search, category filtering, sorting, and availability filtering
  • ๐Ÿ›’ Persistent shopping cart with quantities, extras, and special instructions
  • ๐Ÿ‘ค Guest checkout โ€” no account required
  • ๐Ÿ“ฑ WhatsApp-friendly order confirmation and sharing
  • ๐Ÿ“ฆ Order tracking with a visual status timeline
  • โšก Automatic order refresh for near real-time tracking
  • ๐Ÿ” JWT-protected admin dashboard
  • ๐Ÿ“Š Admin statistics for orders, revenue, pending orders, and completed orders
  • ๐Ÿฝ๏ธ Full menu and category management
  • โš™๏ธ Restaurant settings management
  • ๐Ÿ’ฐ Server-side order total calculation to prevent client-side price tampering
  • ๐Ÿ“ฑ Fully responsive across mobile, tablet, and desktop

๐Ÿ“‹ Table of Contents


๐Ÿš€ Features

Customer Experience

  • Modern, mobile-first restaurant storefront
  • Home, menu, food details, cart, checkout, and order tracking pages
  • Search by food name
  • Filter by category
  • Sort menu items
  • Filter available items
  • Add extras to menu items
  • Add special instructions
  • Cart persisted in localStorage
  • Guest checkout with form validation
  • Order confirmation with order number
  • Shareable WhatsApp order message
  • Public order tracking using /order/:orderNumber
  • Visual order status timeline
  • Automatic tracking refresh
  • Responsive design from small mobile screens to large desktops

Admin Dashboard

  • Protected admin authentication
  • Dashboard statistics
  • Order management
  • Order status workflow:
Pending โ†’ Confirmed โ†’ Preparing โ†’ Ready โ†’ Out for Delivery โ†’ Delivered
  • Cancelled order state
  • Create, update, and delete menu items
  • Manage menu extras
  • Manage ingredients
  • Toggle item availability
  • Mark items as popular
  • Create, update, and delete categories
  • Enable or disable categories
  • View customer information derived from order history
  • Update restaurant information and delivery settings
  • Manage WhatsApp contact information and social links

Engineering

  • Layered backend architecture
  • REST API built with Go and Gin
  • MongoDB persistence
  • JWT authentication
  • Bcrypt password hashing
  • Role-based admin middleware
  • Server-side price calculation
  • MongoDB indexes for important queries and unique fields
  • Consistent API response envelope
  • Loading states, empty states, confirmation dialogs, and toast feedback
  • Real API actions throughout the dashboard instead of placeholder buttons

๐Ÿ› ๏ธ Tech Stack

Frontend

  • React 19
  • TypeScript
  • Vite
  • Tailwind CSS v4
  • React Router
  • Zustand
  • React Hook Form
  • Axios
  • Lucide React

Backend

  • Go
  • Gin
  • MongoDB Official Go Driver
  • JWT
  • Bcrypt

Database

  • MongoDB
  • MongoDB Atlas for production
  • Local MongoDB for development

Deployment

  • Vercel for the frontend
  • Render, Railway, or Fly.io for the backend
  • MongoDB Atlas for production database hosting

๐Ÿงฉ Architecture

                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚    React Frontend   โ”‚
                     โ”‚   Vite + Tailwind   โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
                         Axios / REST API
                                โ”‚
                                โ–ผ
                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚    Go + Gin API     โ”‚
                     โ”‚                     โ”‚
                     โ”‚ Routes              โ”‚
                     โ”‚ Controllers         โ”‚
                     โ”‚ Services            โ”‚
                     โ”‚ Middleware          โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
                         MongoDB Driver
                                โ”‚
                                โ–ผ
                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚       MongoDB       โ”‚
                     โ”‚                     โ”‚
                     โ”‚ Users               โ”‚
                     โ”‚ Menu Items          โ”‚
                     โ”‚ Categories          โ”‚
                     โ”‚ Orders              โ”‚
                     โ”‚ Settings            โ”‚
                     โ”‚ Counters            โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Order Pricing

The frontend sends:

  • Menu item IDs
  • Quantities
  • Selected extras
  • Special instructions

The backend then looks up the current menu data and calculates the order total itself.

This means the API does not trust prices coming directly from the browser.


๐Ÿ“ Project Structure

choplife-kitchen/
โ”‚
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ common/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ layout/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ menu/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ cart/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ admin/
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ admin/
โ”‚   โ”‚   โ”œโ”€โ”€ layouts/
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/
โ”‚   โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ store/
โ”‚   โ”‚   โ”œโ”€โ”€ types/
โ”‚   โ”‚   โ””โ”€โ”€ utils/
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ vite.config.ts
โ”‚
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ cmd/
โ”‚   โ”‚   โ””โ”€โ”€ seed/
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”œโ”€โ”€ controllers/
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”œโ”€โ”€ middleware/
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”œโ”€โ”€ database/
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ””โ”€โ”€ main.go
โ”‚
โ””โ”€โ”€ README.md

โœ… Prerequisites

Make sure these are installed:


๐Ÿ—„๏ธ MongoDB Setup

ChopLife uses local MongoDB during development.

Make sure the MongoDB service is installed and running on your computer.

Local MongoDB

The default connection string is:

MONGODB_URI=mongodb://localhost:27017

The application uses the choplife database:

MONGODB_DATABASE=choplife

You can verify that MongoDB is running through MongoDB Compass or mongosh.

MongoDB Atlas

For production deployment, MongoDB Atlas can be used instead.

Example:

MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net

๐Ÿ” Environment Variables

Backend โ€” backend/.env

Create the file from .env.example:

PORT=8080
MONGODB_URI=mongodb://localhost:27017
MONGODB_DATABASE=choplife
JWT_SECRET=change_this_secret
JWT_EXPIRY_HOURS=72
CLIENT_URL=http://localhost:5173
WHATSAPP_NUMBER=2348012345678

Frontend โ€” frontend/.env

VITE_API_URL=http://localhost:8080/api
VITE_WHATSAPP_NUMBER=2348012345678

Production Notes

  • Replace JWT_SECRET with a strong random secret.
  • Set CLIENT_URL to the exact deployed frontend origin.
  • Use your real WhatsApp business number.
  • Never commit .env files or production secrets to GitHub.

๐Ÿ’ป Run Locally

The project can be run on Windows using Command Prompt or PowerShell.

1. Start the Backend

cd backend
copy .env.example .env
go mod tidy
go run ./cmd/seed
go run .

Backend:

http://localhost:8080

2. Start the Frontend

Open another terminal:

cd frontend
copy .env.example .env
npm install
npm run dev

Frontend:

http://localhost:5173

๐ŸŒฑ Seed the Database

Run:

cd backend
go run ./cmd/seed

The seed script creates starter data including:

  • 7 food categories
  • 13 menu items
  • Menu prices
  • Ingredients
  • Extras
  • Restaurant settings
  • Delivery fee and minimum order settings
  • Default admin account

The seed operation is designed to be safely re-run without creating duplicate starter records.


๐Ÿ”Œ API Overview

Base URL:

http://localhost:8080/api

Response Format

Successful response:

{
  "success": true,
  "data": {}
}

Error response:

{
  "success": false,
  "message": "Human-readable error"
}

Authentication

Method Endpoint Description
POST /auth/register Create an admin account
POST /auth/login Login and receive JWT
GET /auth/me Get current admin ๐Ÿ”’

Menu

Method Endpoint Description
GET /menu List menu items
GET /menu/:id Get one menu item
POST /menu Create menu item ๐Ÿ”’
PUT /menu/:id Update menu item ๐Ÿ”’
DELETE /menu/:id Delete menu item ๐Ÿ”’

Categories

Method Endpoint Description
GET /categories List categories
POST /categories Create category ๐Ÿ”’
PUT /categories/:id Update category ๐Ÿ”’
DELETE /categories/:id Delete category ๐Ÿ”’

Orders

Method Endpoint Description
POST /orders Place guest order
GET /orders/:orderNumber Track public order
GET /orders List orders ๐Ÿ”’
GET /orders/stats Dashboard statistics ๐Ÿ”’
PUT /orders/:id/status Update order status ๐Ÿ”’

Settings

Method Endpoint Description
GET /settings Get public restaurant settings
PUT /settings Update settings ๐Ÿ”’

๐Ÿ‘จโ€๐Ÿ’ผ Admin Access

After seeding the database, the default development admin is:

Email: admin@choplife.com
Password: Admin@123

Admin login:

/admin/login

Important: Change the default password immediately in any real deployment.


๐Ÿ’ณ Payment Model

The current project supports two payment options:

Cash on Delivery

Customers place an order and payment is collected when the order is delivered.

Demo Payment

A simulated online payment flow created for portfolio/demo purposes.

The demo payment system:

  • Does not process real money
  • Does not collect card details
  • Simulates a successful payment

A real integration with Paystack, Flutterwave, or Stripe can be added later without redesigning the core order system.


๐Ÿš€ Deployment

Frontend - Vercel

The frontend is deployed on Vercel.

For deployment:

  1. Push the project to GitHub.
  2. Import the repository into Vercel.
  3. Set the project root to frontend.
  4. Use the following build command:
npm run build
  1. Output directory:
dist
  1. Configure the API URL:
VITE_API_URL=https://your-backend-url/api

Backend โ€” Render / Railway / Fly.io

Deploy the backend directory and configure:

PORT=8080
MONGODB_URI=your_mongodb_atlas_uri
MONGODB_DATABASE=choplife
JWT_SECRET=your_production_secret
JWT_EXPIRY_HOURS=72
CLIENT_URL=https://your-frontend-url.vercel.app
WHATSAPP_NUMBER=your_whatsapp_number

Database โ€” MongoDB Atlas

For production, use MongoDB Atlas and set MONGODB_URI to your Atlas connection string.


โš ๏ธ Known Limitations

These are intentional MVP decisions:

  • Online payment is currently simulated for demo purposes.
  • Admin JWT is stored in localStorage.
  • Admin registration is available for initial setup and should be restricted in production.
  • Delivery pricing currently uses a configurable flat fee.
  • Customers do not have dedicated accounts; customer information is derived from order history.

๐Ÿ”ฎ Future Improvements

Potential future improvements include:

  • Real Paystack or Flutterwave payment integration
  • Zone-based delivery pricing
  • Customer accounts and order history
  • Promo codes and discounts
  • Inventory tracking
  • Restaurant staff roles and permissions
  • Email/SMS order notifications
  • Advanced sales and revenue analytics
  • Order receipt generation
  • Automated deployment and CI/CD

๐Ÿ‘จโ€๐Ÿ’ป Why I Built This

ChopLife Kitchen was built to demonstrate how a real business workflow can be translated into a complete full-stack web application.

The project covers the complete flow from:

Customer browsing โ†’ Cart โ†’ Checkout โ†’ Order creation โ†’ Database persistence โ†’ Order tracking โ†’ Restaurant administration

It combines a polished React frontend with a structured Go backend and MongoDB database instead of treating the project as a simple static food website.


๐Ÿ“„ License

This project is primarily intended as a portfolio and learning project.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages