# orussy/orlibra architecture

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

- Interactive diagram: https://gitdiagram.com/orussy/orlibra
- Repository: https://github.com/orussy/orlibra

## Overview

##### Project type and purpose
- This is a full-stack web application (Node.js + Express) serving a library management interface (“ORlibra”).
- It uses server-side rendering (EJS templates), Mongoose models (MongoDB), and Firebase Admin SDK for authentication or push messages.

##### File structure
- Top-level:
- app.js            → entry point, configures Express, routes, middleware
- firebaseconfig.js → Firebase Admin initialization
- models/           → Mongoose schemas (book.js, user.js)
- views/            → EJS templates for admin, student, book pages
- public/           → static assets: CSS, JS, fonts, images, vendor
- No separate “controllers” directory: routes and handlers are likely in app.js.
- Package.json lists dependencies, build scripts if any.
- There is a data.txt and a Firebase service account JSON.

##### README
- README just names the project: “ORlibra.” No extra architectural notes, so infer from code.

##### Detail
- Model layer separately (User, Book).

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph "Client Browser"
    StudentUI["Student UI"]:::client
    AdminUI["Admin UI"]:::client
  end

  subgraph "Public Assets (public/)"
    CSS["CSS\n(public/css/)"]:::static
    JS["JS\n(public/js/main.js)"]:::static
    Fonts["Fonts\n(public/fonts/)"]:::static
    Images["Images\n(public/images/)"]:::static
    Vendor["Vendor\n(public/vendor/)"]:::static
  end

  subgraph "Client-only Views (public/views/)"
    AddBook["addbook.html"]:::client
    Index["index.html"]:::client
    Signup["signup.html"]:::client
    Test["test.html"]:::client
  end

  StaticAssetsServer["Static Assets Server"]:::static

  subgraph "Express Application"
    App["Routing & Middleware\n(app.js)"]:::server
    ViewEngine["EJS View Engine"]:::server
    subgraph "Mongoose Models"
      BookModel["Book Model\n(models/book.js)"]:::db
      UserModel["User Model\n(models/user.js)"]:::db
    end
  end

  MongoDB["MongoDB (Database)"]:::db
  FirebaseAdmin["Firebase Admin SDK\n(firebaseconfig.js)"]:::external
  ServiceAccount["Service Account JSON\n(corpro-...json)"]:::external

  subgraph "Project Files"
    PKG["package.json"]:::meta
    PKGLock["package-lock.json"]:::meta
    DataFile["data.txt"]:::meta
    Readme["README.md"]:::meta
    GitIgnore[".gitignore"]:::meta
  end

  %% Client interactions
  StudentUI -->|"GET /views/addbook.html"| AddBook
  StudentUI -->|"GET /views/index.html"| Index
  StudentUI -->|"GET /views/signup.html"| Signup
  StudentUI -->|"GET /views/test.html"| Test
  StudentUI -->|"GET CSS/JS/Images"| CSS
  StudentUI -->|"GET CSS/JS/Images"| JS
  StudentUI -->|"GET CSS/JS/Images"| Fonts
  StudentUI -->|"GET CSS/JS/Images"| Images
  StudentUI -->|"GET CSS/JS/Images"| Vendor

  AdminUI -->|"GET CSS/JS/Images"| CSS
  AdminUI -->|"GET CSS/JS/Images"| JS
  AdminUI -->|"GET CSS/JS/Images"| Fonts
  AdminUI -->|"GET CSS/JS/Images"| Images
  AdminUI -->|"GET CSS/JS/Images"| Vendor

  StudentUI -->|"HTTP GET/POST"| App
  AdminUI -->|"HTTP GET/POST"| App

  %% Express flows
  App -->|"Render Templates"| ViewEngine
  ViewEngine -->|"HTML Responses"| StudentUI
  ViewEngine -->|"HTML Responses"| AdminUI

  App -->|"Query/Update"| BookModel
  App -->|"Query/Update"| UserModel
  BookModel -->|"MongoDB Queries"| MongoDB
  UserModel -->|"MongoDB Queries"| MongoDB

  App -->|"Auth/Push"| FirebaseAdmin
  FirebaseAdmin -->|"Uses Credentials"| ServiceAccount

  %% Metadata
  App --> PKG
  App --> PKGLock
  App --> DataFile
  App --> Readme
  App --> GitIgnore

  %% Click Events
  click App "https://github.com/orussy/orlibra/blob/main/app.js"
  click FirebaseAdmin "https://github.com/orussy/orlibra/blob/main/firebaseconfig.js"
  click ServiceAccount "https://github.com/orussy/orlibra/blob/main/corpro-4ef2e-firebase-adminsdk-ahpv2-dac99b84f4.json"
  click BookModel "https://github.com/orussy/orlibra/blob/main/models/book.js"
  click UserModel "https://github.com/orussy/orlibra/blob/main/models/user.js"
  click AddBook "https://github.com/orussy/orlibra/blob/main/public/views/addbook.html"
  click Index "https://github.com/orussy/orlibra/blob/main/public/views/index.html"
  click Signup "https://github.com/orussy/orlibra/blob/main/public/views/signup.html"
  click Test "https://github.com/orussy/orlibra/blob/main/public/views/test.html"
  click CSS "https://github.com/orussy/orlibra/tree/main/public/css/"
  click JS "https://github.com/orussy/orlibra/blob/main/public/js/main.js"
  click Fonts "https://github.com/orussy/orlibra/tree/main/public/fonts/"
  click Images "https://github.com/orussy/orlibra/tree/main/public/images/"
  click Vendor "https://github.com/orussy/orlibra/tree/main/public/vendor/"
  click PKG "https://github.com/orussy/orlibra/blob/main/package.json"
  click PKGLock "https://github.com/orussy/orlibra/blob/main/package-lock.json"
  click DataFile "https://github.com/orussy/orlibra/blob/main/data.txt"
  click Readme "https://github.com/orussy/orlibra/blob/main/README.md"
  click GitIgnore "https://github.com/orussy/orlibra/blob/main/.gitignore"

  classDef client fill:#d0e7ff,stroke:#0366d6
  classDef server fill:#d6f5d6,stroke:#22863a
  classDef db fill:#ffe8a1,stroke:#d73a49
  classDef external fill:#f0e1ff,stroke:#6f42c1
  classDef static fill:#fff5b1,stroke:#e36209
  classDef meta fill:#f1f8ff,stroke:#24292e
```
