# sandeep1098-pil/3d-printing-model architecture

> Architecture diagram of the GitHub repository sandeep1098-pil/3d-printing-model, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sandeep1098-pil/3d-printing-model
- Repository: https://github.com/sandeep1098-pil/3d-printing-model

## Overview

This is a Flask web app for authenticated 3D-printing filament prediction. Users register or sign in, submit print parameters, and receive a PLA/ABS result; protected home and about pages and logout support the surrounding experience. The sampled app.py shows MySQL access, cookie-based JWT checks, feature scaling, model inference, and result rendering. This differs from the README’s SQLite description: the sampled implementation configures MySQL. Training and deployment files are excluded; unsampled template behavior is represented only where documented.

Main entry points: [`flask/app.py`](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py) (Flask routes), [`flask/templates/auth.html`](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/auth.html) (Login/register view), [`flask/templates/home.html`](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/home.html) (Prediction form), [`flask/templates/result.html`](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/result.html) (Result view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_routes["Flask routes<br/>[app.py]"]
  node_landing["Landing view<br/>[index.html]"]
  node_authview["Login/register view<br/>[auth.html]"]
  node_authjs["Auth interactions<br/>[auth.js]"]
  node_homeview["Prediction form<br/>[home.html]"]
  node_aboutview["About view<br/>[about.html]"]
  node_resultview["Result view<br/>[result.html]"]
end

subgraph group_identity["Identity"]
  node_authhandler["Authentication handler<br/>[app.py]"]
  node_guard["JWT access guard<br/>[app.py]"]
  node_tokens["Token creation and validation<br/>[app.py]"]
  node_userstore["User credential access<br/>[app.py]"]
  node_mysql[("MySQL user database")]
end

subgraph group_prediction["Prediction"]
  node_featureprep["Feature preparation<br/>[app.py]"]
  node_scaler["Feature scaler<br/>[Min_max_scaler.pkl]"]
  node_model["Material model<br/>[3d_printer.pkl]"]
  node_materialmap["Material mapping<br/>[app.py]"]
end

node_user(("Visitor"))

node_user -->|"requests pages"| node_routes
node_routes -->|"handles auth"| node_authhandler
node_authhandler -->|"checks or creates"| node_userstore
node_userstore -->|"reads and writes"| node_mysql
node_authhandler -->|"issues token"| node_tokens
node_guard -->|"validates token"| node_tokens
node_routes -->|"protects routes"| node_guard
node_routes -->|"renders"| node_landing
node_routes -->|"renders"| node_authview
node_routes -->|"renders"| node_homeview
node_routes -->|"renders"| node_aboutview
node_routes -->|"renders"| node_resultview
node_authview -.->|"uses interactions"| node_authjs
node_user -->|"submits parameters"| node_homeview
node_routes -->|"parses parameters"| node_featureprep
node_featureprep -->|"transforms features"| node_scaler
node_featureprep -->|"predicts material"| node_model
node_featureprep -->|"maps prediction"| node_materialmap
node_routes -->|"returns result"| node_resultview

click node_routes "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py"
click node_landing "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/index.html"
click node_authview "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/auth.html"
click node_authjs "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/static/js/auth.js"
click node_homeview "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/home.html"
click node_aboutview "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/about.html"
click node_resultview "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/result.html"
click node_authhandler "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py"
click node_guard "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py"
click node_tokens "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py"
click node_userstore "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py"
click node_featureprep "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py"
click node_scaler "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/Min_max_scaler.pkl"
click node_model "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/3d_printer.pkl"
click node_materialmap "https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py"

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_routes,node_landing,node_authview,node_authjs,node_homeview,node_aboutview,node_resultview toneBlue
class node_authhandler,node_guard,node_tokens,node_userstore,node_mysql toneAmber
class node_featureprep,node_scaler,node_model,node_materialmap toneMint
class node_user toneIndigo
```

## Components

### Web experience

- [Flask routes](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py): `flask/app.py`
- [Landing view](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/index.html): `flask/templates/index.html`
- [Login/register view](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/auth.html): `flask/templates/auth.html`
- [Auth interactions](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/static/js/auth.js): `flask/static/js/auth.js`
- [Prediction form](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/home.html): `flask/templates/home.html`
- [About view](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/about.html): `flask/templates/about.html`
- [Result view](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/templates/result.html): `flask/templates/result.html`

### Identity

- [Authentication handler](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py): `flask/app.py`
- [JWT access guard](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py): `flask/app.py`
- [Token creation and validation](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py): `flask/app.py`
- [User credential access](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py): `flask/app.py`
- **MySQL user database**

### Prediction

- [Feature preparation](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py): `flask/app.py`
- [Feature scaler](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/Min_max_scaler.pkl): `flask/Min_max_scaler.pkl`
- [Material model](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/3d_printer.pkl): `flask/3d_printer.pkl`
- [Material mapping](https://github.com/sandeep1098-pil/3d-printing-model/blob/main/flask/app.py): `flask/app.py`

### Other components

- **Visitor**

## Connections

- Visitor → Flask routes: requests pages (evidence: `README.md`)
- Flask routes → Authentication handler: handles auth (evidence: `flask/app.py`)
- Authentication handler → User credential access: checks or creates (evidence: `flask/app.py`)
- User credential access → MySQL user database: reads and writes (evidence: `flask/app.py`)
- Authentication handler → Token creation and validation: issues token (evidence: `flask/app.py`)
- JWT access guard → Token creation and validation: validates token (evidence: `flask/app.py`)
- Flask routes → JWT access guard: protects routes (evidence: `flask/app.py`)
- Flask routes → Landing view: renders (evidence: `flask/app.py`)
- Flask routes → Login/register view: renders (evidence: `flask/app.py`)
- Flask routes → Prediction form: renders (evidence: `flask/app.py`)
- Flask routes → About view: renders (evidence: `flask/app.py`)
- Flask routes → Result view: renders (evidence: `flask/app.py`)
- Login/register view → Auth interactions: uses interactions
- Visitor → Prediction form: submits parameters (evidence: `README.md`)
- Flask routes → Feature preparation: parses parameters (evidence: `flask/app.py`)
- Feature preparation → Feature scaler: transforms features (evidence: `flask/app.py`)
- Feature preparation → Material model: predicts material (evidence: `flask/app.py`)
- Feature preparation → Material mapping: maps prediction (evidence: `flask/app.py`)
- Flask routes → Result view: returns result (evidence: `flask/app.py`)
