The Plexxis Employees Backend is a robust and efficient back-end service for the Plexxis Employees Front application. It's built using NestJS with TypeScript and provides CRUD operations for managing employee information through a REST API. The application uses PostgreSQL as the database and Prisma as the ORM.
- CRUD operations for employee data
- ValidatePipe for DTO format validation in a whitelist mode
- Cursor-based pagination for efficient data handling
- PostgreSQL for data storage
- Prisma ORM for database operations
- Search functionality for employee data
- NestJS with TypeScript
- PostgreSQL
- Prisma ORM
- ValidatePipe
-
Clone the repository to your local machine.
git clone https://github.com/stevenlyd/plex-employees-back.git
-
Install the required dependencies.
npm install
-
Create a new
.env
file in the root folder and add the necessary database configuration variables.DATABASE_URL="postgresql://<user>:<password>@<host>:<port>/<database>"
-
Run the database migrations.
npx prisma migrate dev --name init
-
Run the application.
npm run start
The backend API will run on http://localhost:3001
.
-
The backend service receives requests from the front-end application and performs the necessary CRUD operations on the employee data.
-
Requests are validated using NestJS's ValidatePipe in a whitelist mode. Only requests with valid data will be processed, while others will be filtered out.
-
The application supports cursor-based pagination to efficiently handle large datasets and avoid potential performance issues.
-
The backend service communicates with a PostgreSQL database using Prisma as the ORM for managing employee data.
-
Search functionality is provided for employee data. If a search parameter is included, the API will perform a search. If no search parameter is present, the API will treat the request as a normal "findAll" request.
GET /employees
: Retrieve a list of employees with cursor-based pagination and optional search functionalityGET /employees/:id
: Retrieve a specific employee by IDPOST /employees
: Create a new employeePATCH /employees/:id
: Update an existing employee by IDDELETE /employees/:id
: Delete an employee by ID