A full-stack SaaS admin dashboard built with the MERN stack. ClientSphere gives administrators a central hub to manage clients, track key performance indicators, and control access — all in a clean, responsive interface.
- Features
- Tech Stack
- Getting Started
- Project Structure
- API Reference
- Deployment
- Contributing
- Support
- Author
- Authentication – JWT-based login with 7-day token expiry and bcrypt password hashing
- Role-Based Access Control – Admin and User roles; admin-only routes enforced on both client and server
- Client Management – Create, view, and list clients with attributes: name, email, phone, plan, and status
- Analytics Dashboard – KPI cards (total clients, active clients, monthly revenue) and interactive charts powered by Recharts
- Responsive UI – Collapsible sidebar, adaptive grid layouts, and mobile-friendly components built with Tailwind CSS
- CI/CD Pipeline – Automated builds and deployments to Vercel (frontend) and Render (backend) via GitHub Actions
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite, Tailwind CSS, React Router DOM, Recharts, Axios |
| Backend | Node.js 20, Express 4, MongoDB 8 (Mongoose), JWT, bcryptjs |
| DevOps | GitHub Actions, Vercel (frontend), Render (backend) |
- Node.js v20 or later
- npm v9 or later
- MongoDB – a running local instance or a MongoDB Atlas cluster
-
Clone the repository
git clone https://github.com/anan5093/saas-admin-dashboard.git cd saas-admin-dashboard -
Install server dependencies
cd server npm install -
Install client dependencies
cd ../client npm install
Create a .env file in the server/ directory:
PORT=5000
MONGO_URI=mongodb://127.0.0.1:27017/saas_admin
JWT_SECRET=your_jwt_secret_here| Variable | Description |
|---|---|
PORT |
Port the Express server listens on |
MONGO_URI |
MongoDB connection string |
JWT_SECRET |
Secret key used to sign JWT tokens |
Note: Never commit
.envto version control. A.env.examplefile is recommended for sharing the required variable names.
Open two terminals and start both services simultaneously:
Terminal 1 – Backend
cd server
npm run dev
# Server running on http://localhost:5000Terminal 2 – Frontend
cd client
npm run dev
# App running on http://localhost:5173Open http://localhost:5173 in your browser. Register an account (available in development) or log in if you already have credentials.
Other useful commands:
# Lint the frontend code
cd client && npm run lint
# Build the frontend for production
cd client && npm run build
# Preview the production build locally
cd client && npm run preview
# Start the server in production mode
cd server && npm startsaas-admin-dashboard/
├── .github/
│ └── workflows/
│ └── main.yml # CI/CD: build & deploy on push to main
├── client/ # React frontend (Vite)
│ └── src/
│ ├── components/ # Reusable UI and layout components
│ │ ├── dashboard/ # Charts, RecentActivity
│ │ ├── layout/ # Layout, Navbar, Sidebar, Footer
│ │ └── ui/ # Button, Input, Badge, KpiCard
│ ├── context/ # AuthContext, LayoutContext (Context API)
│ ├── data/ # Static seed data for KPIs and clients
│ ├── pages/ # Route-level page components
│ │ ├── auth/ # Login, Register
│ │ ├── clients/ # Clients list, AddClient, ClientDetails
│ │ ├── dashboard/ # Main Dashboard
│ │ └── settings/ # Profile
│ ├── routes/ # AppRoutes, ProtectedRoute
│ └── services/ # Axios wrappers for API calls
└── server/ # Express backend
└── src/
├── config/ # MongoDB connection (db.js)
├── controllers/ # authController, clientController
├── middleware/ # JWT protect(), adminOnly()
├── models/ # User, Client Mongoose schemas
└── routes/ # authRoutes, clientRoutes
All client endpoints require a valid JWT token in the Authorization: Bearer <token> header and the caller must have the admin role.
| Method | Endpoint | Auth Required | Description |
|---|---|---|---|
| POST | /api/auth/register |
No | Register a new user (dev only) |
| POST | /api/auth/login |
No | Log in, returns JWT + user object |
| GET | /api/clients |
Admin | List all clients |
| POST | /api/clients |
Admin | Create a new client |
| GET | /api/clients/:id |
Admin | Get a single client by ID |
Login request example:
curl -X POST http://localhost:5000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "yourpassword"}'Authenticated request example:
curl http://localhost:5000/api/clients \
-H "Authorization: Bearer <your_token>"The project deploys automatically on every push to main via GitHub Actions (see .github/workflows/main.yml).
| Service | Target | Trigger |
|---|---|---|
| Frontend | Vercel | Push to main |
| Backend | Render | Push to main (deploy hook) |
Required GitHub Secrets:
| Secret | Description |
|---|---|
VERCEL_TOKEN |
Vercel API token |
VERCEL_ORG_ID |
Vercel organization ID |
VERCEL_PROJECT_ID |
Vercel project ID |
RENDER_DEPLOY_HOOK |
Render deploy hook URL |
Contributions are welcome! Please open an issue to discuss your idea before submitting a pull request.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m "feat: add your feature" - Push to your fork:
git push origin feature/your-feature - Open a pull request against
main
If you run into any issues or have questions:
- Open an issue on the GitHub Issues page
- Check existing issues before opening a new one
Anand Raj