# aryan-0543/fastdoc architecture

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

- Interactive diagram: https://gitdiagram.com/aryan-0543/fastdoc
- Repository: https://github.com/aryan-0543/fastdoc

## Overview

#### Purpose and Entry Point
This is a server-rendered document application centered on uploaded documents, persisted metadata, and document viewing. The primary application entry point is `main.py`, with application data and persistence likely organized around `database.py`, `models.py`, and `schemas.py`.

#### Application / Request Layer
`main.py` is the control boundary for HTTP handling: it likely wires routes, template rendering, upload handling, persistence operations, and error responses. The UI is rendered from server-side templates rather than a separate frontend application.
- `main.py`
- `templates/layout.html`
- `templates/error.html`

#### Persistence Model
Database setup is isolated in `database.py`; persistent domain entities are defined in `models.py`; request/response or validation shapes are separated into `schemas.py`. The checked-in SQLite database indicates a local embedded persistence runtime rather than a managed external database.
- `database.py`
- `models.py`
- `schemas.py`
- `fastdoc.db`

#### Document Lifecycle
Uploaded source files are stored under `uploads/`, while their associated records are expected to be represented in the database model. The document detail template forms the viewing endpoint of this flow: upload/create → persist file and metadata → list by user → render document detail.
- `uploads/6.pdf`
- `templates/doc.html`
- `templates/user_documents.html`

#### Presentation and User-Facing Flows
The home page is the likely public landing/upload surface; authenticated or user-scoped document browsing is represented by the user-documents page. Shared page structure is centralized in the layout template, establishing a consistent server-rendered UI boundary.
- `templates/home.html`
- `templates/user_documents.html`
- `templates/layout.html`

#### Static Asset Boundary
Browser assets are served from `static/`, including global styling, client-side utility code, icons, profile images, and a web manifest. These assets support the rendered templates but are separate from the backend persistence and document-storage paths.
- `static/css/main.css`
- `static/js/utils.js`
- `static/site.webmanifest`
- `static/profile_pics`

#### Material Runtime and Infrastructure
The repository appears to run as a single Python web process backed by local filesystem storage and SQLite. There is no evidence in the provided tree of external cloud storage, queueing, separate API services, or a bundled frontend build system. The main operational boundaries are HTTP application code, SQLite persistence, template rendering, static serving, and local uploaded-file storage.
- `main.py`
- `fastdoc.db`
- `uploads`
- `static`

Main entry points: [`main.py`](https://github.com/aryan-0543/fastdoc/blob/main/main.py) (HTTP application), [`templates/layout.html`](https://github.com/aryan-0543/fastdoc/blob/main/templates/layout.html) (Shared layout), [`templates/user_documents.html`](https://github.com/aryan-0543/fastdoc/blob/main/templates/user_documents.html) (User document list), [`templates/doc.html`](https://github.com/aryan-0543/fastdoc/blob/main/templates/doc.html) (Document detail)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Python web app"]
  node_main["HTTP application<br/>Python entry point<br/>[main.py]"]
  node_schemas["Validation schemas<br/>data contracts<br/>[schemas.py]"]
  node_models["Document models<br/>domain entities<br/>[models.py]"]
  node_database["Database setup<br/>persistence adapter<br/>[database.py]"]
end

subgraph group_presentation["Server-rendered UI"]
  node_layout["Shared layout<br/>template<br/>[layout.html]"]
  node_home["Home and upload<br/>template<br/>[home.html]"]
  node_user_documents["User document list<br/>template"]
  node_document_detail["Document detail<br/>template<br/>[doc.html]"]
  node_error["Error page<br/>template<br/>[error.html]"]
  node_static["Static assets<br/>browser assets"]
end

subgraph group_storage["Local persistence"]
  node_sqlite[("SQLite database<br/>embedded database<br/>[fastdoc.db]")]
  node_uploads["Uploaded files<br/>filesystem storage"]
end

node_main -->|"validates input"| node_schemas
node_main -->|"uses entities"| node_models
node_main -->|"accesses persistence"| node_database
node_database -->|"connects to"| node_sqlite
node_models -->|"persists metadata"| node_sqlite
node_main -->|"stores uploads"| node_uploads
node_main -->|"renders"| node_home
node_main -->|"renders"| node_user_documents
node_main -->|"renders"| node_document_detail
node_main -->|"renders failures"| node_error
node_home -->|"uses"| node_layout
node_user_documents -->|"uses"| node_layout
node_document_detail -->|"uses"| node_layout
node_error -->|"uses"| node_layout
node_main -->|"serves"| node_static
node_user_documents -.->|"lists records"| node_sqlite
node_document_detail -.->|"views file"| node_uploads

click node_main "https://github.com/aryan-0543/fastdoc/blob/main/main.py"
click node_schemas "https://github.com/aryan-0543/fastdoc/blob/main/schemas.py"
click node_models "https://github.com/aryan-0543/fastdoc/blob/main/models.py"
click node_database "https://github.com/aryan-0543/fastdoc/blob/main/database.py"
click node_layout "https://github.com/aryan-0543/fastdoc/blob/main/templates/layout.html"
click node_home "https://github.com/aryan-0543/fastdoc/blob/main/templates/home.html"
click node_user_documents "https://github.com/aryan-0543/fastdoc/blob/main/templates/user_documents.html"
click node_document_detail "https://github.com/aryan-0543/fastdoc/blob/main/templates/doc.html"
click node_error "https://github.com/aryan-0543/fastdoc/blob/main/templates/error.html"
click node_static "https://github.com/aryan-0543/fastdoc/tree/main/static"
click node_sqlite "https://github.com/aryan-0543/fastdoc/blob/main/fastdoc.db"
click node_uploads "https://github.com/aryan-0543/fastdoc/tree/main/uploads"

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_main,node_schemas,node_models,node_database toneBlue
class node_layout,node_home,node_user_documents,node_document_detail,node_error,node_static toneAmber
class node_sqlite,node_uploads toneMint
```

## Components

### Python web app

- [HTTP application](https://github.com/aryan-0543/fastdoc/blob/main/main.py): Python entry point · Handles routes, uploads, rendering, and errors. · `main.py`
- [Validation schemas](https://github.com/aryan-0543/fastdoc/blob/main/schemas.py): data contracts · `schemas.py`
- [Document models](https://github.com/aryan-0543/fastdoc/blob/main/models.py): domain entities · `models.py`
- [Database setup](https://github.com/aryan-0543/fastdoc/blob/main/database.py): persistence adapter · `database.py`

### Server-rendered UI

- [Shared layout](https://github.com/aryan-0543/fastdoc/blob/main/templates/layout.html): template · `templates/layout.html`
- [Home and upload](https://github.com/aryan-0543/fastdoc/blob/main/templates/home.html): template · `templates/home.html`
- [User document list](https://github.com/aryan-0543/fastdoc/blob/main/templates/user_documents.html): template · `templates/user_documents.html`
- [Document detail](https://github.com/aryan-0543/fastdoc/blob/main/templates/doc.html): template · `templates/doc.html`
- [Error page](https://github.com/aryan-0543/fastdoc/blob/main/templates/error.html): template · `templates/error.html`
- [Static assets](https://github.com/aryan-0543/fastdoc/tree/main/static): browser assets · `static`

### Local persistence

- [SQLite database](https://github.com/aryan-0543/fastdoc/blob/main/fastdoc.db): embedded database · Stores document metadata and related records. · `fastdoc.db`
- [Uploaded files](https://github.com/aryan-0543/fastdoc/tree/main/uploads): filesystem storage · Stores document source files. · `uploads`

## Connections

- HTTP application → Validation schemas: validates input
- HTTP application → Document models: uses entities
- HTTP application → Database setup: accesses persistence
- Database setup → SQLite database: connects to
- Document models → SQLite database: persists metadata
- HTTP application → Uploaded files: stores uploads
- HTTP application → Home and upload: renders
- HTTP application → User document list: renders
- HTTP application → Document detail: renders
- HTTP application → Error page: renders failures
- Home and upload → Shared layout: uses
- User document list → Shared layout: uses
- Document detail → Shared layout: uses
- Error page → Shared layout: uses
- HTTP application → Static assets: serves
- User document list → SQLite database: lists records
- Document detail → Uploaded files: views file
