A complete, production-ready multi-tenant ScaleNest built with the MERN stack (MongoDB, Express, React, Node.js) featuring authentication, workspace management, and a modern dashboard.
- JWT-based authentication
- Secure password hashing with bcrypt
- Protected routes and API endpoints
- Multi-tenant data isolation
- Create and manage multiple workspaces
- Invite team members via invite codes
- Role-based access control (Admin, Member, Viewer)
- Seamless workspace switching
- Create and organize projects
- Kanban-style task management
- Priority levels and status tracking
- Team collaboration features
- Interactive charts and visualizations
- Team performance metrics
- Progress tracking
- Activity monitoring
- Beautiful landing page with pricing tiers
- Responsive design (mobile, tablet, desktop)
- Smooth animations with Framer Motion
- Tailwind CSS styling
- Collapsible sidebar navigation
- React 18.2 - UI library
- Vite - Build tool
- React Router DOM - Routing
- Tailwind CSS - Styling
- Framer Motion - Animations
- Recharts - Data visualization
- Axios - HTTP client
- Context API - State management
- Node.js - Runtime environment
- Express - Web framework
- MongoDB - Database
- Mongoose - ODM
- JWT - Authentication
- bcryptjs - Password hashing
- CORS - Cross-origin resource sharing
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher)
- MongoDB (v5 or higher)
- npm or yarn
git clone <repository-url>
cd saas-platformcd backend
# Install dependencies
npm install
# Create .env file
cp .env.example .env
# Edit .env with your configuration
# Required variables:
# - MONGODB_URI: Your MongoDB *** string
# - JWT_SECRET: A strong random secret key
# - PORT: Backend server port (default: 5000)Example .env configuration:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/saas-platform
JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
JWT_EXPIRE=7d
NODE_ENV=developmentcd ../frontend
# Install dependencies
npm installMake sure MongoDB is running on your system:
# For macOS (with Homebrew)
brew services start mongodb-community
# For Linux
sudo systemctl start mongod
# For Windows
# MongoDB should start automatically, or use MongoDB CompassTerminal 1 - Backend:
cd backend
npm run devBackend will run on http://localhost:5000
Terminal 2 - Frontend:
cd frontend
npm run devFrontend will run on http://localhost:3000
Backend:
cd backend
npm startFrontend:
cd frontend
npm run build
npm run previewsaas-platform/
βββ backend/
β βββ config/
β β βββ database.js # MongoDB ***
β βββ controllers/
β β βββ authController.js # Authentication logic
β β βββ workspaceController.js
β β βββ projectController.js
β β βββ taskController.js
β βββ middleware/
β β βββ auth.js # JWT verification
β β βββ tenant.js # Multi-tenant isolation
β βββ models/
β β βββ User.js
β β βββ Workspace.js
β β βββ Membership.js
β β βββ Project.js
β β βββ Task.js
β βββ routes/
β β βββ authRoutes.js
β β βββ workspaceRoutes.js
β β βββ projectRoutes.js
β β βββ taskRoutes.js
β βββ utils/
β β βββ generateToken.js
β βββ .env.example
β βββ package.json
β βββ server.js
β
βββ frontend/
β βββ public/
β βββ src/
β β βββ components/
β β β βββ DashboardLayout.jsx
β β β βββ Navbar.jsx
β β β βββ Sidebar.jsx
β β β βββ ProtectedRoute.jsx
β β βββ context/
β β β βββ AuthContext.jsx
β β β βββ WorkspaceContext.jsx
β β βββ pages/
β β β βββ Dashboard/
β β β β βββ Overview.jsx
β β β β βββ Projects.jsx
β β β β βββ Tasks.jsx
β β β β βββ Team.jsx
β β β β βββ Analytics.jsx
β β β β βββ Settings.jsx
β β β β βββ Billing.jsx
β β β βββ Landing.jsx
β β β βββ Login.jsx
β β β βββ Register.jsx
β β β βββ WorkspaceSetup.jsx
β β βββ App.jsx
β β βββ main.jsx
β β βββ index.css
β βββ index.html
β βββ package.json
β βββ tailwind.config.js
β βββ postcss.config.js
β βββ vite.config.js
β
βββ README.md
The lists below include all backend GET and POST routes grouped by area.
GET /- Health check / welcome message
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/me- Get current user
POST /api/workspaces- Create workspacePOST /api/workspaces/switch- Switch active workspacePOST /api/workspaces/join- Join workspace with invite codeGET /api/workspaces/my- Get user's workspacesGET /api/workspaces/:id- Get workspace detailsGET /api/workspaces/:id/members- Get workspace members
POST /api/projects- Create projectGET /api/projects- Get all projectsGET /api/projects/my- Get projects for current userGET /api/projects/:id- Get project details
POST /api/tasks- Create taskGET /api/tasks- Get all tasks (with filters)GET /api/tasks/project/:projectId- Get tasks for a projectGET /api/tasks/:id- Get task details
GET /api/analytics- Get analytics summary
GET /api/notifications- Fetch notificationsGET /api/notifications/export- Export notificationsPOST /api/notifications/:id/accept-invite- Accept invite from notificationPOST /api/notifications/:id/reject-invite- Reject invite from notification
GET /api/alerts/tasks- Fetch task deadline alertsPOST /api/alerts/check-deadlines- Trigger deadline check
GET /api/admin/audit-logs- Get audit logsGET /api/admin/audit-logs/stats- Get audit log statsGET /api/admin/audit-logs/export- Export audit logsGET /api/admin/audit-logs/:id- Get audit log by id
POST /api/tenant/logo- Upload workspace logoPOST /api/tenant/create- Create workspace with brandingGET /api/tenant/settings- Get tenant settings
GET /api/invite/info/:token- Get invite info (public)POST /api/invite/accept/:token- Accept invitePOST /api/invite/reject/:token- Reject invitePOST /api/projects/:id/invite- Send project inviteGET /api/projects/:id/invitations- Get project invitationsPOST /api/projects/:id/invite/:inviteId/resend- Resend project inviteGET /api/projects/:id/members- Get project members
POST /api/chats/direct- Create direct chatPOST /api/chats/group- Create group chatPOST /api/chats/group/project- Create project group chatGET /api/chats- Get workspace chats
POST /api/messages- Send messagePOST /api/messages/:id/react- Add reaction to messagePOST /api/messages/upload- Upload message attachmentsGET /api/messages/:chatId- Get messages for a chat
GET /api/billing/info- Get billing infoPOST /api/billing/upgrade- Upgrade planGET /api/billing/usage- Get usage statsGET /api/billing/invoices- Get invoicesGET /api/billing/invoices/:invoiceId/download- Download invoice
- Landing Page β User sees features, pricing, and testimonials
- Registration/Login β User creates account or logs in
- Workspace Setup β User creates or joins a workspace
- Dashboard β User accesses their workspace dashboard
- Project Management β Create and manage projects
- Task Management β Organize tasks across projects
- Team Collaboration β Invite members and assign work
- Analytics β Track progress and performance
The platform implements true multi-tenancy with:
- Data Isolation: Each workspace's data is completely separated
- Workspace Context: All API requests include workspace ID
- Membership Roles: Fine-grained access control
- Invite System: Secure workspace joining via invite codes
POST /api/workspaces
{
"name": "My Company"
}POST /api/tasks
Headers: { "x-workspace-id": "workspace_id" }
{
"title": "Implement authentication",
"description": "Add JWT authentication",
"priority": "high",
"status": "todo"
}Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a 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
PORT=5000
MONGODB_URI=mongodb://localhost:27017/saas-platform
JWT_SECRET=your_secret_key_here
JWT_EXPIRE=7d
NODE_ENV=development- Ensure MongoDB is running
- Check MONGODB_URI in .env
- Verify MongoDB is accessible on the specified port
- Backend CORS is configured to allow all origins in development
- For production, update CORS settings in server.js
- Change PORT in backend .env
- Change port in frontend vite.config.js
This project is licensed under the MIT License.
- React community for amazing tools
- MongoDB for flexible database
- Tailwind CSS for beautiful styling
- Framer Motion for smooth animations
For support, please open an issue in the repository or contact the development team.
Built with β€οΈ using the MERN stack