This application is an employee management system built using the NestJS framework. It provides functionality to manage employees, track attendance, send email notifications upon attendance records, and generate reports. The app is deployed on Render, and the deployment pipeline includes two jobs: testing and deployment. A link to the deployed project can be found in the project description.
-
Full Authentication System:
- Register, Login, Logout, Forgot password, Password reset functionalities using
PassportJS
.
- Register, Login, Logout, Forgot password, Password reset functionalities using
-
Employee Management (CRUD):
- Manage employee records with fields like
name
,email
,employeeIdentifier
, andphoneNumber
.
- Manage employee records with fields like
-
Attendance Tracking:
- Record employee check-ins and check-outs.
-
Email Notification System:
- Automatically send email notifications to employees when attendance is recorded using background processing queues.
-
Attendance Reports:
- Generate PDF reports using
jsPDF
and Excel reports usingExcelJS
with daily attendance data.
- Generate PDF reports using
-
API Documentation:
- Interactive and detailed API documentation is available through Swagger, using OpenAPI standards.
The application is deployed on Render, with a continuous integration (CI) pipeline that runs the following jobs:
- Test: Executes the test suite to ensure all functionalities work as expected.
- Deploy: Deploys the application to Render if all tests pass successfully.
You can find the deployment link in the project description.
- NestJS v10: Core framework for the API.
- PassportJS: For authentication.
- TypeORM: Database management and migrations using Prisma ORM.
- Jest: Testing framework.
- jsPDF: For generating PDF reports.
- ExcelJS: For generating Excel reports.
- Bull Queues: For background job processing.
- OpenAPI (Swagger): For API documentation.
- Render: For application hosting and deployment.
- Gemini AI (Google): Used for generating personalized email content due to ChatGPT being closed-source.
Emails are automatically sent to employees upon check-in. These emails are generated using Gemini AI by Google, which personalizes the content of the notification messages.
The application includes a well-detailed and interactive API documentation using Swagger, accessible at /api-doc
(e.g., https://em-backend-ab.onrender.com/api-doc
). It covers all available endpoints, request/response formats, and necessary authentication details.
- GitHub Actions: The CI pipeline is configured with GitHub Actions to run tests automatically on pull requests (PRs).
- Node.js v18.x.x or higher
- npm v9.x.x or higher
- PostgreSQL or any other supported database
- Redis for background job processing (email notifications)
-
Clone the repository:
git clone https://github.com/Ernor1/em_backend_ab.git cd em_backend_ab
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and include the following variables:DATABASE_URL=your-database-url JWT_SECRET=your-jwt-secret MAIL_HOST=smtp.mailtrap.io MAIL_PORT=your-mail-port MAIL_USER=your-mail-username MAIL_PASS=your-mail-password GEMINI_API_KEY=your-gemini-api-key
-
Run database migrations:
npm run migration:run
-
Start the application:
npm run start:dev
-
Access the API Documentation: Visit
http://localhost:8000/api-doc
to view the interactive Swagger documentation.
-
Run the tests with the following command:
npm run test
-
Check test coverage:
npm run test:cov
-
PDF Reports:
- Generate daily attendance data reports in PDF format using
jsPDF
.
- Generate daily attendance data reports in PDF format using
-
Excel Reports:
- Generate Excel reports of attendance data using
ExcelJS
.
- Generate Excel reports of attendance data using
The application sends an email to employees upon check-in. The content is generated using Gemini AI by Google for personalized messages, instead of OpenAI's ChatGPT.
To deploy this project to Render or any other cloud provider, follow these steps:
- Configure the environment variables based on the platform's guidelines.
- Ensure Redis is available either as a managed service or locally.
- Set up PostgreSQL or another supported database for the application.
The project uses GitHub Actions for continuous integration. The workflow file located in .github/workflows/main.yml
is configured to automatically run tests when a pull request (PR) is created.
This Employee Management application is a complete solution for managing employees and attendance tracking. It integrates modern web development practices such as authentication, background processing, email notifications, and detailed API documentation.
For any further questions or issues, feel free to reach out.