A queues management system built using NestJS for the backend, React with TypeScript for the frontend, Redis for scheduling, and MongoDB for data storage. This app supports managing clients, appointments, places (employees), and their schedules.
- Client Management: Add, update, and view clients.
- Appointments: Schedule, manage, and track appointments.
- Places (Employees): Assign and manage employees for specific tasks or appointments.
- Queue Scheduling: Efficient queue scheduling and management powered by Redis.
- Date Handling: Time manipulation using
dayjs. - API Integration: Simplified and consistent API calls with
axios. - Scalable Architecture: Modular and scalable design using NestJS and React.
- Authentication and Authorization:
- Role-based access control for different user roles.
- Guards to protect routes and ensure secure access.
- Throttling: Rate limiting to prevent abuse and ensure application stability.
Here are some demonstrations of the application in action:
- NestJS: Modular and scalable framework for building server-side applications.
- Redis: Used for scheduling and queue management.
- MongoDB: Database for storing app data (clients, appointments, places).
- Bull: Queue management library for Redis.
- React: UI library for building the user interface.
- TypeScript: For static type checking and improved developer experience.
- React Query: Efficient state and server data management.
- Day.js: Lightweight library for parsing, validating, manipulating, and formatting dates.
- Axios: Promise-based HTTP client for API requests.
- Ant Design (Antd): UI framework with ready-to-use components for building responsive interfaces.
Ensure you have the following installed or done:
- Node.js (>=14.x)
- Redis
- MongoDB account and connection
- Google App password for Nodemailer
To set up and connect to a MongoDB database, refer to the official MongoDB installation and connection guide: MongoDB Installation Guide, NestJS documentation.
Update the MONGO_URI in your .env file with your MongoDB connection string. For example:
MONGO_URI=mongodb://localhost:27017/queues-managementTo install and configure Redis, refer to the official Redis documentation: Redis Quick Start Guide.
If you're using Redis on WSL, ensure it is properly installed and configured. You can start Redis using the following command:
wsl -d Ubuntu redis-server --daemonize yesTo use Nodemailer with your Gmail account, you need to create a Google App Password. Follow these steps:
-
Enable 2-Step Verification:
- Log in to your Google account.
- Go to Google Account Security.
- Under "Signing in to Google," enable 2-Step Verification.
-
Generate an App Password:
- After enabling 2-Step Verification, return to the Google Account Security page.
- Under "Signing in to Google," select "App Passwords."
- Choose "Mail" as the app and "Other" as the device (enter a custom name if you prefer).
- Google will generate a 16-character app password.
-
Use the App Password in Nodemailer:
- Replace
MAIL_PASSWORDin your.envfile with the generated app password:MAIL_PASSWORD=yourGeneratedAppPassword
- Replace
For more details, refer to the official Google documentation: Sign in using app passwords.
-
Clone the repository:
git clone https://github.com/your-repo/queues-management-app.git cd queues-management-app -
Since the client and server are separate projects, install dependencies for each part of the application. Run the following commands:
-
Install dependencies in the main folder:
npm install
-
Navigate to the server folder and install dependencies:
cd server npm install -
Navigate to the client folder and install dependencies:
cd ../client npm install
-
-
Configure environment variables:
- Create a
.envfile in theserverfolder with the following template:JWT_ACCESS_SECRET=yourAccessSecretKeyHere JWT_REFRESH_SECRET=yourRefreshSecretKeyHere MONGO_URI=yourMongoDBConnectionString MAIL_FROM=nodeMailerMailFromWho HOST_URL=yourAppBaseURL MAIL_USER=mailForNodeMailer MAIL_PASSWORD=servicePasswordForNodeMailer
- Create a
-
Start the application using the main folder's script (leveraging
concurrently):npm start
This command will:
- Start the Redis server (using WSL if on Windows).
- Start the backend (NestJS server).
- Start the frontend (React app).
Here’s how the scripts section of your package.json could look, keeping in mind that Redis runs on Ubuntu WSL and can be customized:
"scripts": { "start": "concurrently \"npm run start:redis\" \"npm run start:client\" \"npm run start:server\"", "start:redis": "wsl -d Ubuntu redis-server --daemonize yes || echo 'Ensure Redis is installed and properly configured on WSL'", "start:client": "npm run start --prefix client", "start:server": "npm run start:dev --prefix server" },
-
Open the application in your browser:
http://localhost:1234
auth/: Authentication and authorization logic (JWT, roles, guards).constants/: Application-wide constants.database/: Database connection and related utilities.dayjs/: Utilities for date and time manipulation.decorators/: Custom decorators used across the application.dto/: Data transfer objects for validation and transformation.enums/: Enumerations used in the application (mainly roles).mail/: Email-related logic and utilities.pipes/: Custom pipes for request data validation and transformation.processors/: Background job processors.queues/: Queue management and scheduling logic using Bull.roles/: Role-based access control logic.schedule/: Schedule-related utilities and services.schemas/: MongoDB schemas.timetables/: Logic for managing timetables and schedules.types/: Type definitions.users/: User management logic.utils/: General utility functions.app.controller.ts: Main application controller.app.service.ts: Main application service.main.ts: Entry point of the application.
api/: API integration logic.components/: UI components (using Antd).context/: Context providers for global state management.interfaces/: TypeScript interfaces for props and API responses.pages/: Application pages (e.g., queues, login).router/: Routing logic and route definitions.styles/: Global and component-specific styles.App.tsx: Main application component.index.tsx: Entry point of the React application.