# gt-scheduler/backend architecture

> Architecture diagram of the GitHub repository gt-scheduler/backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gt-scheduler/backend
- Repository: https://github.com/gt-scheduler/backend

## Overview

#### Purpose and Runtime
GT Scheduler Backend is a TypeScript/Node.js Express API that supplements the GT Scheduler website/crawler. Its primary documented feature accepts frontend feedback, validates it, and forwards it to Airtable for project-owner access. The service runs locally on port 3030 and compiles TypeScript to a distributable server entry point. Paths: `src/server.ts`, `src/app.ts`, `package.json`.

#### Process Entry and Application Composition
`src/server.ts` is the runtime bootstrap: it starts the HTTP listener. `src/app.ts` constructs the Express application, where cross-cutting middleware and route mounting are expected to be composed. This separates process lifecycle concerns from reusable app configuration. Paths: `src/server.ts`, `src/app.ts`.

#### HTTP Routing Boundary
The route layer exposes the API surface and dispatches incoming requests to domain controllers. `src/routes/index.ts` is the central router integration point, keeping endpoint registration separate from application bootstrapping and request implementation. Paths: `src/routes/index.ts`, `src/app.ts`.

#### Feedback Intake and Validation
Feedback requests cross a validation boundary before reaching external persistence. `src/middlewares/formValidation.ts` uses the documented Celebrate runtime-validation approach to reject malformed input; downstream controllers can therefore operate on validated request data. Paths: `src/middlewares/formValidation.ts`, `src/routes/index.ts`, `src/controllers/airTable.ts`.

#### Airtable Integration
The Airtable controller is the external-service adapter for feedback submission. It receives validated frontend data and translates/forwards it to Airtable, whose API key and base settings are supplied through environment configuration rather than source code. This is the repository’s principal external dependency and persistence boundary. Paths: `src/controllers/airTable.ts`, `src/config.ts`, `.env.example`.

#### Class-Section API Capability
A separate controller handles class-section-related behavior, representing the backend’s scheduler-facing API capability beyond feedback intake. Routing delegates requests into this controller rather than embedding scheduler logic in transport setup. Paths: `src/controllers/classSection.ts`, `src/routes/index.ts`.

#### Error Handling and Operational Concerns
Errors are centralized through Express error middleware, providing a consistent response boundary for validation, controller, and integration failures. HTTP request logging is provided by Morgan per the project documentation. Deployment automation is defined separately from application code. Paths: `src/middlewares/errorHandler.ts`, `src/app.ts`, `.github/workflows/deploy.yml`.

Main entry points: [`src/routes/index.ts`](https://github.com/gt-scheduler/backend/blob/main/src/routes/index.ts) (Central router), [`src/controllers/airTable.ts`](https://github.com/gt-scheduler/backend/blob/main/src/controllers/airTable.ts) (Airtable controller), [`src/middlewares/errorHandler.ts`](https://github.com/gt-scheduler/backend/blob/main/src/middlewares/errorHandler.ts) (Error middleware), [`src/app.ts`](https://github.com/gt-scheduler/backend/blob/main/src/app.ts) (Express app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_package["Package build scripts<br/>Node package<br/>[package.json]"]
  node_server["Server bootstrap<br/>Node entry point<br/>[server.ts]"]
  node_app["Express app<br/>application composition<br/>[app.ts]"]
end

subgraph group_api["HTTP API"]
  node_routes["Central router<br/>route registry<br/>[index.ts]"]
  node_class_sections["Class-section controller<br/>scheduler controller<br/>[classSection.ts]"]
end

subgraph group_feedback["Feedback Pipeline"]
  node_validation["Feedback validation<br/>Celebrate middleware<br/>[formValidation.ts]"]
  node_airtable_controller["Airtable controller<br/>integration controller<br/>[airTable.ts]"]
  node_airtable[("Airtable API<br/>external persistence")]
end

subgraph group_operations["Operations"]
  node_config["Environment config<br/>configuration boundary<br/>[config.ts]"]
  node_env_example["Environment template<br/>environment contract<br/>[.env.example]"]
  node_error_handler["Error middleware<br/>Express error boundary<br/>[errorHandler.ts]"]
  node_deploy["Deployment workflow<br/>CI/CD workflow<br/>[deploy.yml]"]
end

node_package -->|"builds and runs"| node_server
node_server -->|"starts"| node_app
node_app -->|"mounts"| node_routes
node_app -->|"uses"| node_error_handler
node_routes -->|"dispatches class-section requests"| node_class_sections
node_routes -->|"applies to feedback"| node_validation
node_validation -->|"validated feedback"| node_airtable_controller
node_airtable_controller -->|"submits feedback"| node_airtable
node_config -.->|"provides credentials and base"| node_airtable_controller
node_env_example -.->|"documents variables"| node_config
node_routes -->|"errors"| node_error_handler
node_validation -->|"validation failures"| node_error_handler
node_airtable_controller -->|"integration failures"| node_error_handler
node_deploy -.->|"deploys application"| node_package

click node_package "https://github.com/gt-scheduler/backend/blob/main/package.json"
click node_server "https://github.com/gt-scheduler/backend/blob/main/src/server.ts"
click node_app "https://github.com/gt-scheduler/backend/blob/main/src/app.ts"
click node_routes "https://github.com/gt-scheduler/backend/blob/main/src/routes/index.ts"
click node_class_sections "https://github.com/gt-scheduler/backend/blob/main/src/controllers/classSection.ts"
click node_validation "https://github.com/gt-scheduler/backend/blob/main/src/middlewares/formValidation.ts"
click node_airtable_controller "https://github.com/gt-scheduler/backend/blob/main/src/controllers/airTable.ts"
click node_config "https://github.com/gt-scheduler/backend/blob/main/src/config.ts"
click node_env_example "https://github.com/gt-scheduler/backend/blob/main/.env.example"
click node_error_handler "https://github.com/gt-scheduler/backend/blob/main/src/middlewares/errorHandler.ts"
click node_deploy "https://github.com/gt-scheduler/backend/blob/main/.github/workflows/deploy.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_package,node_server,node_app toneBlue
class node_routes,node_class_sections toneAmber
class node_validation,node_airtable_controller,node_airtable toneMint
class node_config,node_env_example,node_error_handler,node_deploy toneRose
```

## Components

### Runtime

- [Package build scripts](https://github.com/gt-scheduler/backend/blob/main/package.json): Node package · Builds TypeScript into the distributable server. · `package.json`
- [Server bootstrap](https://github.com/gt-scheduler/backend/blob/main/src/server.ts): Node entry point · Starts the HTTP listener on port 3030. · `src/server.ts`
- [Express app](https://github.com/gt-scheduler/backend/blob/main/src/app.ts): application composition · Composes middleware and mounted routes. · `src/app.ts`

### HTTP API

- [Central router](https://github.com/gt-scheduler/backend/blob/main/src/routes/index.ts): route registry · Registers API endpoints and dispatches requests. · `src/routes/index.ts`
- [Class-section controller](https://github.com/gt-scheduler/backend/blob/main/src/controllers/classSection.ts): scheduler controller · Implements scheduler-facing class-section behavior. · `src/controllers/classSection.ts`

### Feedback Pipeline

- [Feedback validation](https://github.com/gt-scheduler/backend/blob/main/src/middlewares/formValidation.ts): Celebrate middleware · Rejects malformed feedback before controller handling. · `src/middlewares/formValidation.ts`
- [Airtable controller](https://github.com/gt-scheduler/backend/blob/main/src/controllers/airTable.ts): integration controller · Transforms validated feedback into Airtable submissions. · `src/controllers/airTable.ts`
- **Airtable API**: external persistence · Project-owner feedback store.

### Operations

- [Environment config](https://github.com/gt-scheduler/backend/blob/main/src/config.ts): configuration boundary · Supplies Airtable API and base settings. · `src/config.ts`
- [Environment template](https://github.com/gt-scheduler/backend/blob/main/.env.example): environment contract · `.env.example`
- [Error middleware](https://github.com/gt-scheduler/backend/blob/main/src/middlewares/errorHandler.ts): Express error boundary · Normalizes validation, controller, and integration failures. · `src/middlewares/errorHandler.ts`
- [Deployment workflow](https://github.com/gt-scheduler/backend/blob/main/.github/workflows/deploy.yml): CI/CD workflow · `.github/workflows/deploy.yml`

## Connections

- Package build scripts → Server bootstrap: builds and runs
- Server bootstrap → Express app: starts
- Express app → Central router: mounts
- Express app → Error middleware: uses
- Central router → Class-section controller: dispatches class-section requests
- Central router → Feedback validation: applies to feedback
- Feedback validation → Airtable controller: validated feedback
- Airtable controller → Airtable API: submits feedback
- Environment config → Airtable controller: provides credentials and base
- Environment template → Environment config: documents variables
- Central router → Error middleware: errors
- Feedback validation → Error middleware: validation failures
- Airtable controller → Error middleware: integration failures
- Deployment workflow → Package build scripts: deploys application
