A production-ready monorepo structure for full-stack web applications with separated frontend and backend, enabling independent development and deployment.
An auction marketplace where users can list items and place bids. Features include authentication, listings, bidding, wallet, and order tracking with an escrow-based payment system.
- Project Overview
- Folder Structure
- Tech Stack
- Quick Start
- Development Commands
- Project Structure
- API Documentation
- Environment Configuration
- Troubleshooting
- Future Enhancements
BidZo is a scalable monorepo setup that provides:
- Frontend: React application with Vite for fast development
- Backend: Express.js REST API server
- Shared: Reusable utilities, types, and constants
- Concurrent Development: Run both apps simultaneously with a single command
โ
Production-Ready Structure - Clean separation of concerns
โ
Hot Module Reloading - Fast development experience
โ
Concurrent Execution - Run frontend and backend together
โ
Independent Scaling - Scale apps independently
โ
Shared Code - Reusable utilities across the monorepo
โ
Environment Configuration - Separate config per app
โ
CORS Enabled - Frontend-backend communication ready
BidZo/
โโโ client/ # React + Vite frontend
โ โโโ src/
โ โ โโโ components/ # Reusable React components
โ โ โโโ pages/ # Page components
โ โ โโโ App.jsx # Root component
โ โ โโโ App.css # App styles
โ โ โโโ main.jsx # Entry point
โ โ โโโ index.css # Global styles
โ โโโ public/ # Static assets
โ โโโ index.html # HTML entry point
โ โโโ vite.config.js # Vite configuration
โ โโโ package.json # Client dependencies
โ โโโ .env.example # Environment variables template
โ โโโ .env.local # Local environment variables
โ โโโ .gitignore
โ
โโโ server/ # Express.js backend
โ โโโ index.js # Main server file
โ โโโ package.json # Server dependencies
โ โโโ .env.example # Environment variables template
โ โโโ .env # Environment variables
โ โโโ .gitignore
โ
โโโ shared/ # Shared code (client & server)
โ โโโ types/
โ โ โโโ api.ts # API types
โ โ โโโ README.md
โ โโโ utils/
โ โ โโโ validators.js # Validation utilities
โ โ โโโ README.md
โ โโโ constants/
โ โ โโโ index.js # Shared constants
โ โ โโโ README.md
โ โโโ README.md
โ โโโ .gitignore
โ
โโโ package.json # Root monorepo config
โโโ .gitignore # Git ignore rules
โโโ README.md # This file
| Layer | Technology | Version | Purpose |
|---|---|---|---|
| Frontend | React | 18.2+ | UI library |
| Vite | 5.0+ | Build tool & dev server | |
| Axios | 1.6+ | HTTP client | |
| Backend | Express.js | 4.18+ | Web framework |
| Node.js | 18.0+ | Runtime | |
| CORS | 2.8+ | Cross-origin requests | |
| dotenv | 16.3+ | Environment variables | |
| Dev Tools | concurrently | 8.2+ | Run multiple commands |
| nodemon | 3.0+ | Auto-restart server |
- Node.js >= 18.0.0
- npm >= 9.0.0
- Git (for version control)
-
Clone or navigate to the repository
cd BidZo -
Install all dependencies
npm run install-all
This command installs:
- Root dependencies (
concurrently) - Client dependencies (React, Vite, etc.)
- Server dependencies (Express, dotenv, etc.)
- Root dependencies (
-
Start development servers
npm run dev
-
Access the application
- ๐ Frontend: http://localhost:3000
- ๐ Backend: http://localhost:5000
- ๐ Health Check: http://localhost:5000/health
# Run both client and server concurrently
npm run dev
# Run only the frontend
npm run client
# Run only the backend
npm run server
# Install all dependencies
npm run install-all
# Build for production
npm run build
# Build only frontend
npm run build:client
# Build only backend
npm run build:server# Development server with hot reload
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Lint code
npm run lint# Start server
npm start
# Start with nodemon (auto-restart on changes)
npm run dev
# Run tests
npm testThe React frontend is built with Vite for fast development and optimized production builds.
Config Files:
vite.config.js- Vite configuration with React pluginindex.html- HTML entry point.env.example- Environment variables template.env.local- Local development variables
Source Files:
src/main.jsx- React DOM render entry pointsrc/App.jsx- Root component with health checksrc/App.css- Component stylessrc/index.css- Global stylessrc/components/- Reusable React componentssrc/pages/- Page-level components
Features:
- Server health status indicator
- Sample counter component
- Beautiful gradient UI
- Mobile-responsive design
The Express server provides REST API endpoints and is configured with CORS for frontend communication.
Config Files:
.env- Environment variables (PORT, NODE_ENV, etc.).env.example- Template for environment setuppackage.json- Dependencies and scripts
API Routes:
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Server health check |
| GET | /api/info |
Server information |
| POST | /api/message |
Accept and echo messages |
Features:
- CORS middleware for frontend requests
- JSON request/response handling
- Error handling middleware
- 404 handler
- Logging on server start
Reusable code for both client and server.
Types (/types):
api.ts- API response and model types- TypeScript interfaces for type safety
Utilities (/utils):
validators.js- Input validation functions- Email, URL, and sanitization helpers
Constants (/constants):
index.js- API endpoints, HTTP status codes, error messages
Endpoint: GET /health
Description: Verify server is running
Response:
{
"status": "ok",
"timestamp": "2026-04-08T12:00:00.000Z",
"message": "Server is running successfully"
}Endpoint: GET /api/info
Description: Get server metadata
Response:
{
"app": "BidZo Backend",
"version": "1.0.0",
"environment": "development"
}Endpoint: POST /api/message
Description: Send a message to the server
Request Body:
{
"message": "Hello, Server!"
}Response:
{
"success": true,
"receivedMessage": "Hello, Server!",
"timestamp": "2026-04-08T12:00:00.000Z"
}# API URL for backend communication
VITE_API_URL=http://localhost:5000# Application environment
NODE_ENV=development
# Server port
PORT=5000
# API and client URLs
API_URL=http://localhost:5000
CLIENT_URL=http://localhost:3000How to use:
- Copy
.env.exampleto.env.local(client) or.env(server) - Adjust values as needed
- Server automatically loads from
.envviadotenv - Client uses
VITE_prefix for Vite build access
Problem: Error: listen EADDRINUSE :::5000
Solution:
# Kill process using port 5000
lsof -ti:5000 | xargs kill -9
# Or change port in .env
PORT=5001Problem: Access to XMLHttpRequest blocked by CORS policy
Solution:
- Ensure server is running on port 5000
- Check
.envfiles have correct URLs - Verify CORS middleware in
server/index.js
Problem: Cannot find module 'express'
Solution:
# Reinstall dependencies
npm run install-all
# Or in specific folder
cd server && npm install
cd ../client && npm installProblem: Error: EADDRINUSE: address already in use :::3000
Solution:
# Kill process using port 3000
lsof -ti:3000 | xargs kill -9
# Or edit vite.config.js to use different portProblem: Health check shows "offline"
Solution:
- Verify server is running:
npm run server - Check CORS configuration in
server/index.js - Ensure
VITE_API_URLmatches server URL - Check browser console for specific errors
Client:
cd client
npm install axiosServer:
cd server
npm install next-middlewareAll packages:
npm run install-all- Update
.env.examplefiles with production values - Create
.env.productionfiles - Build frontend:
npm run build:client - Build backend:
npm run build:server - Test production builds locally
- Configure CI/CD pipeline
- Set up environment variables on hosting platform
- Deploy to staging environment first
- Run smoke tests on staging
- Deploy to production
- Database integration (MongoDB/PostgreSQL)
- Authentication system (JWT/OAuth)
- API documentation (Swagger/OpenAPI)
- Unit and integration tests
- Error logging and monitoring
- WebSocket support for real-time features
- Caching layer (Redis)
- Rate limiting
- Input validation and sanitization
- GraphQL API alternative
- Docker containerization
- Kubernetes orchestration
- GitHub Actions CI/CD
- Automated testing in pipeline
- Staging and production environments
- Performance monitoring
- Analytics integration
- SEO optimization
- Code splitting and lazy loading
- Progressive Web App (PWA) features
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Check the Troubleshooting section
- Review error messages in browser console
- Check server logs in terminal
- Create an issue on GitHub
Happy coding! ๐
Last updated: April 8, 2026