# aditipatil38/shelforbit architecture

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

- Interactive diagram: https://gitdiagram.com/aditipatil38/shelforbit
- Repository: https://github.com/aditipatil38/shelforbit

## Overview

##### Project Type and Purpose
- This is a full-stack, interactive web application (“The ShelfOrbit”) for discovering, searching, and discussing books.
- It comprises three logically separated sub-systems:
a. A React.js single-page front end (book lists, details, and real-time chat)
b. A Django + Django REST Framework back end (serving book and library data via REST APIs, admin panel)
c. A Streamlit-based analytics module (in the `analytics/` folder) for offline recommendation workflows

##### File Structure Analysis
- Top-level directories:
- `frontend/` – React app with components `Chat.js`, `SignIn.js`, `Room.js`, etc.
- `backend/` – Django project (`booksproject`) containing:
– `firstbook/` app (models, serializers, views, templates for book & library)
– `db.sqlite3` (primary relational store)
- `analytics/` – Streamlit app (`app.py`) plus a local SQLite database (`25k.db`) and recommendation scripts.
- Key patterns:
- MVC on Django (models → serializers → views → templates)
- Component-based front end communicating via REST calls and Firebase real-time messaging
- Separate service for analytics recommendations

##### README Insights
- Tech stack: Python, Django, Django REST Framework, SQLite, Firebase (chat), React.js, Streamlit
- Features: personalized recommendations (genre/tag, author), search & similar books, real-time chat rooms, admin CMS

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        direction TB
        subgraph "React SPA" 
            direction TB
            Index["Index (frontend/src/index.js)"]:::frontend
            App["App (frontend/src/App.js)"]:::frontend
            SignIn["SignIn"]:::frontend
            Room["Room"]:::frontend
            SendMessage["SendMessage"]:::frontend
            Chat["Chat"]:::frontend
            SignOut["SignOut"]:::frontend
        end
        subgraph "Streamlit Analytics UI"
            direction TB
            AnalyticsApp["Analytics App (analytics/app.py)"]:::frontend
            GenrePage["Genre & Tag Page"]:::frontend
            AuthorPage["Author Page"]:::frontend
            SearchPage["Search Page"]:::frontend
            SimilarPage["Similar Books Page"]:::frontend
        end
    end

    %% API Layer
    subgraph "API Layer"
        direction TB
        subgraph "Django REST API" 
            direction TB
            Manage["manage.py"]:::backend
            Settings["settings.py"]:::backend
            URLs["urls.py"]:::backend
            WSGI["wsgi.py"]:::backend
            ASGI["asgi.py"]:::backend

            subgraph "firstbook App"
                direction TB
                Apps["apps.py"]:::backend
                Models["models.py"]:::backend
                Serializers["serializers.py"]:::backend
                Views["views.py"]:::backend
                AppURLs["urls.py"]:::backend
                AdminFile["admin.py"]:::backend
            end
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        SQLite["SQLite DB (db.sqlite3)"]:::database
        AnalyticsDB["Analytics DB (25k.db)"]:::database
        FirebaseDB["Firebase Realtime DB"]:::external
    end

    %% Connections
    %% User interactions
    UserBrowser["User Browser"]:::external
    UserBrowser -->|"HTTPS"| Index
    Index -->|loads| App
    App -->|Renders| SignIn
    App -->|Renders| Room
    App -->|Renders| SendMessage
    App -->|Renders| Chat
    App -->|Renders| SignOut

    %% React to API
    App -->|"HTTPS/JSON"| URLs
    URLs -->|routes to| Views
    Views -->|ORM Queries| Models
    Models -->|SQL| SQLite

    %% React to Firebase
    Chat -->|"WebSocket"| FirebaseDB
    FirebaseDB -->|"Real-time Updates"| Chat

    %% Analytics
    UserBrowser -->|"HTTPS"| AnalyticsApp
    AnalyticsApp -->|"Reads"| AnalyticsDB

    %% Django Admin
    AdminPanel["Django Admin"]:::backend
    Manage -->|starts| Settings
    Settings -->|configures| AdminPanel
    AdminPanel -->|CRUD| Models

    %% Click Events
    click Index "https://github.com/aditipatil38/shelforbit/blob/main/frontend/src/index.js"
    click App "https://github.com/aditipatil38/shelforbit/blob/main/frontend/src/App.js"
    click SignIn "https://github.com/aditipatil38/shelforbit/blob/main/frontend/src/components/SignIn.js"
    click Room "https://github.com/aditipatil38/shelforbit/blob/main/frontend/src/components/Room.js"
    click SendMessage "https://github.com/aditipatil38/shelforbit/blob/main/frontend/src/components/SendMessage.js"
    click Chat "https://github.com/aditipatil38/shelforbit/blob/main/frontend/src/components/Chat.js"
    click SignOut "https://github.com/aditipatil38/shelforbit/blob/main/frontend/src/components/SignOut.js"
    click AnalyticsApp "https://github.com/aditipatil38/shelforbit/blob/main/analytics/app.py"
    click GenrePage "https://github.com/aditipatil38/shelforbit/blob/main/analytics/pages/1_Recommend_Book(Genre & Tag).py"
    click AuthorPage "https://github.com/aditipatil38/shelforbit/blob/main/analytics/pages/2_Recommend_Books(Author).py"
    click SearchPage "https://github.com/aditipatil38/shelforbit/blob/main/analytics/pages/3_Search.py"
    click SimilarPage "https://github.com/aditipatil38/shelforbit/blob/main/analytics/pages/4_Similar.py"
    click Manage "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/manage.py"
    click Settings "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/booksproject/settings.py"
    click URLs "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/booksproject/urls.py"
    click WSGI "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/booksproject/wsgi.py"
    click ASGI "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/booksproject/asgi.py"
    click Apps "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/firstbook/apps.py"
    click Models "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/firstbook/models.py"
    click Serializers "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/firstbook/serializers.py"
    click Views "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/firstbook/views.py"
    click AppURLs "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/firstbook/urls.py"
    click AdminFile "https://github.com/aditipatil38/shelforbit/blob/main/backend/booksproject/firstbook/admin.py"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef database fill:#FFD580,stroke:#333,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:1px
```
