# jayanthan-amalanathan/batticloa-library-management-system architecture

> Architecture diagram of the GitHub repository jayanthan-amalanathan/batticloa-library-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jayanthan-amalanathan/batticloa-library-management-system
- Repository: https://github.com/jayanthan-amalanathan/batticloa-library-management-system

## Overview

Batticaloa Public Library is an integrated library-management and digital-library platform. The principal visible workflow is browsing books and events in the public site, which requests catalog data from the server and displays results; authenticated staff can also manage DLP synchronization. The backend centralizes API routes and uses shared authentication and database modules. The source index identifies additional public workflows and domain modules, but their detailed calls are not shown in the excerpts, so those connections are omitted. PDF.js is included as a document-viewing capability; its integration with library content is not established here.

Main entry points: [`server/index.js`](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/index.js) (HTTP API), [`server/db.js`](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/db.js) (Library database), [`server/dlpSync.js`](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/dlpSync.js) (DLP synchronization), [`public/js/home.js`](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/home.js) (Home experience)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public experience"]
  node_home["Home experience<br/>[home.js]"]
  node_shared["Shared interface<br/>[app.js]"]
  node_catalog["Book catalog<br/>[catalog.js]"]
  node_events["Events pages<br/>[events.js]"]
  node_account["Sign-in and registration<br/>[login.js]"]
  node_member["Member dashboard<br/>[dashboard.js]"]
  node_chat["Library chat<br/>[chat.js]"]
  node_contact["Contact requests<br/>[contact.js]"]
  node_document["PDF viewer<br/>[viewer.mjs]"]
end

subgraph group_operations["Library operations"]
  node_admin["Staff administration<br/>[admin.js]"]
end

subgraph group_backend["Backend services"]
  node_api["HTTP API<br/>[index.js]"]
  node_entry["Serverless entry<br/>[index.js]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_seed["Initial data seeding<br/>[seed.js]"]
end

subgraph group_storage["Data and integration"]
  node_db[("Library database<br/>[db.js]")]
  node_sync["DLP synchronization<br/>[dlpSync.js]"]
end

node_visitor(("Library visitor"))
node_staff(("Library staff"))
node_dlp{{"Digital library service"}}

node_visitor -.->|"opens"| node_home
node_home -->|"requests books and events"| node_api
node_api -->|"queries data"| node_db
node_entry -->|"forwards requests"| node_api
node_api -->|"imports authentication"| node_auth
node_auth -->|"checks sessions"| node_db
node_api -->|"imports sync service"| node_sync
node_sync -->|"reads and writes sync data"| node_db
node_sync -->|"fetches catalog records"| node_dlp
node_staff -.->|"uses"| node_admin
node_admin -->|"requests sync status and starts sync"| node_api
node_seed -->|"inserts initial records"| node_db

click node_home "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/home.js"
click node_shared "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/app.js"
click node_catalog "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/catalog.js"
click node_events "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/events.js"
click node_account "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/login.js"
click node_member "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/dashboard.js"
click node_chat "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/chat.js"
click node_contact "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/contact.js"
click node_document "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/pdfjs/web/viewer.mjs"
click node_admin "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/admin.js"
click node_api "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/index.js"
click node_entry "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/api/index.js"
click node_auth "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/auth.js"
click node_seed "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/seed.js"
click node_db "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/db.js"
click node_sync "https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/dlpSync.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_home,node_shared,node_catalog,node_events,node_account,node_member,node_chat,node_contact,node_document toneBlue
class node_admin toneAmber
class node_api,node_entry,node_auth,node_seed toneMint
class node_db,node_sync toneRose
class node_visitor,node_staff,node_dlp toneIndigo
```

## Components

### Public experience

- [Home experience](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/home.js): `public/js/home.js`
- [Shared interface](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/app.js): `public/js/app.js`
- [Book catalog](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/catalog.js): `public/js/catalog.js`
- [Events pages](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/events.js): `public/js/events.js`
- [Sign-in and registration](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/login.js): `public/js/login.js`
- [Member dashboard](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/dashboard.js): `public/js/dashboard.js`
- [Library chat](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/chat.js): `public/js/chat.js`
- [Contact requests](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/contact.js): `public/js/contact.js`
- [PDF viewer](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/pdfjs/web/viewer.mjs): `public/pdfjs/web/viewer.mjs`

### Library operations

- [Staff administration](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/public/js/admin.js): `public/js/admin.js`

### Backend services

- [HTTP API](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/index.js): `server/index.js`
- [Serverless entry](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/api/index.js): `api/index.js`
- [Authentication](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/auth.js): `server/auth.js`
- [Initial data seeding](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/seed.js): `server/seed.js`

### Data and integration

- [Library database](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/db.js): `server/db.js`
- [DLP synchronization](https://github.com/jayanthan-amalanathan/batticloa-library-management-system/blob/main/server/dlpSync.js): `server/dlpSync.js`

### Other components

- **Library visitor**
- **Library staff**
- **Digital library service**

## Connections

- Library visitor → Home experience: opens
- Home experience → HTTP API: requests books and events (evidence: `public/js/home.js`)
- HTTP API → Library database: queries data (evidence: `server/index.js`)
- Serverless entry → HTTP API: forwards requests (evidence: `api/index.js`)
- HTTP API → Authentication: imports authentication (evidence: `server/index.js`)
- Authentication → Library database: checks sessions (evidence: `server/auth.js`)
- HTTP API → DLP synchronization: imports sync service (evidence: `server/index.js`)
- DLP synchronization → Library database: reads and writes sync data (evidence: `server/dlpSync.js`)
- DLP synchronization → Digital library service: fetches catalog records (evidence: `server/dlpSync.js`)
- Library staff → Staff administration: uses
- Staff administration → HTTP API: requests sync status and starts sync (evidence: `public/js/admin.js`)
- Initial data seeding → Library database: inserts initial records (evidence: `server/seed.js`)
