A full-stack application built with MongoDB, Express.js, React, and Node.js for managing agents and distributing tasks through CSV uploads.
- User Authentication: JWT-based authentication with bcrypt password hashing
- Agent Management: CRUD operations for agent management
- CSV Processing: Upload and parse CSV/XLSX files with validation
- Smart Distribution: Automatic distribution of items among agents
- File Validation: Support for CSV, XLS, and XLSX formats
- Database Integration: MongoDB with Mongoose ODM
- Modern UI: Responsive design with Tailwind CSS
- TypeScript: Full type safety throughout the application
- Authentication: Secure login with protected routes
- Agent Management: Create, view, and manage agents
- CSV Upload: Drag-and-drop file upload with validation
- Distribution Overview: View distributed items per agent
- Real-time Updates: Dynamic data updates and notifications
CSTechAgents/
โโโ Backend/ # Node.js/Express backend
โ โโโ Controllers/ # Route controllers
โ โโโ Database/ # Database connection
โ โโโ Helper/ # Utility functions
โ โโโ Middleware/ # Custom middleware
โ โโโ Model/ # Mongoose models
โ โโโ Routes/ # API routes
โ โโโ uploads/ # File upload directory
โโโ Frontend/ # React TypeScript frontend
โ โโโ src/
โ โ โโโ components/ # React components
โ โ โโโ contexts/ # React contexts
โ โ โโโ services/ # API services
โ โ โโโ types/ # TypeScript types
โ โโโ public/ # Static assets
โโโ README.md # This file
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM for MongoDB
- JWT - Authentication
- bcrypt - Password hashing
- Multer - File upload handling
- CSV-Parse - CSV file parsing
- XLSX - Excel file processing
- React 19 - UI library
- TypeScript - Type safety
- React Router - Navigation
- Axios - HTTP client
- React Hook Form - Form management
- React Hot Toast - Notifications
- Lucide React - Icons
- Tailwind CSS - Styling
- Node.js (v16 or higher)
- MongoDB
- npm or yarn
-
Navigate to the backend directory:
cd Backend -
Install dependencies:
npm install
-
Create a
.envfile in the Backend directory:PORT=8001 MONGODB_URI=mongodb://localhost:27017/cstechagents JWT_Secret=your_jwt_secret_key JWT_Timeout=1h
-
Start the backend server:
npm start
The backend will run on http://localhost:8001
-
Navigate to the frontend directory:
cd Frontend -
Install dependencies:
npm install
-
Start the development server:
npm run dev
The frontend will run on http://localhost:5173
POST /api/user/register- Register new userPOST /api/user/login- User loginPOST /api/user/logout- User logoutGET /api/user/profile- Get user profile
POST /api/agent/new- Create new agentGET /api/agent/list- Get all agentsGET /api/agent/:id- Get agent items
POST /api/upload/upload-csv- Upload CSV file
- Access the application at
http://localhost:5173 - Login with admin credentials
- Secure JWT-based authentication
- Create new agents with name, email, mobile, and password
- View all agents in a responsive grid layout
- Click on agents to view details
- Upload CSV, XLS, or XLSX files
- Files must contain columns: FirstName, Phone, Notes
- Items are automatically distributed among all agents
- View distribution summary after upload
- View items assigned to each agent
- Expandable cards showing detailed item information
- Real-time statistics and summaries
{
username: String,
name: String,
email: String (unique),
password: String (hashed),
role: String (admin/agent)
}{
name: String,
email: String (unique),
mobile: String,
password: String
}{
firstName: String,
phone: String,
notes: String,
assignedTo: ObjectId (ref: Agents)
}- JWT token-based authentication
- Password hashing with bcrypt
- CORS configuration
- File upload validation
- Input sanitization
- Protected routes
- Responsive design for all screen sizes
- Modern, clean interface
- Drag-and-drop file upload
- Real-time notifications
- Loading states and animations
- Form validation with error messages
- Accessible design patterns
cd Backend
npm testcd Frontend
npm test- Set up MongoDB Atlas or local MongoDB
- Configure environment variables
- Deploy to Heroku, Railway, or similar platform
- Build the production version:
npm run build
- Deploy to Vercel, Netlify, or similar platform
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the existing issues on GitHub
- Create a new issue with detailed information
- Contact the development team
- React team for the amazing framework
- MongoDB team for the database solution
- Express.js team for the web framework
- All contributors and testers
Happy Coding! ๐