A production-ready starter template with React + Vite + Tailwind CSS frontend and Express.js + MongoDB backend using MVC architecture
Location: D:\All website project\Full-Stack_Project_Setup_Guide
Features β’ Quick Start β’ Documentation β’ API β’ Contributing
This is a modern full-stack web application template, built with cutting-edge technologies. It provides a clean, maintainable architecture for building scalable web applications with best practices baked in.
Perfect for developers who want to quickly start a new project without the hassle of initial setup.
- βοΈ React 19 - Latest React with improved performance
- β‘ Vite - Lightning-fast build tool and dev server
- π¨ Tailwind CSS 4 - Utility-first CSS framework
- πΌ DaisyUI - Beautiful component library
- π Framer Motion - Smooth animations
- π― React Icons - Comprehensive icon library
- π« SweetAlert2 - Beautiful, responsive alerts
- π₯ Firebase - Authentication and backend services
- π JWT Ready - Token-based authentication (planned)
- π± React Router 7 - Client-side routing
- π Smooth Transitions - Page transition animations
- π’ Node.js - JavaScript runtime
- β‘ Express.js 5 - Minimal web framework
- π MongoDB - NoSQL database
- ποΈ MVC Pattern - Clean, organized code structure
- π Nodemon - Auto-restart development server
- π CORS - Cross-Origin Resource Sharing enabled
- π Request Logging - Built-in request logger
β οΈ Error Handling - Global error handler
- π¦ pnpm - Fast, disk space efficient package manager
Before you begin, ensure you have the following installed:
Software | Version | Download |
---|---|---|
Node.js | v18+ | Download |
pnpm | v9+ | npm install -g pnpm |
MongoDB | v6+ | Download |
Git | Latest | Download |
git clone https://github.com/MRaysa/Full-Stack_Project_Setup_Guide.git
cd Full-Stack_Project_Setup_Guide
# Navigate to server directory
cd server-site
# Install dependencies
pnpm install
# Create environment file
cp .env.example .env
# Configure your .env file (see Backend Configuration below)
# Start development server
pnpm run dev
Expected Output:
π Server Started Successfully!
β‘ Server is running on http://localhost:3000
π MongoDB Connected Successfully
# Open a NEW terminal
cd client-cite
# Install dependencies
pnpm install
# Start development server
pnpm run dev
Expected Output:
VITE v6.3.5 ready in XXX ms
β Local: http://localhost:5173/
β Network: use --host to expose
Service | URL |
---|---|
Frontend | http://localhost:5173 |
Backend API | http://localhost:3000 |
Health Check | http://localhost:3000/api/health |
Full-Stack_Project_Setup_Guide/
β
βββ π client-cite/ # Frontend Application
β βββ π public/ # Static assets
β βββ π src/
β β βββ π components/ # Reusable React components
β β βββ π pages/ # Page components
β β βββ π App.jsx # Main App component
β β βββ π main.jsx # Entry point
β βββ π .gitignore
β βββ π package.json
β βββ π vite.config.js # Vite configuration
β βββ π tailwind.config.js # Tailwind configuration
β
βββ π server-site/ # Backend Application (MVC)
β βββ π config/
β β βββ π database.js # MongoDB connection
β βββ π controllers/
β β βββ π userController.js # Business logic
β βββ π models/
β β βββ π User.js # Database models
β βββ π routes/
β β βββ π index.js # Main router
β β βββ π userRoutes.js # User routes
β βββ π middleware/
β β βββ π errorHandler.js # Error handling
β β βββ π notFound.js # 404 handler
β β βββ π logger.js # Request logger
β βββ π .env.example # Environment template
β βββ π .gitignore
β βββ π server.js # Entry point
β βββ π package.json
β βββ π README.md # Backend docs
β
βββ π README.md # This file
Create a .env
file in server-site/
directory:
# Server Configuration
PORT=3000
NODE_ENV=development
# Database Configuration
MONGODB_URI=mongodb://localhost:27017
DB_NAME=your_database_name
# JWT Configuration
JWT_SECRET=your_super_secret_jwt_key_change_this
JWT_EXPIRE=7d
# CORS Configuration
CLIENT_URL=http://localhost:5173
# Email Configuration (Optional)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
Create a .env
file in client-cite/
directory:
# API Configuration
VITE_API_URL=http://localhost:3000/api
# Firebase Configuration
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_auth_domain
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_storage_bucket
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
pnpm install # Install dependencies
pnpm run dev # Start development server with auto-reload
pnpm start # Start production server
pnpm install # Install dependencies
pnpm run dev # Start development server
pnpm run build # Build for production
pnpm run preview # Preview production build
pnpm run lint # Run ESLint
http://localhost:3000/api
GET /api/health
Response:
{
"success": true,
"message": "API is running",
"timestamp": "2025-01-11T10:30:00.000Z"
}
Method | Endpoint | Description |
---|---|---|
/api/users |
Get all users (paginated) | |
/api/users/:id |
Get user by ID | |
/api/users |
Create new user | |
/api/users/:id |
Update user | |
/api/users/:id |
Delete user |
GET /api/users?page=1&limit=10
Query Parameters:
page
- Page number (default: 1)limit
- Items per page (default: 10)
Response:
{
"success": true,
"count": 10,
"total": 100,
"page": 1,
"pages": 10,
"data": [
{
"_id": "507f1f77bcf86cd799439011",
"name": "John Doe",
"email": "john@example.com",
"phone": "+1234567890",
"role": "user",
"createdAt": "2025-01-11T10:00:00.000Z"
}
]
}
POST /api/users
Content-Type: application/json
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"password": "securePassword123",
"phone": "+1234567890",
"role": "user"
}
Response:
{
"success": true,
"message": "User created successfully",
"data": {
"_id": "507f1f77bcf86cd799439011",
"name": "John Doe",
"email": "john@example.com",
"phone": "+1234567890",
"role": "user"
}
}
{
"success": true,
"message": "Operation successful",
"data": { }
}
{
"success": false,
"message": "Error message",
"error": "Detailed error (development only)"
}
{
"success": true,
"count": 10,
"total": 100,
"page": 1,
"pages": 10,
"data": []
}
Code | Status | Description |
---|---|---|
Success | Request succeeded | |
Created | Resource created | |
Bad Request | Invalid request | |
Not Found | Resource not found | |
Server Error | Internal error |
π΄ Port Already in Use
Error: Port 3000 is already in use
Solution:
# Windows
netstat -ano | findstr :3000
taskkill /PID <PID> /F
# Mac/Linux
lsof -i :3000
kill -9 <PID>
# Or change PORT in .env
PORT=3001
π΄ MongoDB Connection Error
Error: MongoNetworkError: failed to connect to server
Solutions:
- β Ensure MongoDB is running
- β
Verify
MONGODB_URI
in.env
- β Check firewall settings
- β For Atlas: Check IP whitelist
π΄ Module Not Found
Error: Cannot find module 'express'
Solution:
rm -rf node_modules pnpm-lock.yaml
pnpm install
π΄ CORS Errors
Error: Access blocked by CORS policy
Solution:
- β
Ensure
CLIENT_URL
in.env
matches frontend - β
Default:
CLIENT_URL=http://localhost:5173
- β Restart server after changes
π΄ pnpm Command Not Found
Solution:
npm install -g pnpm
pnpm --version
Contributions are welcome! Here's how you can help:
- Fork the repository
- Clone your fork
git clone https://github.com/YOUR_USERNAME/Full-Stack_Project_Setup_Guide.git
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m "Add: amazing feature"
- Push to your fork
git push origin feature/amazing-feature
- Open a Pull Request
- β Follow existing code structure
- β Use MVC pattern for backend
- β Write meaningful commit messages
- β Test before submitting
- β Update documentation
- β Keep PRs focused
- Express.js - Web framework
- MongoDB - Database
- React - UI library
- Vite - Build tool
- Tailwind CSS - CSS framework
- DaisyUI - Components
- pnpm - Package manager
- β
Never commit
.env
files - β Use strong JWT secrets in production
- β Validate all user inputs
- β Use HTTPS in production
- β Keep dependencies updated
- β Use environment variables for secrets
ISC License - Feel free to use this template for your projects!
If you found this project helpful:
Need help?
- π Check the Troubleshooting section
- π Search GitHub Issues
- π¬ Create a new issue
# Clone and setup
git clone https://github.com/MRaysa/Full-Stack_Project_Setup_Guide.git
cd Full-Stack_Project_Setup_Guide
# Backend
cd server-site && pnpm install && cp .env.example .env && pnpm run dev
# Frontend (new terminal)
cd client-cite && pnpm install && pnpm run dev
Made with β€οΈ by MRaysa
Happy Coding! π