# utpal-kalita/cs50-web-wiki architecture

> Architecture diagram of the GitHub repository utpal-kalita/cs50-web-wiki, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/utpal-kalita/cs50-web-wiki
- Repository: https://github.com/utpal-kalita/cs50-web-wiki

## Overview

##### Project type and purpose
- From the name “CS50-Web-wiki” (and typical CS50 web assignments) this is a full-stack web application: a simple wiki platform allowing users to register/log in, create and edit pages, upload assets, and view page history.

##### (implied) file structure
- Top-level “application” code (e.g., app.py or application.py) implementing Flask route handlers.
- A “templates/” directory with Jinja2 HTML templates.
- A “static/” directory for CSS, JavaScript, and image assets.
- A SQLite database file (e.g., wiki.db) storing user credentials, page contents, and revision history.
- Possibly helper modules (e.g., helpers.py for CS50 library calls) and configuration files (requirements.txt, .env).

##### README for additional insights
- Title only: no architectural notes. We therefore proceed based on standard CS50-wiki patterns.

##### Detail without overthinking
- How they each interact with the database.
- Third-party services (e.g., CDN for Bootstrap, if used).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client" 
        direction TB
        Browser["Web Browser"]:::frontend
        StaticAssets["Static Assets<br/>(CSS/JS)"]:::frontend
        ClientScripts["Client-side Scripts<br/>(WYSIWYG Editor)"]:::frontend
    end

    %% Server Layer
    subgraph "Server"
        direction TB
        ReverseProxy["Reverse Proxy / Web Server<br/>(Nginx/Apache)"]:::backend

        subgraph "Flask Application<br/>(Python, CS50 Library)"
            direction TB
            Controllers["Controllers<br/>(Auth, Page, History)"]:::backend
            Views["Jinja2 Templates"]:::backend
            Models["Models<br/>(SQLite Access)"]:::backend
        end

        subgraph "Data Storage"
            direction TB
            Database["SQLite Database"]:::storage
            FileStore["File System Store<br/>(Uploads)"]:::storage
        end
    end

    %% Flows
    Browser -->|"HTTP GET/POST"| ReverseProxy
    ReverseProxy -->|"Forward Request"| Controllers
    Controllers -->|"Query/Update"| Models
    Models -->|"SQL SELECT/INSERT"| Database
    Models -->|"File Save/Delete"| FileStore
    Database -->|"Result Set"| Models
    FileStore -->|"File Path"| Models
    Models -->|"Data"| Views
    Views -->|"Rendered HTML"| ReverseProxy
    ReverseProxy -->|"HTTP Response"| Browser

    %% Static asset flow
    Browser -->|"Request Assets"| StaticAssets
    StaticAssets -->|"Serve Files"| Browser

    %% AJAX/API calls
    Browser -->|"AJAX /api/*"| ReverseProxy

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef storage fill:#FFA500,stroke:#333,stroke-width:1px
```
