REST API for Malawi district administrative and cultural data built with NestJS and Prisma.
# π²πΌ Malawi Districts Information API
A structured, relational REST API built with **NestJS** and **Prisma** that provides comprehensive administrative and cultural information about districts in Malawi.
This project demonstrates production-level backend architecture, relational modeling, and scalable API design.
---
## π Overview
The Malawi Districts Information API models hierarchical and relational geographic data including:
* Districts
* Traditional Authorities (TAs)
* Group Village Headmen (GVHs)
* Villages
* Council Wards
* Popular Features (lakes, rivers, markets, mountains)
* Dominant Tribes
* Dominant Languages
The API is designed to power a frontend (e.g., a Next.js application) that allows users to search and explore district-level information.
---
## π Architecture
This project follows **modular NestJS architecture** and clean separation of concerns.
```
Controller β Service β Prisma β Database
```
### Key Architectural Concepts
* Dependency Injection
* DTO-based validation
* Structured REST resource design
* Proper relational modeling (1:N, N:N)
* Global Prisma module
* Scalable module-based structure
---
## π Tech Stack
| Layer | Technology |
| ----------------- | --------------- |
| Backend Framework | NestJS |
| ORM | Prisma |
| Database | PostgreSQL |
| Validation | class-validator |
| API Architecture | REST |
| Language | TypeScript |
---
## π Database Design
### Relationship Structure
```
District
βββ Traditional Authority
β βββ Group Village Head
β β βββ Village
βββ Council Wards
βββ Features
βββ Dominant Tribes (Many-to-Many)
βββ Dominant Languages (Many-to-Many)
```
### Modeling Features
* UUID primary keys
* Enumerations (Region, FeatureType)
* Join tables for many-to-many relationships
* Normalized schema design
* Referential integrity enforced via Prisma
---
## π‘ API Endpoints
### Districts
| Method | Endpoi β¦