# kanigai2005/ip_deploy architecture

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

- Interactive diagram: https://gitdiagram.com/kanigai2005/ip_deploy
- Repository: https://github.com/kanigai2005/ip_deploy

## Overview

ProtoStruc is an AI-assisted engineering design platform. Users authenticate, create a project from a problem statement, then progress through functional decomposition, morphological analysis, and risk analysis, reviewing or updating each phase. The backend routes phase runs through a LangGraph workflow and persists project and phase data in Supabase. The README also identifies Supabase, JWT authentication, and a responsive dashboard as product capabilities. Some frontend-to-backend wiring and unsampled agent details are not shown, so those links are omitted or marked unverified.

Main entry points: [`backend/app/api/routes.py`](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/api/routes.py) (Project and phase endpoints), [`backend/app/api/auth.py`](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/api/auth.py) (Authentication endpoints), [`backend/app/ai/graph.py`](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/graph.py) (LangGraph workflow), [`backend/app/ai/agents/phase1_functional.py`](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/agents/phase1_functional.py) (Functional decomposition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Engineering dashboard"]
  node_login["Login and registration<br/>[page.tsx]"]
  node_register["Registration UI<br/>[page.tsx]"]
  node_auth_context["Auth context<br/>[AuthContext.tsx]"]
  node_dashboard["Phase dashboard<br/>[PhasesContent.tsx]"]
  node_phase_page["Phase page<br/>[page.tsx]"]
  node_sidebar["Responsive sidebar<br/>[sidebar.tsx]"]
  node_button["Button primitive<br/>[button.tsx]"]
  node_sheet["Sheet primitive<br/>[sheet.tsx]"]
end

subgraph group_api["API and identity"]
  node_api_entry["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication endpoints<br/>[auth.py]"]
  node_project_routes["Project and phase endpoints<br/>[routes.py]"]
end

subgraph group_workflow["Phase orchestration"]
  node_project_service["Project persistence<br/>[project_service.py]"]
  node_phase_service["Phase service<br/>[phase_service.py]"]
  node_graph["LangGraph workflow<br/>[graph.py]"]
  node_state["Engineering state<br/>[state.py]"]
end

subgraph group_design["Engineering analysis"]
  node_phase1["Functional decomposition"]
  node_phase2["Morphological analysis"]
  node_phase3["Risk analysis<br/>[phase3_risk.py]"]
  node_validators["Agent validators<br/>[validators.py]"]
  node_taxonomies["Functional taxonomies<br/>[taxonomies.py]"]
  node_risk_db["FMEA knowledge base<br/>[risk_databases.py]"]
end

subgraph group_platform["Shared services"]
  node_security["JWT and password security<br/>[security.py]"]
  node_email["Password reset email<br/>[email.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
  node_config["Service configuration<br/>[config.py]"]
end

node_engineer(("Engineer"))
node_supabase[("Supabase data store")]
node_groq{{"Groq language models"}}

node_engineer -->|"signs in"| node_login
node_engineer -->|"registers"| node_register
node_engineer -->|"reviews phases"| node_dashboard
node_phase_page -->|"renders"| node_dashboard
node_dashboard -.->|"calls API"| node_project_routes
node_login -.->|"uses auth"| node_auth_context
node_register -.->|"uses auth"| node_auth_context
node_sidebar -->|"renders mobile"| node_sheet
node_sidebar -->|"renders toggle"| node_button
node_api_entry -->|"registers router"| node_auth_routes
node_api_entry -->|"registers router"| node_project_routes
node_auth_routes -->|"hashes and signs"| node_security
node_auth_routes -->|"validates requests"| node_schemas
node_auth_routes -->|"sends reset email"| node_email
node_auth_routes -->|"reads and writes"| node_supabase
node_project_routes -->|"manages projects"| node_project_service
node_project_routes -->|"runs and updates"| node_phase_service
node_project_routes -->|"reads phase data"| node_supabase
node_project_routes -->|"validates requests"| node_schemas
node_project_service -->|"reads and writes"| node_supabase
node_phase_service -->|"runs workflow"| node_graph
node_phase_service -->|"restores and saves"| node_supabase
node_graph -->|"uses state"| node_state
node_graph -->|"dispatches phase one"| node_phase1
node_graph -->|"dispatches phase two"| node_phase2
node_graph -->|"dispatches phase three"| node_phase3
node_phase1 -->|"uses lookups"| node_taxonomies
node_phase1 -->|"uses result schema"| node_validators
node_phase2 -->|"uses result schema"| node_validators
node_phase3 -->|"uses risk lookup"| node_risk_db
node_phase3 -->|"uses result schema"| node_validators
node_phase1 -->|"loads model settings"| node_config
node_phase2 -->|"loads model settings"| node_config
node_phase3 -->|"loads model settings"| node_config
node_config -->|"creates client"| node_supabase
node_phase1 -->|"invokes model"| node_groq

click node_login "https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/app/login/page.tsx"
click node_register "https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/app/register/page.tsx"
click node_auth_context "https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/context/AuthContext.tsx"
click node_dashboard "https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/app/phases/all/PhasesContent.tsx"
click node_phase_page "https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/app/phases/all/page.tsx"
click node_sidebar "https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/components/ui/sidebar.tsx"
click node_button "https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/components/ui/button.tsx"
click node_sheet "https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/components/ui/sheet.tsx"
click node_api_entry "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/api/auth.py"
click node_project_routes "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/api/routes.py"
click node_security "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/core/security.py"
click node_email "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/core/email.py"
click node_schemas "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/models/schemas.py"
click node_project_service "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/services/project_service.py"
click node_phase_service "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/services/phase_service.py"
click node_graph "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/graph.py"
click node_state "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/state.py"
click node_phase1 "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/agents/phase1_functional.py"
click node_phase2 "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/agents/phase2_morphology.py"
click node_phase3 "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/agents/phase3_risk.py"
click node_validators "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/agents/validators.py"
click node_taxonomies "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/tools/taxonomies.py"
click node_risk_db "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/tools/risk_databases.py"
click node_config "https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/core/config.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_login,node_register,node_auth_context,node_dashboard,node_phase_page,node_sidebar,node_button,node_sheet toneBlue
class node_api_entry,node_auth_routes,node_project_routes,node_supabase toneAmber
class node_project_service,node_phase_service,node_graph,node_state toneMint
class node_phase1,node_phase2,node_phase3,node_validators,node_taxonomies,node_risk_db toneRose
class node_security,node_email,node_schemas,node_config,node_engineer,node_groq toneIndigo
```

## Components

### Engineering dashboard

- [Login and registration](https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/app/login/page.tsx): `frontend/src/app/login/page.tsx`
- [Registration UI](https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/app/register/page.tsx): `frontend/src/app/register/page.tsx`
- [Auth context](https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Phase dashboard](https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/app/phases/all/PhasesContent.tsx): `frontend/src/app/phases/all/PhasesContent.tsx`
- [Phase page](https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/app/phases/all/page.tsx): `frontend/src/app/phases/all/page.tsx`
- [Responsive sidebar](https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/components/ui/sidebar.tsx): `frontend/src/components/ui/sidebar.tsx`
- [Button primitive](https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/components/ui/button.tsx): `frontend/src/components/ui/button.tsx`
- [Sheet primitive](https://github.com/kanigai2005/ip_deploy/blob/main/frontend/src/components/ui/sheet.tsx): `frontend/src/components/ui/sheet.tsx`

### API and identity

- [FastAPI application](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication endpoints](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Project and phase endpoints](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`

### Phase orchestration

- [Project persistence](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/services/project_service.py): `backend/app/services/project_service.py`
- [Phase service](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/services/phase_service.py): `backend/app/services/phase_service.py`
- [LangGraph workflow](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/graph.py): `backend/app/ai/graph.py`
- [Engineering state](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/state.py): `backend/app/ai/state.py`

### Engineering analysis

- [Functional decomposition](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/agents/phase1_functional.py): `backend/app/ai/agents/phase1_functional.py`
- [Morphological analysis](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/agents/phase2_morphology.py): `backend/app/ai/agents/phase2_morphology.py`
- [Risk analysis](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/agents/phase3_risk.py): `backend/app/ai/agents/phase3_risk.py`
- [Agent validators](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/agents/validators.py): `backend/app/ai/agents/validators.py`
- [Functional taxonomies](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/tools/taxonomies.py): `backend/app/ai/tools/taxonomies.py`
- [FMEA knowledge base](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/ai/tools/risk_databases.py): `backend/app/ai/tools/risk_databases.py`

### Shared services

- [JWT and password security](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Password reset email](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/core/email.py): `backend/app/core/email.py`
- [API schemas](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/models/schemas.py): `backend/app/models/schemas.py`
- [Service configuration](https://github.com/kanigai2005/ip_deploy/blob/main/backend/app/core/config.py): `backend/app/core/config.py`

### Other components

- **Engineer**
- **Supabase data store**
- **Groq language models**

## Connections

- Engineer → Login and registration: signs in (evidence: `README.md`)
- Engineer → Registration UI: registers (evidence: `README.md`)
- Engineer → Phase dashboard: reviews phases (evidence: `README.md`)
- Phase page → Phase dashboard: renders (evidence: `frontend/src/app/phases/all/page.tsx`)
- Phase dashboard → Project and phase endpoints: calls API
- Login and registration → Auth context: uses auth
- Registration UI → Auth context: uses auth
- Responsive sidebar → Sheet primitive: renders mobile (evidence: `frontend/src/components/ui/sidebar.tsx`)
- Responsive sidebar → Button primitive: renders toggle (evidence: `frontend/src/components/ui/sidebar.tsx`)
- FastAPI application → Authentication endpoints: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Project and phase endpoints: registers router (evidence: `backend/app/main.py`)
- Authentication endpoints → JWT and password security: hashes and signs (evidence: `backend/app/api/auth.py`)
- Authentication endpoints → API schemas: validates requests (evidence: `backend/app/api/auth.py`)
- Authentication endpoints → Password reset email: sends reset email (evidence: `backend/app/api/auth.py`)
- Authentication endpoints → Supabase data store: reads and writes (evidence: `backend/app/api/auth.py`)
- Project and phase endpoints → Project persistence: manages projects (evidence: `backend/app/api/routes.py`)
- Project and phase endpoints → Phase service: runs and updates (evidence: `backend/app/api/routes.py`)
- Project and phase endpoints → Supabase data store: reads phase data (evidence: `backend/app/api/routes.py`)
- Project and phase endpoints → API schemas: validates requests (evidence: `backend/app/api/routes.py`)
- Project persistence → Supabase data store: reads and writes (evidence: `backend/app/services/project_service.py`)
- Phase service → LangGraph workflow: runs workflow (evidence: `backend/app/services/phase_service.py`)
- Phase service → Supabase data store: restores and saves (evidence: `backend/app/services/phase_service.py`)
- LangGraph workflow → Engineering state: uses state (evidence: `backend/app/ai/graph.py`)
- LangGraph workflow → Functional decomposition: dispatches phase one (evidence: `backend/app/ai/graph.py`)
- LangGraph workflow → Morphological analysis: dispatches phase two (evidence: `backend/app/ai/graph.py`)
- LangGraph workflow → Risk analysis: dispatches phase three (evidence: `backend/app/ai/graph.py`)
- Functional decomposition → Functional taxonomies: uses lookups (evidence: `backend/app/ai/agents/phase1_functional.py`)
- Functional decomposition → Agent validators: uses result schema (evidence: `backend/app/ai/agents/phase1_functional.py`)
- Morphological analysis → Agent validators: uses result schema (evidence: `backend/app/ai/agents/phase2_morphology.py`)
- Risk analysis → FMEA knowledge base: uses risk lookup (evidence: `backend/app/ai/agents/phase3_risk.py`)
- Risk analysis → Agent validators: uses result schema (evidence: `backend/app/ai/agents/phase3_risk.py`)
- Functional decomposition → Service configuration: loads model settings (evidence: `backend/app/ai/agents/phase1_functional.py`)
- Morphological analysis → Service configuration: loads model settings (evidence: `backend/app/ai/agents/phase2_morphology.py`)
- Risk analysis → Service configuration: loads model settings (evidence: `backend/app/ai/agents/phase3_risk.py`)
- Service configuration → Supabase data store: creates client (evidence: `backend/app/core/config.py`)
- Functional decomposition → Groq language models: invokes model (evidence: `backend/app/ai/agents/phase1_functional.py`)
