Glossary: images-api
Generated by .github/scripts/build-glossary.mjs from domain-graph.json (source commit 9d761d1). Do not edit by hand.
This glossary lists the business terms of images-api. Each term links to its domain, which says what the domain does, its rules, and its flows. The estate glossary shows which other repos use the same terms.
Terms
- BaseRepository: Data Persistence
- Docker Image: Build & Deployment
- Domain: Image Processing & Delivery
- Express App: API Request Lifecycle
- HttpError: API Request Lifecycle
- Image: Image Processing & Delivery
- Knex Connection: Data Persistence
- Kubernetes Deployment: Build & Deployment
- Kustomize Overlay: Build & Deployment
- Middleware: API Request Lifecycle
- Postgres Table: Data Persistence
- Request: API Request Lifecycle
- ResizeParams (height, width, rotation, quality): Image Processing & Delivery
- Response: API Request Lifecycle
- semantic-release Version: Build & Deployment
- Session: Data Persistence
Domains
Image Processing & Delivery
The core business domain of the service. It fetches a remote source image, validates the requested resize parameters, applies Sharp transforms, and streams the resulting image back to the caller. Two GET endpoints expose an original-image path and a parameterized resize path.
Terms: Image, Domain, ResizeParams (height, width, rotation, quality)
Rules:
- Resize parameters are validated with Joi before any transform runs
- Params encode height/width/rotation/quality in a compact form (e.g. h=100,w=100)
- When no params are supplied the original image buffer is returned unchanged
- Output transforms produce a JPEG buffer streamed back to the client
Flows:
- Serve Resized Image (
GET /img/:domain/:params/:image): Handles a parameterized image request: parses the arbitrary-depth image URL and resize params from the path, fetches the source image, validates and applies the transforms, and streams the resized JPEG back. - Serve Image (
GET /img/:domain/:image): Handles a plain image request for a given domain and image identifier: validates the request params, resizes through the service, and pipes the resulting stream back to the client.
API Request Lifecycle
The Express protocol layer that boots the service and shapes every request and response. It loads environment config, wires CORS, JSON parsing, and a content-type guard, dispatches routes through an async wrapper, and centralizes error translation.
Terms: Request, Response, Middleware, HttpError, Express App
Rules:
- Non-JSON POST requests are rejected with HTTP 415 by the content-type guard
- Every async route handler is wrapped so rejected promises reach the global error handler
- The global error handler maps HttpError, Joi ValidationError, and Axios errors, defaulting to 500
- Environment config is loaded per NODE_ENV before the app starts listening
Flows:
- Application Bootstrap (
node . (server.js)): Starts the microservice: loads the per-environment dotenv file, configures the log level, builds the Express app factory, and begins listening on the configured port. - Request Middleware Chain (
Any HTTP request to the Express app): The per-request pipeline every call passes through: CORS and JSON parsing, a content-type guard that rejects non-JSON POSTs with 415, route dispatch via an async wrapper, and centralized error translation.
Data Persistence
A Knex/Postgres persistence scaffold for future repositories. It provides a transactional session abstraction and a generic base repository with CRUD and filtered-query helpers. The current resize flow is stateless, so this layer is groundwork rather than an active path.
Terms: BaseRepository, Session, Knex Connection, Postgres Table
Rules:
- Data access runs inside a transaction session with explicit begin/commit/rollback
- Filter objects are translated recursively into chained Knex where clauses
- Repository failures raise HttpError carrying an HTTP status and a rollback flag
Flows:
- Repository Data Access (
BaseRepository method call within a Session): The transactional persistence path for future repositories: open a Knex session, build a filtered query, run a CRUD operation, and commit or roll back based on the outcome.
Build & Deployment
The delivery lifecycle that takes the service from commit to production. GitHub Actions lint and test the code, semantic-release versions it, Docker packages it, and Kustomize overlays promote the image tag across development, test, and production Kubernetes environments.
Terms: Docker Image, Kustomize Overlay, Kubernetes Deployment, semantic-release Version
Rules:
- Pull requests must pass ESLint and integration tests before merge
- Push to main triggers a semantic-release version, Docker build/push, and dev overlay bump
- Production and test promotions are manual workflow_dispatch runs gated to the Greenstand organization
- Environment overlays differ only by image tag over a shared Kustomize base
Flows:
- Pull Request CI (
pull_request to main branch): Validates every pull request to main: installs dependencies, runs ESLint, and executes the integration test suite in a Node container. - Build & Deploy to Dev (
push to main branch): Runs on push to main: lints and tests, publishes a semantic-release version, builds and pushes the Docker image to DockerHub, and bumps the development Kustomize overlay for GitOps deployment. - Promote to Production (
workflow_dispatch with a required git-tag input): A manually dispatched workflow that promotes a given image tag to the production Kustomize overlay and commits the bump, gated to the Greenstand organization.