An open API service indexing awesome lists of open source software.

https://github.com/tanzeebul-tamim/unimate-ums

A MERN-stack MVP project aimed at showcasing the core functionalities of a university management system. Built as a major back-end practice project with focus on writing enterprise-grade backend architecture with scalable and modular design.
https://github.com/tanzeebul-tamim/unimate-ums

backend-development dotenv expressjs mondodb mongoose mongoose-schema nodejs personal-project restful-api typescript web-development

Last synced: 2 months ago
JSON representation

A MERN-stack MVP project aimed at showcasing the core functionalities of a university management system. Built as a major back-end practice project with focus on writing enterprise-grade backend architecture with scalable and modular design.

Awesome Lists containing this project

README

          


๐ŸŽ“ UniMate


University Management System (UMS)


Robust, scalable backend for academic and administrative management.
Built with TypeScript, Express.js, MongoDB, and modern best practices.



UniMate is a robust and scalable university management backend system designed to manage academic and administrative functionalities for students, faculty, and admin users. It is built with TypeScript, Express.js, MongoDB, and other modern tools, featuring proper error handling, validation, and modular architecture.


## ๐Ÿ“š Table of Contents

- [๐Ÿš€ Features](#-features)
- [๐Ÿงฐ Technologies Used](#-technologies-used)
- [๐Ÿ“ Project Structure](#-project-structure)
- [๐Ÿ“‹ Requirement Analysis](#-requirement-analysis)
- [๐Ÿ—‚ Database Schema Overview](#-database-schema-overview)
- [๐Ÿ“ก API Endpoints](#-api-endpoints)
- [๐Ÿงช Sample API Testing](#-sample-api-testing)
- [๐Ÿ” Common Advanced Query Features](#-common-advanced-query-features)
- [๐Ÿ“ฆ Sample Data](#-sample-data)
- [โœ… Prerequisites](#-prerequisites)
- [๐Ÿ”ง Installation & Running Locally](#-installation--running-locally)
- [๐ŸŒ Live Deployment](#-live-deployment)
- [๐Ÿค Contributing](#-contributing)
- [๐Ÿ“„ License](#-license)


## ๐Ÿš€ Features

- Full CRUD for students, faculty, and admin profiles
- Dynamic semester & department management
- Comprehensive ID validation and naming conventions
- Middleware-driven error handling & async wrapper
- Zod-based schema validation for type-safe API requests
- Global error handler with specific error mappers (Zod, Mongoose, duplicate, cast)
- Custom logic (middle name removal, ID formatting checks)
- Role-based restrictions and request validation utilities
- Modular, scalable folder architecture


## ๐Ÿงฐ Technologies Used


Node.js
Express.js
TypeScript
MongoDB
Mongoose
Zod
ESLint
Prettier
dotenv
bcrypt
validator
CORS
Vercel




Full list of Packages & Technologies Used (Click to expand)

- **Node.js**: JavaScript runtime environment for building scalable server-side applications
- **Express.js**: Web framework for Node.js to handle routing and middleware
- **TypeScript** โ€“ Strong typing & clean code structure
- **MongoDB**: NoSQL database for storing application data
- **Mongoose** โ€“ Schema modeling
- **Zod** โ€“ Runtime validation
- **ESLint** โ€“ Linting
- **Prettier** โ€“ Formatting
- **dotenv** โ€“ Environment variable management
- **HTTP Status** โ€“ Clean status messaging
- **ts-node-dev** โ€“ TypeScript development server
- **bcrypt** โ€“ Password hashing
- **validator** โ€“ Data validation
- **CORS** โ€“ Cross-Origin Resource Sharing
- **Vercel** โ€“ Cloud deployment


## ๐Ÿ“ Project Structure

```
UniMate-UMS/
โ”œโ”€โ”€ .gitignore # Specifies files and folders to be ignored by Git
โ”œโ”€โ”€ LICENSE # Project license information (MIT)
โ”œโ”€โ”€ README.md # Project documentation (this file)
โ”œโ”€โ”€ analysis-requirements/
โ”‚ โ”œโ”€โ”€ UniMate-Course-Syllabus.pdf # Project syllabus document
โ”‚ โ”œโ”€โ”€ UniMate-UMS-Database-Schema.png # Visual ER diagram showing database collections and relationships
โ”‚ โ””โ”€โ”€ UniMate-UMS-Requirement-Analysis.pdf # Documents functional requirements, database models, and API endpoints
โ””โ”€โ”€ server/
โ”œโ”€โ”€ sample/ # sample request payloads (student.json, faculty.json, admin.json)
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ app/
โ”‚ โ”‚ โ”œโ”€โ”€ builder/ # QueryBuilder.ts โ€“ builds mongoose queries (filter, sort, paginate)
โ”‚ โ”‚ โ”œโ”€โ”€ config/ # index.ts โ€“ loads environment config
โ”‚ โ”‚ โ”œโ”€โ”€ constant/ # common.ts โ€“ shared enums and schemas
โ”‚ โ”‚ โ”œโ”€โ”€ errors/ # AppError & handlers for Zod, Mongoose, etc.
โ”‚ โ”‚ โ”œโ”€โ”€ interface/ # common.ts, error.ts โ€“ TypeScript types/interfaces
โ”‚ โ”‚ โ”œโ”€โ”€ middlewares/ # globalErrorHandler.ts, validateRequest.ts, notFound.ts
โ”‚ โ”‚ โ”œโ”€โ”€ modules/ # feature modules (academicFaculty, student, semesterRegistration, etc.)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ moduleName/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ moduleName.constant.ts # Module-specific constants (roles, statuses, default values)
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ moduleName.controller.ts # Handles HTTP request/response logic
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ moduleName.interface.ts # Module-specific TypeScript types and interfaces
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ moduleName.model.ts # Mongoose schema/model definition for the module
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ moduleName.route.ts # Express route definitions and API endpoints
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ moduleName.service.ts # Core business logic, DB interactions
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ moduleName.utils.ts # Utility/helper functions for the module (Optional)
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ moduleName.validation.ts # Zod schema for validating incoming request bodies
โ”‚ โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ... # Other similar module directories
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ routes/ # index.ts โ€“ central router
โ”‚ โ”‚ โ””โ”€โ”€ utils/ # Utilities - catchAsync.ts, sendResponse.ts, idValidator.ts, etc.
โ”‚ โ”œโ”€โ”€ app.ts # Express app setup (parsers, routes, error middleware)
โ”‚ โ””โ”€โ”€ server.ts # Server entry point & MongoDB connection logic
โ”œโ”€โ”€ .env.example # Template Environment variables for local development
โ”œโ”€โ”€ .eslintignore # Specifies files and folders to be ignored by ESLint
โ”œโ”€โ”€ .eslintrc.json # ESLint configuration for code linting and style enforcement
โ”œโ”€โ”€ .prettierrc.json # Prettier configuration for consistent code formatting
โ”œโ”€โ”€ package-lock.json # Automatically generated lockfile for reproducible installs
โ”œโ”€โ”€ package.json # npm dependencies, devDependencies & useful scripts
โ”œโ”€โ”€ tsconfig.json # TypeScript compiler options and project settings
โ””โ”€โ”€ vercel.json # Vercel deployment configuration

```


## ๐Ÿ“‹ Requirement Analysis

| Entity | Student | Faculty | Admin |
| ----------------------- | ------------------------------------------------- | -------------------------------- | ------------------------------------------- |
| **Authentication** | Login, logout, change password | Login, logout, change password | Login, logout, change password |
| **Profile Mgmt** | Edit permitted fields | Edit permitted fields | Edit permitted fields |
| **Academic Procedures** | Enroll in courses, view schedule, grades, notices | Manage grades, view student info | Manage semesters, courses, offerings, rooms |
| **User Mgmt** | โ€” | โ€” | Create/block/unblock users, reset passwords |

_Full API spec and data structure details provided in the analysis document._


## ๐Ÿ—‚ Database Schema Overview

A visual representation of the core database models and relationships:


Database Schema

> **Legend:**
>
> - GREEN: Primary entities (Student, Faculty, Admin)
> - PINK: User & academic structure entities
> - YELLOW: Embedded objects
> - CYAN: Client payloads (Offered Course, Semester Registration)

> [!IMPORTANT]
> Entities shown under CYAN have the same names as their database counterparts but may differ in structure (client payloads vs. DB models).


## ๐Ÿ“ก API Endpoints

For a complete list of API specifications, including all endpoints and HTTP methods, see the [**_Requirement Analysis PDF_**](./analysis-requirements/UniMate-UMS-Requirement-Analysis.pdf).

**Sample endpoints:**

```http
POST /api/v1/users/create-student
GET /api/v1/students
GET /api/v1/students/S-2021010001
PATCH /api/v1/students/S-2021010001
DELETE /api/v1/students/S-2021010001
```

> **Tips:**
>
> - All endpoints are prefixed with `/api/v1/`
> - For user operations (admin, faculty, student), use the application-generated user ID (e.g., S-2021010001), not the MongoDB ObjectId.
> - For other entities (Academic Faculty, Department, etc.), use the MongoDB ObjectId (`_id`).


## ๐Ÿงช Sample API Testing

- Use [Postman](https://www.postman.com/) or [Insomnia](https://insomnia.rest/) to test APIs.
- For POST/PATCH, provide the required JSON body.
- The server responds with JSON for all endpoints.

> **Note:**
>
> - See [Requirement Analysis PDF](./analysis-requirements/UniMate-UMS-Requirement-Analysis.pdf) for full API route details.
> - Sample payloads are available in [`server/sample`](./server/sample).


## ๐Ÿ” Common Advanced Query Features

Most GET endpoints (students, faculties, departments, courses, etc.) support:

- `searchTerm=` โ€” partial name/code search
- `limit=` โ€” limit results per page
- `page=` โ€” pagination
- `sort=` โ€” sorting
- Field-based filters (e.g., `gender=male&bloodGroup=B+`)

Example:

```http
GET /api/v1/faculties?searchTerm=john&gender=male&page=2&limit=10&sort=name.firstName
```


## ๐Ÿ“ฆ Sample Data

Sample `.json` data files for Student, Faculty, Admin are available in [`server/sample`](./server/sample) for testing payloads.


## โœ… Prerequisites

- [**Node**.js](https://nodejs.org/) (v18 or higher recommended)
- [**npm**](https://www.npmjs.com/) (comes with Node.js)
- [**MongoDB**](https://www.mongodb.com/try/download/community) (local or remote)
- A [**`.env`**](./server/.env.example) file with required environment variables


## ๐Ÿ”ง Installation & Running Locally

### 1. Clone the repository

```bash
git clone https://github.com/yourusername/UniMate-UMS.git
cd UniMate-UMS/server
```

### 2. Install dependencies

```bash
npm install
```

### 3. Set up environment variables

- **Rename [`server/.env.example`](./server/.env.example) to `.env` and fill in your credentials:**

```env
NODE_ENV=development
PORT=5000
DATABASE_URL=yourDatabaseUser
BCRYPT_SALT_ROUNDS=12
DEFAULT_PASS=ChangeMeToASecurePassword!
```

- **Configuration Details:**

- NODE_ENV: `development` (local) or `production` (deployed)
- PORT: Port your Express app will listen on
- DATABASE_URL: MongoDB connection string (local or Atlas)
- BCRYPT_SALT_ROUNDS: Password hashing complexity (integer โ‰ฅ 4)
- DEFAULT_PASS: Default admin password (change after first login)

> โš ๏ธ Caution:
Never commit your `.env` file to version control. Keep it private and add `.env` to your `.gitignore`.

### 4. Run the development server

```bash
npm run dev
```

### 5. Build for production

```bash
npm run build
npm run prod
```


## ๐ŸŒ Live Deployment

The API is deployed on [**_Vercel_**](https://vercel.com/) and is live at [**this following URL**](https://unimate-ums-backend.vercel.app/).


## ๐Ÿค Contributing

Have ideas to improve this API? Found a bug? [Open an issue](https://github.com/yourusername/UniMate-UMS/issues) or submit a pull request!


## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.