A full-stack web application for browsing, listing, and managing a variety of food items. Built using React (Frontend), Express.js (Backend), and MongoDB with complete Docker support for seamless development and deployment.
π Table of Contents
- React 18.3 - User interface
- Vite - Fast build tool and dev server
- React Router DOM - Client-side routing
- ESLint - Linting and code style enforcement
- Node.js + Express - REST API server
- CORS + JSON Middleware - Cross-origin requests
- Multer - File upload handling
- Modular API Routing - Organized route structure
- MongoDB - NoSQL database for data storage
- Docker - Containerization for all services
- Docker Compose - Multi-service orchestration
Choose one of the following setups:
For Docker Setup (Recommended):
- Docker Desktop
- Docker Compose
For Manual Setup:
- Node.js (v16 or above)
- npm or yarn
- MongoDB (local or cloud)
One-command setup for the entire application:
# Clone the repository
git clone https://github.com/your-username/foodie.git
cd foodie
# Start all services with Docker
docker-compose up --buildAccess the application:
- π Frontend: http://localhost:3000
- π οΈ Admin Panel: http://localhost:5173
- π Backend API: http://localhost:4000
- ποΈ MongoDB: localhost:27017
Docker Services:
- foodie-frontend: React app (Port 3000)
- foodie-admin: Admin panel (Port 5173)
- foodie-backend: Express API (Port 4000)
- foodie-mongodb: MongoDB database (Port 27017)
# Clone the repository
git clone https://github.com/your-username/foodie.git
cd foodie
# Install dependencies for all services
cd frontend && npm install && cd ..
cd backend && npm install && cd ..
cd admin && npm install && cd ..# Start all services
docker-compose up
# Start in detached mode
docker-compose up -d
# View logs for specific service
docker-compose logs frontend
docker-compose logs backend
docker-compose logs adminStart Frontend:
cd frontend
npm run devStart Admin Panel:
cd admin
npm run devStart Backend:
cd backend
npm run serverStart MongoDB:
# Make sure MongoDB is running locally
mongodFoodie/
βββ frontend/ # React frontend application
β βββ src/
β βββ Dockerfile
β βββ .dockerignore
β βββ package.json
βββ backend/ # Express.js backend API
β βββ routes/
β βββ config/
β βββ uploads/
β βββ server.js
β βββ Dockerfile
β βββ .dockerignore
β βββ package.json
βββ admin/ # React admin panel
β βββ src/
β βββ Dockerfile
β βββ .dockerignore
β βββ package.json
βββ docker-compose.yml # Multi-service orchestration
βββ .dockerignore # Root Docker ignore file
βββ README.md
βββ CONTRIBUTING.md
# Build and start all services
docker-compose up --build
# Start services in background
docker-compose up -d
# Stop all services
docker-compose down
# Stop and remove volumes (β οΈ deletes database data)
docker-compose down -v
# Restart specific service
docker-compose restart backend
# View running containers
docker-compose ps# View logs for all services
docker-compose logs
# View logs for specific service
docker-compose logs -f frontend
# Execute commands in running container
docker-compose exec backend npm install new-package
# Rebuild specific service
docker-compose build backend# Access MongoDB shell
docker-compose exec mongodb mongosh
# Backup database
docker-compose exec mongodb mongodump --out /backup
# View MongoDB logs
docker-compose logs mongodbESLint is pre-configured with React and Hooks rules for frontend and admin.
# Frontend linting
cd frontend && npm run lint
# Admin linting
cd admin && npm run lint| Command | Description |
|---|---|
npm run dev |
Start Vite development server |
npm run build |
Build for production |
npm run preview |
Preview production build |
npm run lint |
Run ESLint checks |
| Command | Description |
|---|---|
npm start |
Start production server |
npm run server |
Start development server with nodemon |
The application uses the following environment variables:
Backend:
MONGODB_URI: MongoDB connection stringJWT_SECRET: Secret key for JWT tokensPORT: Server port (default: 4000)
Frontend:
REACT_APP_API_URL: Backend API URL
Admin:
VITE_API_URL: Backend API URL for Vite
- Docker: MongoDB runs automatically with authentication
- Username:
admin - Password:
password123 - Database:
foodie
- Username:
- Manual: Update
connectDB()inbackend/config/db.js
- Backend handles file uploads via Multer
- Files are stored in
backend/uploads/directory - Docker setup includes volume mounting for persistence
We welcome contributions to the Foodie project! If you find this project helpful, please consider:
- β Star this repository to show your support and help others discover it
- π Report bugs or suggest features through issues
- π§ Submit pull requests for improvements
- π Help improve documentation
- π For more info go to CONTRIBUTING.md
- Fork the repository
- Create a feature branch
- Use Docker for consistent development environment
- Test your changes with
docker-compose up --build - Submit a pull request
This project is licensed under the MIT License.