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 devExpected 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 devExpected 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_passwordCreate 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_idpnpm install # Install dependencies
pnpm run dev # Start development server with auto-reload
pnpm start # Start production serverpnpm 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 ESLinthttp://localhost:3000/api
GET /api/healthResponse:
{
"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=10Query 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/jsonRequest 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_URIin.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_URLin.envmatches frontend - ✅ Default:
CLIENT_URL=http://localhost:5173 - ✅ Restart server after changes
🔴 pnpm Command Not Found
Solution:
npm install -g pnpm
pnpm --versionContributions 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
.envfiles - ✅ 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 devMade with ❤️ by MRaysa
Happy Coding! 🚀