{"id":15198502,"url":"https://github.com/swiatlon/university-bn","last_synced_at":"2025-10-28T08:32:10.547Z","repository":{"id":227713693,"uuid":"768854800","full_name":"Swiatlon/University-BN","owner":"Swiatlon","description":"University management system backend (node.js)","archived":false,"fork":false,"pushed_at":"2024-09-02T16:59:01.000Z","size":749,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-11T17:24:33.765Z","etag":null,"topics":["backend-api","cors","crud-application","dto-pattern","errorhandler","eslint-config","expressjs","middleware","nodejs","prettier-config","typeorm","typeorm-migration","university"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Swiatlon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-07T21:24:28.000Z","updated_at":"2024-09-02T16:59:04.000Z","dependencies_parsed_at":"2024-08-26T19:26:34.850Z","dependency_job_id":null,"html_url":"https://github.com/Swiatlon/University-BN","commit_stats":null,"previous_names":["swiatlon/university-bn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swiatlon%2FUniversity-BN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swiatlon%2FUniversity-BN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swiatlon%2FUniversity-BN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swiatlon%2FUniversity-BN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Swiatlon","download_url":"https://codeload.github.com/Swiatlon/University-BN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219859906,"owners_count":16556031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend-api","cors","crud-application","dto-pattern","errorhandler","eslint-config","expressjs","middleware","nodejs","prettier-config","typeorm","typeorm-migration","university"],"created_at":"2024-09-28T01:20:21.606Z","updated_at":"2025-10-28T08:32:10.083Z","avatar_url":"https://github.com/Swiatlon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎓 University Node Backend\n\nThis project serves as the **backend** for a **University Management System**, designed to streamline the management of student data, course registrations, and more. Built with **Express.js** and **TypeScript**, it emphasizes strong typing and modern asynchronous patterns for handling HTTP requests.\n\n---\n\n## 🚀 Features\n\n- **🔧 Express.js with TypeScript**: Leverage the robustness of **Express.js** combined with the strong typing provided by **TypeScript** for scalable and maintainable backend development.\n- **✅ Custom Validation and DTOs**: Implements custom validation and **Data Transfer Objects (DTOs)** to ensure the integrity and correctness of request data.\n- **📂 Absolute Imports**: Simplifies import paths, enhancing readability and maintainability.\n- **🔨 Custom Migration Utility**: Manages database schema changes and data migrations to ensure consistency across environments.\n- **⚙️ Reflective Middleware \u0026 Utilities**: Includes **asyncHandler** for better error handling and structured constants for consistent validation messages.\n\n---\n\n## 📝 Getting Started\n\n### 📦 Prerequisites\n\n- **Node.js**: Version \u003e=18.0.0 (recommended).\n- **npm**: Version \u003e=8.0.0 (recommended).\n\n---\n\n### 🔑 ENV: REMEMBER TO CREATE .env FILE!\n### Before running the application, make sure you create a .env file in the root of the project. This file is crucial for defining your environment variables, such as database credentials and API keys.\n\n---\n\n### 🛠️ Installation\n\n1. **Clone the repository**:\n\n   ```bash\n   git clone https://github.com/Swiatlon/University-BN\n   ```\n\n2. **Navigate to the project directory**:\n\n   ```bash\n   cd University-BN\n   ```\n\n3. **Install NPM packages**:\n\n   ```bash\n   npm install\n   ```\n\n4. **Generate a migration**:\n\n   ```bash\n   npm run migration:generate name\"(optional)\"\n   ```\n\n5. **Apply migrations**:\n\n   ```bash\n   npm run migration:apply\n   ```\n\n---\n\n## 🚀 Running the Application\n\n1. **Development mode** with live reloads via `nodemon`:\n\n   ```bash\n   npm run dev\n   ```\n\n2. **Build the application** for production:\n\n   ```bash\n   npm run build\n   ```\n\n3. **Start the application** post-build:\n\n   ```bash\n   npm start:prod\n   ```\n\n---\n\n## 🐳 Docker Compose Setup\n\nThis project includes a **Docker Compose** configuration designed for development and production environments. The `docker-compose.yml` file simplifies running the application, database, and related services.\n\n### 🏗️ Key Features\n\n- **Development \u0026 Production Profiles**: Easily switch between development and production using Docker Compose profiles (`dev` or `prod`).\n- **Integrated Database**: **PostgreSQL** is included as a service, pre-configured to work with the application.\n- **Modular Repository Structure**: Works alongside the frontend repository for seamless orchestration in a unified environment.\n\n---\n\n### 🔑 Prerequisites\n\n1. Clone both **frontend** and **backend** repositories into the same parent directory:\n\n   ```bash\n   git clone https://github.com/Swiatlon/University-FN University-FN\n   git clone https://github.com/Swiatlon/University-BN University-BN\n   ```\n\n2. Ensure the parent directory looks like this:\n\n   ```\n   Parent Directory/\n   ├── University-FN/   # Frontend repository\n   └── University-BN/   # Backend repository\n   ```\n\n3. Place the provided `docker-compose.yml` file in the **parent directory**.\n\n---\n\n### 🔄 How to Use `docker-compose.yml`\n\n#### 1. Clone Repositories\n\n```bash\ngit clone https://github.com/Swiatlon/University-FN University-FN\ngit clone https://github.com/Swiatlon/University-BN University-BN\n```\n\n#### 2. Organize Your Project\n\nEnsure your directory looks like this:\n\n```\nParent Directory/\n├── docker-compose.yml  # Unified orchestration file\n├── University-FN/      # Frontend repository\n└── University-BN/      # Backend repository\n```\n\n#### 3. Remove Individual Compose Files\n\nIf `docker-compose.yml` files exist in **University-FN** or **University-BN** repositories, remove them to avoid conflicts.\n\n#### 4. Generate Migration\n\nBefore running the containers, generate migrations for your backend:\n\n```bash\ncd University-BN\nnpm run migration:generate \u003cmigration-name\u003e\n```\n\n#### 5. Start Services\n\nRun the following commands from the **parent directory**:\n\n- **Development Mode**:\n\n   ```bash\n   docker-compose --profile dev up --build\n   ```\n\n- **Production Mode**:\n\n   ```bash\n   docker-compose --profile prod up --build\n   ```\n\n#### 6. Stop Services\n\nTo stop and clean up all services:\n\n```bash\ndocker-compose down\n```\n\n---\n\n### 📜 Service Details\n\n- **Frontend**:\n  - Access at `http://localhost:5173` (development mode).\n  - Built using Dockerfile in the `University-FN` repository.\n  \n- **Backend**:\n  - Access at `http://localhost:8800`.\n  - Includes automatic database migrations and seeders for development.\n  \n- **Database**:\n  - **PostgreSQL** runs in a container, pre-configured for the backend.\n\n---\n\n## 🔧 Custom Migration Utility\n\nA custom migration utility helps you streamline database migrations, ensuring schema changes are consistently applied across all environments.\n\n### 🎯 Key Features\n\n- **Automatic Migration Generation**: Generates migration files based on TypeORM entity changes.\n- **Simplified Migration Execution**: Apply or revert migrations with ease.\n\n---\n\n### ⚙️ Using the Migration Utility\n\n- **Generate Migrations**: After updating entities, generate a migration file:\n\n  ```bash\n  npm run migration:generate \u003cmigration-name\u003e\n  ```\n\n- **Run Migrations**: Apply migrations to the database:\n\n  ```bash\n  npm run migration:run\n  ```\n\n- **Revert Migrations**: Rollback the most recent migration:\n\n  ```bash\n  npm run migration:revert\n  ```\n\n---\n\n## 📂 Project Structure\n\n- **`src/`**: Contains all source files.\n  - **`controllers/`**: Handles incoming requests and returns responses to clients.\n  - **`entities/`**: Represents database tables and relations.\n  - **`services/`**: Contains core business logic.\n  - **`dtos/`**: Ensures type safety and validation for incoming data.\n  - **`constants/`**: Stores validation rules and constants.\n  - **`utils/`**: Provides utility functions and middleware.\n  - **`app.ts`**: The entry point of the application.\n- **`dist/`**: Contains compiled JavaScript files for production.\n\n---\n\n## 👨‍💻 Contributing\n\nGuidelines for contributing to the project will be established, including code style, pull request procedures, and best practices.\n\n---\n\n## 📝 License\n\nThe project is open-source under the **MIT license**.\n\n---\n\nLet me know if you'd like any further adjustments! 😊","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiatlon%2Funiversity-bn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswiatlon%2Funiversity-bn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiatlon%2Funiversity-bn/lists"}