hrms-backend
HRMS Backend - Development Setup Guide (gRPC Microservices)
The gRPC microservices refactor is complete. We've transitioned to an API-First architecture using Protocol Buffers, completely decoupled the databases, and implemented a clean API Gateway pattern.
Here is the step-by-step guide to setting up the development environment on your local machine. I have shared the SQL dump files separately for database seeding.
Prerequisites
Please ensure you have the following installed:
- Git
- Docker (or Podman with
podman-compose) - Deno (deno 2.9.1)
Step 1: Clone and Configure
Clone the repository and navigate into the project folder:
git clone <your-repo-url>
cd hrms-backend
Make sure your .env file is present in the root directory. If not, create one based on the .env.example (I can provide the dev values if needed).
Step 2: Start the Databases
We use isolated MySQL containers for each microservice. Start them in the background:
docker-compose up -d
(If you are using Podman, use podman-compose up -d)
Step 3: Import the SQL Dumps
I have provided the SQL dump files separately (hrms_ems_dump.sql, hrms_ams_dump.sql, hrms_lms_dump.sql). Place them in the root of the project folder and run these commands to import the data into the respective containers:
# Import EMS Database (Port 3306)
docker exec -i hrms_ems_db mysql -u root -proot hrms_ems < hrms_ems_dump.sql
# Import AMS Database (Port 3307)
docker exec -i hrms_ams_db mysql -u root -proot hrms_ams < hrms_ams_dump.sql
# Import LMS Database (Port 3308)
docker exec -i hrms_lms_db mysql -u root -proot hrms_lms < hrms_lms_dump.sql
Step 4: Build the Proto Compiler (One-time setup)
Because we use API-First design, the TypeScript types are generated from .proto files. We have a dedicated Docker container for this so you don't need to install any compilers globally.
Build and start the compiler container:
docker-compose build proto-compiler
docker-compose up -d proto-compiler
Step 5: Generate the gRPC Code
Run the provided script to generate the Deno/TypeScript gRPC clients and server interfaces:
./scripts/gen_protos.sh
(You will see a generated/ folder populated with .ts files).
Step 6: Start the Backend Services
We have a convenience script that starts the 4 Deno services (API Gateway, EMS, AMS, LMS) simultaneously for hot-reloading.
./start-dev.sh
(Alternatively, you can open 4 separate terminals and run deno run -A --env-file=.env services/<module>/main.ts in each).
Step 7: Testing the APIs (Postman)
The entire backend is now hidden behind the API Gateway on http://localhost:8000.