# nojusgencas/miesto-bibliotekos-sistema architecture

> Architecture diagram of the GitHub repository nojusgencas/miesto-bibliotekos-sistema, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nojusgencas/miesto-bibliotekos-sistema
- Repository: https://github.com/nojusgencas/miesto-bibliotekos-sistema

## Overview

Miesto bibliotekos sistema lets readers browse a categorized book catalog, sign in, reserve available copies, and manage loans; administrators maintain books, categories, users, and reservation oversight. The React client issues GraphQL queries and mutations through Apollo, while Express hosts Apollo Server, whose resolvers enforce roles and delegate catalog, account, and loan operations to services backed by MongoDB models. Startup seeds an initial administrator and catalog. Unsampled UI and startup details are represented only where documented or visible in the excerpts.

Main entry points: [`server/schema.js`](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/schema.js) (Resolvers and access), [`server/models.js`](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/models.js) (Library data models), [`src/App.jsx`](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/App.jsx) (Library interface), [`src/main.jsx`](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/main.jsx) (Apollo client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Reader and admin UI"]
  node_app["Library interface<br/>[App.jsx]"]
  node_catalogui["Catalog browsing<br/>[App.jsx]"]
  node_loansui["My reservations<br/>[App.jsx]"]
  node_adminui["Admin management<br/>[App.jsx]"]
  node_apollo["Apollo client<br/>[main.jsx]"]
end

subgraph group_api["GraphQL and identity"]
  node_graphql["GraphQL API<br/>[index.js]"]
  node_resolvers["Resolvers and access<br/>[schema.js]"]
  node_auth["JWT authentication<br/>[schema.js]"]
end

subgraph group_domain["Library operations"]
  node_catalog["Catalog service<br/>[services.js]"]
  node_users["User service<br/>[services.js]"]
  node_reservations["Reservation service<br/>[services.js]"]
  node_bootstrap["Initial admin and catalog<br/>[index.js]"]
end

subgraph group_storage["MongoDB persistence"]
  node_models["Library data models<br/>[models.js]"]
  node_mongodb[("MongoDB")]
end

node_reader(("Reader"))
node_administrator(("Administrator"))

node_reader -->|"uses"| node_app
node_administrator -->|"uses"| node_app
node_app -->|"queries and mutates"| node_apollo
node_apollo -->|"sends GraphQL"| node_graphql
node_graphql -->|"dispatches"| node_resolvers
node_resolvers -->|"verifies tokens"| node_auth
node_resolvers -->|"delegates catalog"| node_catalog
node_resolvers -->|"delegates users"| node_users
node_resolvers -->|"delegates loans"| node_reservations
node_resolvers -->|"reads account and loans"| node_models
node_catalog -->|"reads and writes"| node_models
node_users -->|"reads and writes"| node_models
node_reservations -->|"updates loans and copies"| node_models
node_bootstrap -->|"seeds records"| node_models
node_models -->|"persists"| node_mongodb

click node_app "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/App.jsx"
click node_catalogui "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/App.jsx"
click node_loansui "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/App.jsx"
click node_adminui "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/App.jsx"
click node_apollo "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/main.jsx"
click node_graphql "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/index.js"
click node_resolvers "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/schema.js"
click node_auth "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/schema.js"
click node_catalog "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/services.js"
click node_users "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/services.js"
click node_reservations "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/services.js"
click node_bootstrap "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/index.js"
click node_models "https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/models.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_app,node_catalogui,node_loansui,node_adminui,node_apollo toneBlue
class node_graphql,node_resolvers,node_auth toneAmber
class node_catalog,node_users,node_reservations,node_bootstrap toneMint
class node_models,node_mongodb toneRose
class node_reader,node_administrator toneIndigo
```

## Components

### Reader and admin UI

- [Library interface](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/App.jsx): `src/App.jsx`
- [Catalog browsing](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/App.jsx): `src/App.jsx`
- [My reservations](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/App.jsx): `src/App.jsx`
- [Admin management](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/App.jsx): `src/App.jsx`
- [Apollo client](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/src/main.jsx): `src/main.jsx`

### GraphQL and identity

- [GraphQL API](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/index.js): `server/index.js`
- [Resolvers and access](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/schema.js): `server/schema.js`
- [JWT authentication](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/schema.js): `server/schema.js`

### Library operations

- [Catalog service](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/services.js): `server/services.js`
- [User service](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/services.js): `server/services.js`
- [Reservation service](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/services.js): `server/services.js`
- [Initial admin and catalog](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/index.js): `server/index.js`

### MongoDB persistence

- [Library data models](https://github.com/nojusgencas/miesto-bibliotekos-sistema/blob/main/server/models.js): `server/models.js`
- **MongoDB**

### Other components

- **Reader**
- **Administrator**

## Connections

- Reader → Library interface: uses (evidence: `README.md`)
- Administrator → Library interface: uses (evidence: `README.md`)
- Library interface → Apollo client: queries and mutates (evidence: `src/App.jsx`)
- Apollo client → GraphQL API: sends GraphQL (evidence: `src/main.jsx`)
- GraphQL API → Resolvers and access: dispatches (evidence: `server/index.js`)
- Resolvers and access → JWT authentication: verifies tokens (evidence: `server/schema.js`)
- Resolvers and access → Catalog service: delegates catalog (evidence: `server/schema.js`)
- Resolvers and access → User service: delegates users (evidence: `server/schema.js`)
- Resolvers and access → Reservation service: delegates loans (evidence: `server/schema.js`)
- Resolvers and access → Library data models: reads account and loans (evidence: `server/schema.js`)
- Catalog service → Library data models: reads and writes (evidence: `server/services.js`)
- User service → Library data models: reads and writes (evidence: `server/services.js`)
- Reservation service → Library data models: updates loans and copies (evidence: `server/services.js`)
- Initial admin and catalog → Library data models: seeds records (evidence: `server/index.js`)
- Library data models → MongoDB: persists (evidence: `README.md`)
