User management utility to handle user accounts across all UCS tools.
# UCS User Management Backend
The **UCS User Management Backend** is a Node.js and Express-based API designed to handle user authentication, authorization, and management across all UCS-related services. It provides robust features like role-based access control (RBAC), JWT-based authentication, custom rate limiting, error handling, and integration capabilities with external systems like **OpenMRS** and **DHIS2**.
---
## 📋 Table of Contents
- Features
- Tech Stack
- Getting Started
- Prerequisites
- Installation
- Environment Variables
- Running the App
- API Documentation
- Project Structure
- Scripts
- Key Features
- Testing
- Security
- Contributing
- License
---
## 🚀 Features
- JWT-based Authentication with Refresh Tokens
- Role-Based Access Control (RBAC)
- User CRUD Operations
- Password Hashing with Bcrypt
- Custom Rate Limiting with Role-Based Quotas
- Global Error Handling with Logging (Winston)
- Input Validation and Sanitization
- API Documentation with Swagger (OpenAPI)
- CI/CD Integration with GitHub Actions
- Integration-Ready for OpenMRS and DHIS2
- **Dual Email Service Support** (Gmail & eGA Corporate Email)
- **Automated Email Notifications** with Cron Jobs
---
## 🛠️ Tech Stack
- **Backend Framework:** Node.js, Express.js
- **Database:** PostgreSQL (via Prisma ORM)
- **Authentication:** JWT, Bcrypt
- **Logging:** Winston
- **Validation:** Joi/Yup
- **Testing:** Jest, Supertest
- **Documentation:** Swagger (OpenAPI)
- **CI/CD:** GitHub Actions
---
## 🚀 Getting Started
### Prerequisites
- **Node.js** (v16.x or higher)
- **PostgreSQL** (v13 or higher)
- **npm** or **yarn**
### Installation
1. **Clone the Repository:**
```bash
git clone
github.com
cd ucs-user-management-backend
```
2. **Install Dependencies:**
```bash
npm install
# or
yarn install
```
3. **Setup the database**
```bash
npx prisma migrate dev --name init
```
### Environment Variables
Create a .env file in the roo …