# liamosycka/covamat architecture

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

- Interactive diagram: https://gitdiagram.com/liamosycka/covamat
- Repository: https://github.com/liamosycka/covamat

## Overview

1. This repository contains only the server side of CoVaMaT, a Node.js GraphQL API for managing “context variety” data. The README makes clear that the implementation here is the GraphQL server; the broader thesis documentation is external to the repo.

2. The application entrypoint is `src/index.js`. It is the bootstrap layer that starts the server, loads configuration, and connects the API layer to the database/configuration layer before serving requests.

3. The API is assembled in two main pieces: `src/schema.js` and `src/resolvers.js`. These are composition modules that likely merge the per-domain schema and resolver modules into one executable GraphQL service.

4. The GraphQL type system is split by business concept under `src/schemas/`: `case`, `datasheet`, `datasheetInstance`, `domain`, `variation`, `variationPoint`, and `varietyType`. This indicates the domain model is centered on cases and datasheets, with an explicit variability model built from domains, variations, variation points, and variety types.

5. The resolver layer lives under `src/resolvers/` with one resolver file per major entity (`case`, `datasheet`, `datasheetInstance`). These resolvers are the main boundary between incoming GraphQL operations and the underlying data model: they interpret queries/mutations and return domain objects.

6. The persistence/model layer is under `src/entities/` with entity definitions for `case`, `datasheet`, and `datasheetInstance`. These are the data-facing counterparts to the GraphQL types and are the primary abstraction used by resolvers to read/write stored records.

7. `src/config/db.js` isolates database setup and connection concerns from the rest of the codebase. Architecturally, this is the infrastructure boundary: the application boots, connects to the configured datastore, and then exposes GraphQL operations over that backing store.

8. The data flow is therefore: GraphQL request enters the server → the composed schema routes it to a resolver → the resolver uses an entity/model and the DB configuration to access persistence → the result is returned through the GraphQL response. There is no separate service layer visible; the resolvers are the main orchestration point.

9. The repository is organized as a single-service backend with clear separation between API schema, request handling, persistence models, and infrastructure configuration. There are no frontend components, background workers, or multiple services in this repo; the architecture is intentionally focused on one GraphQL API surface.

Main entry points: [`src/schema.js`](https://github.com/liamosycka/covamat/blob/main/src/schema.js) (Schema compose), [`src/resolvers.js`](https://github.com/liamosycka/covamat/blob/main/src/resolvers.js) (Resolvers compose), [`src/config/db.js`](https://github.com/liamosycka/covamat/blob/main/src/config/db.js) (DB config), [`src/index.js`](https://github.com/liamosycka/covamat/blob/main/src/index.js) (Server start)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bootstrap["Bootstrap"]
  node_src_index(("Server start<br/>bootstrap<br/>[index.js]"))
end

subgraph group_api["GraphQL API"]
  node_src_schema["Schema compose<br/>graphql composition<br/>[schema.js]"]
  node_src_resolvers["Resolvers compose<br/>resolver composition<br/>[resolvers.js]"]
  node_src_resolvers_case["Case resolver<br/>[case.js]"]
  node_src_resolvers_datasheet["Datasheet resolver<br/>[datasheet.js]"]
  node_src_resolvers_datasheet_instance["Instance resolver"]
end

subgraph group_domain["Domain model"]
  node_src_schemas_case["Case type<br/>schema<br/>[case.js]"]
  node_src_schemas_datasheet["Datasheet type<br/>schema<br/>[datasheet.js]"]
  node_src_schemas_datasheet_instance["Instance type<br/>schema"]
  node_src_schemas_domain["Domain type<br/>schema<br/>[domain.js]"]
  node_src_schemas_variation["Variation type<br/>schema<br/>[variation.js]"]
  node_src_schemas_variation_point["Variation point<br/>schema<br/>[variationPoint.js]"]
  node_src_schemas_variety_type["Variety type<br/>schema<br/>[varietyType.js]"]
end

subgraph group_persistence["Persistence"]
  node_src_entities_case[("Case entity<br/>model<br/>[case.js]")]
  node_src_entities_datasheet[("Datasheet entity<br/>model<br/>[datasheet.js]")]
  node_src_entities_datasheet_instance[("Instance entity<br/>model")]
end

subgraph group_infra["Infrastructure"]
  node_src_config_db[("DB config<br/>db setup<br/>[db.js]")]
end

node_src_index -->|"connects"| node_src_config_db
node_src_index -->|"loads"| node_src_schema
node_src_index -->|"loads"| node_src_resolvers
node_src_schema -->|"includes"| node_src_schemas_case
node_src_schema -->|"includes"| node_src_schemas_datasheet
node_src_schema -->|"includes"| node_src_schemas_datasheet_instance
node_src_schema -->|"includes"| node_src_schemas_domain
node_src_schema -->|"includes"| node_src_schemas_variation
node_src_schema -->|"includes"| node_src_schemas_variation_point
node_src_schema -->|"includes"| node_src_schemas_variety_type
node_src_resolvers -->|"merges"| node_src_resolvers_case
node_src_resolvers -->|"merges"| node_src_resolvers_datasheet
node_src_resolvers -->|"merges"| node_src_resolvers_datasheet_instance
node_src_resolvers_case -->|"uses"| node_src_entities_case
node_src_resolvers_datasheet -->|"uses"| node_src_entities_datasheet
node_src_resolvers_datasheet_instance -->|"uses"| node_src_entities_datasheet_instance
node_src_resolvers_case -.->|"depends on"| node_src_config_db
node_src_resolvers_datasheet -.->|"depends on"| node_src_config_db
node_src_resolvers_datasheet_instance -.->|"depends on"| node_src_config_db

click node_src_index "https://github.com/liamosycka/covamat/blob/main/src/index.js"
click node_src_schema "https://github.com/liamosycka/covamat/blob/main/src/schema.js"
click node_src_resolvers "https://github.com/liamosycka/covamat/blob/main/src/resolvers.js"
click node_src_config_db "https://github.com/liamosycka/covamat/blob/main/src/config/db.js"
click node_src_schemas_case "https://github.com/liamosycka/covamat/blob/main/src/schemas/case.js"
click node_src_schemas_datasheet "https://github.com/liamosycka/covamat/blob/main/src/schemas/datasheet.js"
click node_src_schemas_datasheet_instance "https://github.com/liamosycka/covamat/blob/main/src/schemas/datasheetInstance.js"
click node_src_schemas_domain "https://github.com/liamosycka/covamat/blob/main/src/schemas/domain.js"
click node_src_schemas_variation "https://github.com/liamosycka/covamat/blob/main/src/schemas/variation.js"
click node_src_schemas_variation_point "https://github.com/liamosycka/covamat/blob/main/src/schemas/variationPoint.js"
click node_src_schemas_variety_type "https://github.com/liamosycka/covamat/blob/main/src/schemas/varietyType.js"
click node_src_resolvers_case "https://github.com/liamosycka/covamat/blob/main/src/resolvers/case.js"
click node_src_resolvers_datasheet "https://github.com/liamosycka/covamat/blob/main/src/resolvers/datasheet.js"
click node_src_resolvers_datasheet_instance "https://github.com/liamosycka/covamat/blob/main/src/resolvers/datasheetInstance.js"
click node_src_entities_case "https://github.com/liamosycka/covamat/blob/main/src/entities/case.js"
click node_src_entities_datasheet "https://github.com/liamosycka/covamat/blob/main/src/entities/datasheet.js"
click node_src_entities_datasheet_instance "https://github.com/liamosycka/covamat/blob/main/src/entities/datasheetInstance.js"

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_src_index toneBlue
class node_src_schema,node_src_resolvers,node_src_resolvers_case,node_src_resolvers_datasheet,node_src_resolvers_datasheet_instance toneAmber
class node_src_schemas_case,node_src_schemas_datasheet,node_src_schemas_datasheet_instance,node_src_schemas_domain,node_src_schemas_variation,node_src_schemas_variation_point,node_src_schemas_variety_type toneMint
class node_src_entities_case,node_src_entities_datasheet,node_src_entities_datasheet_instance toneRose
class node_src_config_db toneIndigo
```

## Components

### Bootstrap

Application startup and wiring

- [Server start](https://github.com/liamosycka/covamat/blob/main/src/index.js): bootstrap · Application entrypoint that starts the GraphQL server and wires configuration to the API and database. · `src/index.js`

### GraphQL API

Schema and resolver composition

- [Schema compose](https://github.com/liamosycka/covamat/blob/main/src/schema.js): graphql composition · Assembles the executable GraphQL schema from domain schema modules. · `src/schema.js`
- [Resolvers compose](https://github.com/liamosycka/covamat/blob/main/src/resolvers.js): resolver composition · Combines per-entity resolver modules into the API resolver map. · `src/resolvers.js`
- [Case resolver](https://github.com/liamosycka/covamat/blob/main/src/resolvers/case.js): resolver · Resolver boundary for case queries and mutations. · `src/resolvers/case.js`
- [Datasheet resolver](https://github.com/liamosycka/covamat/blob/main/src/resolvers/datasheet.js): resolver · Resolver boundary for datasheet operations. · `src/resolvers/datasheet.js`
- [Instance resolver](https://github.com/liamosycka/covamat/blob/main/src/resolvers/datasheetInstance.js): resolver · Resolver boundary for datasheet instance operations. · `src/resolvers/datasheetInstance.js`

### Domain model

GraphQL types by business concept

- [Case type](https://github.com/liamosycka/covamat/blob/main/src/schemas/case.js): schema · GraphQL schema for cases. · `src/schemas/case.js`
- [Datasheet type](https://github.com/liamosycka/covamat/blob/main/src/schemas/datasheet.js): schema · GraphQL schema for datasheets. · `src/schemas/datasheet.js`
- [Instance type](https://github.com/liamosycka/covamat/blob/main/src/schemas/datasheetInstance.js): schema · GraphQL schema for datasheet instances. · `src/schemas/datasheetInstance.js`
- [Domain type](https://github.com/liamosycka/covamat/blob/main/src/schemas/domain.js): schema · GraphQL schema for domain concepts. · `src/schemas/domain.js`
- [Variation type](https://github.com/liamosycka/covamat/blob/main/src/schemas/variation.js): schema · GraphQL schema for variations. · `src/schemas/variation.js`
- [Variation point](https://github.com/liamosycka/covamat/blob/main/src/schemas/variationPoint.js): schema · GraphQL schema for variation points. · `src/schemas/variationPoint.js`
- [Variety type](https://github.com/liamosycka/covamat/blob/main/src/schemas/varietyType.js): schema · GraphQL schema for variety types. · `src/schemas/varietyType.js`

### Persistence

Entity abstractions for stored records

- [Case entity](https://github.com/liamosycka/covamat/blob/main/src/entities/case.js): model · Persistence-facing abstraction for case records. · `src/entities/case.js`
- [Datasheet entity](https://github.com/liamosycka/covamat/blob/main/src/entities/datasheet.js): model · Persistence-facing abstraction for datasheet records. · `src/entities/datasheet.js`
- [Instance entity](https://github.com/liamosycka/covamat/blob/main/src/entities/datasheetInstance.js): model · Persistence-facing abstraction for datasheet instance records. · `src/entities/datasheetInstance.js`

### Infrastructure

Database configuration and connection

- [DB config](https://github.com/liamosycka/covamat/blob/main/src/config/db.js): db setup · Isolates datastore configuration and connection setup. · `src/config/db.js`

## Connections

- Server start → DB config: connects · Bootstraps datastore access before serving requests.
- Server start → Schema compose: loads · Starts the server with the composed GraphQL schema.
- Server start → Resolvers compose: loads · Wires resolver implementations into the API.
- Schema compose → Case type: includes · Composes the case type into the executable schema.
- Schema compose → Datasheet type: includes · Composes the datasheet type into the executable schema.
- Schema compose → Instance type: includes · Composes the datasheet instance type into the executable schema.
- Schema compose → Domain type: includes · Includes domain-related type definitions.
- Schema compose → Variation type: includes · Includes variation-related type definitions.
- Schema compose → Variation point: includes · Includes variation point type definitions.
- Schema compose → Variety type: includes · Includes variety type definitions.
- Resolvers compose → Case resolver: merges · Composes the case resolver module.
- Resolvers compose → Datasheet resolver: merges · Composes the datasheet resolver module.
- Resolvers compose → Instance resolver: merges · Composes the datasheet instance resolver module.
- Case resolver → Case entity: uses · Reads and writes case records through the model layer.
- Datasheet resolver → Datasheet entity: uses · Reads and writes datasheet records through the model layer.
- Instance resolver → Instance entity: uses · Reads and writes datasheet instance records through the model layer.
- Case resolver → DB config: depends on · Relies on the configured datastore connection.
- Datasheet resolver → DB config: depends on · Relies on the configured datastore connection.
- Instance resolver → DB config: depends on · Relies on the configured datastore connection.
