A modern, full-stack food ordering application built with React, Node.js, Express, and PostgreSQL. Features real-time order tracking, admin dashboard, payment integration, and push notifications.
- π Secure Authentication - OTP-based login via Twilio SMS
- π½οΈ Browse Menu - View and search food items with detailed descriptions
- π Shopping Cart - Add, remove, and manage items in cart
- π³ Multiple Payment Options - Support for various payment methods
- π Address Management - Save and manage multiple delivery addresses
- π± Push Notifications - Real-time order status updates
- β Reviews & Ratings - Rate and review your orders
- π Offers & Discounts - View and apply promotional offers
- π Order History - Track current and past orders
- π Analytics Dashboard - Real-time business metrics and charts
- π¦ Order Management - View and update order statuses
- π Menu Management - Add, edit, and manage menu items
- π₯ User Management - View and manage customer accounts
- ποΈ Offer Management - Create and manage promotional offers
- π Inventory Tracking - Monitor stock levels
- π Admin Notifications - SMS alerts for new orders and critical events
- π° Payment Tracking - Monitor payments and transactions
- π¨ Modern UI - Built with React, Tailwind CSS, and Framer Motion
- π± Responsive Design - Works seamlessly on desktop and mobile
- π Secure API - JWT-based authentication and authorization
- π‘ Real-time Updates - WebSocket integration for live notifications
- ποΈ Database - PostgreSQL with Sequelize ORM
- π Performance - Optimized with Vite for fast development and builds
- π Service Workers - PWA capabilities for offline support
- π§ Email Integration - Nodemailer for email notifications
- Framework: React 18.3
- Routing: React Router DOM 7.8
- Styling: Tailwind CSS, Radix UI components
- Animation: Framer Motion
- Charts: Chart.js, React-ChartJS-2
- Icons: Lucide React, React Icons
- Build Tool: Vite
- HTTP Client: Axios
- Runtime: Node.js
- Framework: Express.js
- Database: PostgreSQL
- ORM: Sequelize
- Authentication: JWT (jsonwebtoken), bcryptjs
- SMS: Twilio
- Push Notifications: web-push
- File Upload: Multer
- Email: Nodemailer
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher)
- npm or yarn
- PostgreSQL (v12 or higher)
- Git
git clone https://github.com/yourusername/smiley-food-app.git
cd smiley-food-app# Install root dependencies
npm install
# Install server dependencies
cd server
npm install
cd ..Create a .env file in the root directory:
cp .env.example .envEdit .env and add your configuration (see Environment Variables section below).
# Create the database
createdb smiley
# Run migrations (if you have any)
cd server
npm run migratenpm run devThis runs both the client (on http://localhost:3000) and server (on http://localhost:5000) concurrently.
# Build the client
npm run build
# Start the server
npm startCreate a .env file with the following variables:
# Server Configuration
PORT=5000
NODE_ENV=development
HOST=0.0.0.0
# Frontend API URL
VITE_API_BASE_URL=http://localhost:5000
# Database Configuration
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=smiley
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password
# OR use connection URI (for cloud databases like Neon)
# POSTGRES_URI=postgresql://user:password@host:port/database
# JWT Authentication
JWT_SECRET=your_secure_jwt_secret_minimum_32_characters
# Twilio SMS Configuration
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=your_twilio_phone_number
TWILIO_VERIFY_SERVICE_SID=your_verify_service_sid
# Push Notifications (VAPID Keys)
VAPID_PUBLIC_KEY=your_vapid_public_key
VAPID_PRIVATE_KEY=your_vapid_private_key
# Admin Notifications
ADMIN_PHONE_1=+1234567890
ADMIN_PHONE_2=+1234567890
# Email Configuration (Optional)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASSWORD=your_app_passwordFor push notifications, generate VAPID keys:
npx web-push generate-vapid-keyssmiley-food-app/
βββ public/ # Static files
β βββ service-worker.js # Service worker for PWA
β βββ images/ # Public images
βββ server/ # Backend application
β βββ config/ # Configuration files
β βββ controllers/ # Route controllers
β βββ middleware/ # Express middleware
β βββ models/ # Sequelize models
β βββ routes/ # API routes
β βββ services/ # Business logic services
β βββ utils/ # Utility functions
β βββ server.js # Server entry point
βββ src/ # Frontend application
β βββ api/ # API client
β βββ components/ # React components
β βββ contexts/ # React contexts
β βββ hooks/ # Custom React hooks
β βββ pages/ # Page components
β βββ routes/ # Route definitions
β βββ services/ # Frontend services
β βββ types/ # TypeScript types
β βββ main.tsx # Frontend entry point
βββ .env.example # Example environment variables
βββ .gitignore # Git ignore rules
βββ package.json # Root dependencies and scripts
βββ tailwind.config.js # Tailwind CSS configuration
βββ vite.config.ts # Vite configuration
βββ README.md # This file
npm run dev- Start both client and server in development modenpm run client:dev- Start only the client (Vite dev server)npm run server:dev- Start only the server (with nodemon)npm run build- Build the client for productionnpm run preview- Preview production buildnpm run lint- Run ESLintnpm start- Start the server in production mode
npm start- Start server (production)npm run dev- Start server with nodemon (development)
This project implements several security measures:
- Environment Variables - All sensitive data stored in
.env(never committed) - JWT Authentication - Secure token-based authentication
- Password Hashing - bcryptjs for password encryption
- SQL Injection Prevention - Sequelize ORM with parameterized queries
- CORS Protection - Configured CORS policies
- Input Validation - Server-side validation on all inputs
- Rate Limiting - Implemented on authentication endpoints
- HTTPS - Recommended for production deployments
http://localhost:5000/api
POST /api/auth/send-otp- Send OTP to phonePOST /api/auth/verify-otp- Verify OTP and loginGET /api/auth/me- Get current user (requires auth)
GET /api/menu- Get all menu itemsGET /api/menu/:id- Get single menu itemPOST /api/menu- Create menu item (admin)PUT /api/menu/:id- Update menu item (admin)DELETE /api/menu/:id- Delete menu item (admin)
GET /api/orders- Get user's ordersPOST /api/orders- Create new orderGET /api/orders/:id- Get order detailsPUT /api/orders/:id- Update order status (admin)
For complete API documentation, see API.md.
# Run tests (when implemented)
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage- Create a PostgreSQL database on your hosting platform (e.g., Neon, Supabase, Railway)
- Update
POSTGRES_URIor individual database environment variables - Run migrations if applicable
This project is configured for deployment on:
- Frontend: Netlify (with
netlify.toml) - Backend: Render (with
render.yamlblueprint) - Database: Render PostgreSQL
π For complete step-by-step instructions, see DEPLOYMENT.md
-
Push to GitHub
git push origin main
-
Deploy Backend on Render
- Connect repository and use Blueprint
- Render will auto-create database and web service
- Set sensitive environment variables
-
Deploy Frontend on Netlify
- Connect repository (auto-detects
netlify.toml) - Set
VITE_API_BASE_URLto your Render backend URL - Deploy!
- Connect repository (auto-detects
-
Update CORS
- Set
FRONTEND_URLon Render to your Netlify URL - Redeploy backend
- Set
- All environment variables configured on Netlify and Render
- JWT_SECRET is a secure random string (32+ characters)
- Database backups enabled on Render
- CORS configured with your actual Netlify domain
- Test authentication, orders, and payments
- Monitor logs for errors
- Set up uptime monitoring (UptimeRobot, etc.)
Contributions are welcome! Please see CONTRIBUTING.md for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Your Name - Initial work - YourGitHub
- React
- Express.js
- PostgreSQL
- Tailwind CSS
- Twilio
- All other open-source libraries used in this project
For support, email your-email@example.com or create an issue in the repository.
- Service worker may need manual update in some browsers
- Push notifications require HTTPS in production
- Add unit and integration tests
- Implement payment gateway integration
- Add multi-language support
- Create mobile app versions (React Native)
- Add real-time chat support
- Implement loyalty program
- Add social media authentication
Made with β€οΈ using React and Node.js