This repository contains the completion of the Backend Developer (Intern) assignment. It implements a robust Express.js REST API with a dynamic React frontend.
- Backend Architecture: Scalable MVC Express app with MongoDB.
- Advanced Querying: Server-side filtering, multi-field sorting, and pagination.
- Analytics Engine: Real-time task metrics using MongoDB Aggregation pipelines.
- High Performance: In-memory API response caching (node-cache) for zero-latency data fetching.
- Authentication: JWT and
bcryptsecurity with Role-Based Access (Admin/User). - Validation & Errors: Request validation with
express-validatorand centralized API error handling. - Premium Frontend: "Neon Dark Mode Trading Terminal" with Liquid Glassmorphism and animated backgrounds.
- Mobile Responsive: Fully optimized UI for tablet and mobile viewports.
- Theme Engine: Persistent Light/Dark mode switching.
- Security: Implementation of
helmet,cors, and password visibility toggles.
If you are starting from zero and do not have anything installed, follow these steps in order.
You need these tools on your computer:
- Git: https://git-scm.com/downloads
- Node.js (version 16 or later): https://nodejs.org/
- MongoDB Community Server: https://www.mongodb.com/try/download/community
Optional:
- Docker Desktop if you want to run MongoDB with Docker instead of installing MongoDB directly: https://www.docker.com/products/docker-desktop/
- VS Code for editing and running the project: https://code.visualstudio.com/
Open Command Prompt, PowerShell, or the VS Code terminal and run:
git --version
node -v
npm -vIf these commands show version numbers, the tools are installed correctly.
git clone https://github.com/adarshkshitij/Assignment.git
cd AssignmentCreate a file named backend/.env and add:
PORT=5000
MONGO_URI=mongodb://localhost:27017/primetrade_tasks
JWT_SECRET=your_jwt_secret_here
ADMIN_SECRET_CODE=your_admin_code_hereYou can replace:
your_jwt_secret_herewith any long random secret stringyour_admin_code_herewith any secret code you want to use for admin signup
Choose one of these options:
Make sure the MongoDB service is running on your machine.
From the project root, run:
docker-compose up -dOpen a terminal in the project folder and run:
cd backend
npm install
npm run devThe backend runs on:
http://localhost:5000
Swagger API docs are available at:
http://localhost:5000/api-docs
Postman collection is available at:
backend/Primetrade-API.postman_collection.json
Open a second terminal and run:
cd frontend
npm install
npm run devThe frontend runs on:
http://localhost:5173
Open this URL in your browser:
http://localhost:5173
If your system is already ready, use these commands:
cd backend
npm install
npm run devcd frontend
npm install
npm run devTo create an admin account:
- Select
Adminin the signup form - Enter the same value used in
ADMIN_SECRET_CODE
If the code does not match, admin registration will be rejected.
- Regular
useraccounts can only access and manage their own tasks adminaccounts can view all tasks and use admin-only endpoints like:GET /api/v1/auth/admin-checkGET /api/v1/tasks/stats
- The frontend connects to the backend at
http://localhost:5000/api/v1 - The default frontend development URL is
http://localhost:5173 - If local MongoDB is not available, the backend may fall back to an in-memory MongoDB instance depending on your environment
- Backend project hosted in GitHub with README setup
- Working APIs for Auth and CRUD
- Basic frontend UI that connects to APIs
- API documentation (Swagger generated dynamically)
- Postman collection for API testing
- Request validation and centralized error handling
- Short scalability note (
SCALABILITY.md)