How mykeels/college-portal works
Project Type & Purpose
• This repository implements the backend/API service for an “Open Source College Portal” – a Node.js/Express server that handles student registration, document upload, user‐role management, and related university workflows.
• Although the README describes the overall portal (including UI/UX), the codebase here focuses on the server-side: database schema (ERD), migrations, models, data-access “proxies,” environment config, and automated tests.
High-Level Components
a. External Client(s)
– Browser or native mobile app (not in this repo) consuming the REST API
b. API Layer (Express Server)
– src/index.js (entry point)
– Route handlers / controllers (inferred under src/)
– Configuration: .env.example, .babelrc
c. Business-Logic / Service Layer
– Any “helpers” under src/db/helpers (error handling, hashing)
d. Data-Access Layer (Repository/Proxy Pattern)
– src/db/models/* – defines Sequelize/ORM models for users, roles, images, phone-numbers, etc.
– src/db/proxies/* – wraps models with CRUD operations & queries
– src/db/migrations – schema versioning
– src/db/events – hooks and lifecycle events
e. Database
– Relational DB (e.g., PostgreSQL or MySQL) hosting the tables defined by migrations and models
– ERD available under data/ERD_data_model.xml
f. Testing
– src/db/tests – unit tests for proxies
– src/tests – integration tests for user flows
Relationships & Data Flow
• Client → HTTP(S) → Express API
• Express Controller → Service/Helper → Data-Access Proxy → ORM Model → Database
• Migrations run at deploy time or via CLI (src/db/migrations)
• Errors bubble up via catch-errors.js and errors.js helpers
• Tests hit the proxies or full HTTP endpoints against a test database
Key Architectural Patterns & Design Principles
• Layered Architecture: clear separation between transport (HTTP), business logic (helpers), data access (proxies/models), and persistence (DB).
• Repository/Proxy Pattern: centralizes all DB queries in proxies for easy mocking/testing.
• Schema Versioning: migrations folder maintains DDL changes.
• Test-Driven Development: comprehensive test suites for each proxy and endpoint.
• Environment-First Configuration: all secrets/config in .env, example provided.
Details to Capture
– Environment configuration (.env) influences the API server and DB connections
– Lifecycle events in src/db/events trigger hooks (e.g., sending notifications)
– Error-handling flow via catch-errors.js
– The ERD defines cardinalities for Users, Roles, Images, Phone-Numbers, etc.