Mahis intergrated user management API
MIUM API
MAHIS Integrated User Management — central identity & access layer for the MAHIS ecosystem
## Overview
**MIUM** (MAHIS Integrated User Management) is the central identity and access
management API for the MAHIS ecosystem. It provides a single, trusted source of
user data for every connected health information system, handling authentication,
authorization and the assignment of users to roles, programs and facilities.
It also synchronises user data with **MEMIS**, so user groups and identities can
be shared across systems.
### Key features
- **JWT-secured authentication** & session management
- **Role-based access control** (RBAC) via guards and a `@Roles()` decorator
- Assignment of users to **roles**, **programs** and **facilities**
- **MEMIS** user-group synchronisation
- Structured **audit & HTTP request logging** (Winston, with daily-rotated files)
- Interactive **Swagger** API documentation
- A branded landing page served at the root
## Tech stack
| Layer | Technology |
| ---------------- | --------------------------------------------- |
| Framework | NestJS 11 |
| Language | TypeScript |
| ORM / Database | Prisma 6 + MySQL |
| Auth | Passport (`passport-jwt`, `passport-local`), `@nestjs/jwt`, bcrypt |
| Docs | `@nestjs/swagger` (Swagger UI) |
| Logging | Winston + `nest-winston` + daily rotate file |
## Project setup
```bash
$ npm install
```
Create a `.env` file (see `.env.example`):
```env
DATABASE_URL="mysql://username:password@localhost:3306/mium"
PORT=4000
# MEMIS integration
MEMIS_BASE_URL="
https://host:port/api"
MEMIS_USERNAME=username
MEMIS_PASSWORD=password
MEMIS_TIMEOUT=10000
# Encryption key
KEY=secretkey
```
### Database
```bash
# apply migrations
$ npx prisma migrate deploy
# seed data
$ npm run prisma:seed-admin-user
$ npm run prisma:seed-facilities-o …