You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cravely is a production-grade food delivery platform designed to provide a seamless end-to-end experience β from browsing a curated food menu, to placing an order, processing secure payments, and tracking delivery in real time.
The Problem It Solves
Traditional food ordering is fragmented β customers juggle phone calls, inconsistent menus, and zero visibility into delivery status. Restaurant owners lack insights into revenue, popular dishes, or order efficiency.
The Cravely Solution
Cravely unifies the entire food ordering lifecycle into a single, premium web experience:
Customers get a modern, responsive storefront with smooth animations, real-time order tracking via WebSockets, and secure Stripe-powered payments.
Restaurant Admins get a dedicated dashboard with analytics (revenue trends, top dishes, user counts), inventory management, and real-time order status control that pushes live updates to customers.
Restaurant Sellers can register independently and manage their catalog through the admin panel.
Built with a modern MERN stack (MongoDB, Express, React, Node.js) and enhanced with Socket.IO for live updates, ImageKit CDN for optimized image delivery, and Nodemailer for transactional email receipts.
π¨ Visual Layout & UI Experience
Cravely is designed to feel premium at every touchpoint. Here's the user journey:
π Landing Experience
The app opens with an animated preloader featuring the Cravely brand logo with pulsing rings and a smooth progress bar. After the preloader fades out, users land on a full-screen hero section with:
Dynamic stat counters (1000+ Happy Customers, 500+ Dishes, 4.8β Rating)
Gradient call-to-action buttons with hover micro-animations
A sticky, glassmorphic navbar that transforms on scroll
π΄ Menu Exploration
Horizontally scrollable category filter with icons (Salad, Rolls, Deserts, etc.)
Food cards with CDN-optimized images, add-to-cart buttons with quantity controls
Smooth Lenis-powered scroll for a buttery browsing experience
π Cart & Checkout
Itemized cart with real-time total calculation and delivery fee breakdown
Full delivery address form with client-side validation
Stripe Checkout redirect for PCI-compliant payment processing
π¦ Real-Time Order Tracking
Visual stepper (Food Processing β Out for Delivery β Delivered)
Live WebSocket updates β status changes made by the admin instantly reflect on the customer's tracking page
Glassmorphic card design with pulse-animated delivery icon
π‘οΈ Server Wakeup Handler
On Render's free tier, the backend may cold-start. Cravely detects slow API responses (>5s) and shows a premium Server Wakeup overlay with cycling status messages, elapsed timer, and a shimmer progress bar β ensuring users never see a broken screen.
π Admin Dashboard
Recharts-powered analytics: Revenue trend line charts and top-5 popular dishes bar charts
Glassmorphism metric cards showing Total Revenue, Total Orders, and Total Users
Order management with dropdown status updates that push via Socket.IO
β¨ Core Features & Benefits
Technical Feature
User Benefit
Stripe Payment Integration
Secure, PCI-compliant card payments with automatic redirect flow
Socket.IO Real-Time Updates
Customers see order status changes live without refreshing
JWT Authentication
Secure, stateless user sessions with 24-hour token expiry
Bcrypt Password Hashing
User passwords are never stored in plaintext
ImageKit CDN
Food images load instantly via global CDN with auto-optimization
Nodemailer Email Receipts
Users receive styled HTML order confirmation emails after payment
Recharts Analytics Dashboard
Admins visualize revenue trends and popular dishes at a glance
Lenis Smooth Scrolling
Buttery-smooth page scrolling that feels native and premium
Role-Based Access Control
Separate user, seller, and admin roles with distinct permissions
Optimistic Cart Updates
Cart changes feel instant β synced to server in background with rollback
Cold-Start Detection
Intelligent server wakeup overlay prevents user confusion on free-tier hosting
Responsive Design
Fully optimized for mobile (480px), tablet (768px), and desktop
Animated Preloader
Premium brand loading experience with pulsing animations
Multer In-Memory Upload
Images upload directly to CDN without touching server disk
ποΈ Architecture Diagram
graph TB
subgraph Client["π Client Layer"]
FE["π₯οΈ Customer Frontend<br/>(React + Vite)"]
AD["π Admin Dashboard<br/>(React + Vite)"]
end
subgraph Server["βοΈ Server Layer"]
API["π Express.js API Server"]
WS["π Socket.IO Server"]
MW["π‘οΈ Auth Middleware<br/>(JWT Verification)"]
end
subgraph Services["π External Services"]
ST["π³ Stripe<br/>Payment Gateway"]
IK["πΌοΈ ImageKit<br/>CDN"]
EM["π§ Nodemailer<br/>SMTP / Ethereal"]
end
subgraph Data["πΎ Data Layer"]
DB[("π MongoDB Atlas")]
end
FE -->|"REST API + Axios"| API
AD -->|"REST API + Axios"| API
FE <-->|"WebSocket"| WS
API --> MW
MW --> DB
API -->|"Checkout Session"| ST
ST -->|"Success/Cancel redirect"| FE
API -->|"Image Upload"| IK
API -->|"Order Confirmation"| EM
WS -->|"order-status-update"| FE
AD -->|"Status Change"| API
API -->|"Emit Event"| WS
Loading
Data Flow: Order Lifecycle
sequenceDiagram
participant C as π€ Customer
participant F as π₯οΈ Frontend
participant B as βοΈ Backend
participant S as π³ Stripe
participant D as π MongoDB
participant E as π§ Email
participant A as π Admin
participant W as π Socket.IO
C->>F: Browse menu & add to cart
F->>B: POST /api/cart/add
B->>D: Update user cartData
C->>F: Proceed to checkout
F->>B: POST /api/order/place
B->>D: Create order (payment: false)
B->>S: Create Checkout Session
S-->>F: Redirect to Stripe
C->>S: Complete payment
S-->>F: Redirect to /verify?success=true
F->>B: POST /api/order/verify
B->>D: Set payment: true
B->>E: Send confirmation email
A->>B: POST /api/order/status
B->>D: Update order status
B->>W: Emit "order-status-update"
W-->>F: Live status push
F-->>C: Tracking page updates instantly
Loading
π οΈ Tech Stack & Tools
Frontend
Technology
Purpose
React 18
Component-based UI with hooks and context API
Vite 5
Lightning-fast dev server and optimized production builds
React Router v6
Client-side routing with nested routes
Axios
HTTP client with interceptors and centralized configuration
Socket.IO Client
Real-time WebSocket communication
Lenis
Ultra-smooth scroll library for premium UX
React Toastify
Toast notifications for user feedback
Stripe.js
Secure client-side payment integration
Outfit Font
Modern Google Font for consistent typography
Backend
Technology
Purpose
Node.js
JavaScript runtime for server-side logic
Express.js
Minimal web framework for REST API routing
Socket.IO
Bidirectional real-time event-based communication
Mongoose
ODM for MongoDB with schema validation
JSON Web Tokens
Stateless authentication with signed tokens
Bcrypt
Industry-standard password hashing (10 salt rounds)
Multer
Multipart form-data parsing with in-memory storage
Stripe SDK
Server-side payment processing and checkout sessions
ImageKit SDK
Cloud image upload, optimization, and CDN delivery
graph LR
A["π€ User submits<br/>credentials"] --> B["βοΈ Express validates<br/>email + password"]
B --> C["π Bcrypt.compare()<br/>password hash"]
C -->|"Match"| D["π« JWT.sign()<br/>24h expiry"]
D --> E["πͺ Set httpOnly cookie<br/>+ return token"]
E --> F["π₯οΈ Frontend stores token<br/>in localStorage"]
F --> G["π‘ Subsequent requests<br/>send token in headers"]
G --> H["π‘οΈ authMiddleware<br/>verifies JWT"]
H -->|"Valid"| I["β Route handler<br/>proceeds"]
H -->|"Invalid"| J["β 401 Unauthorized"]
Loading
Security Measures
Layer
Implementation
Password Storage
Bcrypt hashing with 10 salt rounds β passwords are never stored or logged in plaintext
Token Authentication
JWT tokens signed with JWT_SECRET, expire after 24 hours
Cookie Security
httpOnly: true, secure: true in production, sameSite: "None" for cross-origin
Session Expiration
401 responses trigger session-expired custom event, clearing all stored credentials
Input Validation
Server-side validation via validator library (email format, password length β₯ 6)
Password Visibility
Frontend toggle doesn't store state β field type switches between password and text
CORS Policy
White-listed origins only (localhost:5173, localhost:5174, Vercel production domain)
File Upload Safety
Multer uses in-memory storage β uploaded files never touch the server filesystem
Role-Based Access
User model supports user, seller, and admin roles with enum enforcement
XSS Protection
React's JSX auto-escapes rendered content by default
β‘ Setup & Installation
Prerequisites
Requirement
Version
Node.js
v18+ recommended
npm
v9+
MongoDB
Atlas cloud instance (free tier works)
Stripe Account
For payment processing (test mode available)
ImageKit Account
For image CDN (free tier: 20 GB/month)
1οΈβ£ Clone the Repository
git clone https://github.com/your-username/Food-delivery.git
cd Food-delivery
2οΈβ£ Install Dependencies
# Backendcd backend
npm install
# Frontend (new terminal)cd ../frontend
npm install
# Admin (new terminal)cd ../admin
npm install
3οΈβ£ Configure Environment Variables
Create a .env file in the backend/ directory:
# DatabaseMOGODB_URL=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<dbname># AuthenticationJWT_SECRET=your_jwt_secret_key_here# StripeSTRIPE_SECRET_KEY=sk_test_your_stripe_secret_key# ImageKit CDNIMAGEKIT_PUBLIC_KEY=public_your_imagekit_public_keyIMAGEKIT_PRIVATE_KEY=private_your_imagekit_private_keyIMAGEKIT_URL_ENDPOINT=https://ik.imagekit.io/your_id# Email (Optional β falls back to Ethereal mock if omitted)SMTP_HOST=smtp.gmail.comSMTP_PORT=465SMTP_USER=your_email@gmail.comSMTP_PASS=your_app_passwordSMTP_FROM="Cravely Updates" <noreply@cravely.com>
4οΈβ£ Start Development Servers
# Terminal 1 β Backend (port 4000)cd backend
npm run dev
# Terminal 2 β Frontend (port 5173)cd frontend
npm run dev
# Terminal 3 β Admin Panel (port 5174)cd admin
npm run dev
π‘ Note: If SMTP_USER and SMTP_PASS are not set, the email service automatically falls back to Ethereal mock emails. Preview URLs are logged to the console β perfect for development.
π Deployment
Frontend β Vercel
Push frontend/ to a GitHub repo
Import in vercel.com β select frontend as root directory
Framework preset: Vite
The vercel.json SPA rewrite is included automatically
Add all environment variables from the .env section above
Admin β Vercel / Netlify
Deploy similarly to the frontend
Set root directory to admin/
No special configuration needed
β οΈ Note: Render's free tier puts the server to sleep after 15 minutes of inactivity. Cravely includes a built-in Server Wakeup overlay that detects cold starts and shows a user-friendly loading screen while the server boots up (~30-50 seconds).
π€ Contributing
Contributions are welcome! Please follow these steps:
Fork the repository
Create a feature branch (git checkout -b feature/amazing-feature)
Commit your changes (git commit -m 'Add amazing feature')
Push to the branch (git push origin feature/amazing-feature)
Open a Pull Request
Guidelines
Follow existing code style and component patterns
Use the centralized api/client.js for all HTTP requests
Keep components in their own directories with co-located CSS
Test on mobile viewports before submitting UI changes
π License
This project is open source and available under the MIT License.
Built with β€οΈ by Cravely Team
β Star this repo if you found it useful!
About
π₯ Cravely β A full-stack MERN food delivery platform with real-time order tracking, Stripe payments, admin analytics dashboard, and ImageKit CDN. Built with React, Node.js, MongoDB, and Socket.IO.