# skysaksham/skyforms architecture

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

- Interactive diagram: https://gitdiagram.com/skysaksham/skyforms
- Repository: https://github.com/skysaksham/skyforms

## Overview

SkyForms is a form-building SPA backed by FastAPI: users authenticate, create or AI-generate forms, edit drafts, and can publish them. The frontend routes landing, home, editor, and publish pages; its sync layer caches user data locally and communicates with backend APIs. The backend verifies Google credentials, issues JWT sessions, generates questions through Groq, and persists draft and published-form changes. Some page, API, and database implementations are not sampled, so their internal wiring is shown only where documented or evidenced.

Main entry points: [`SkyForms_Backend/main.py`](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/main.py) (HTTP API), [`SkyForms_Frontend/route.js`](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/route.js) (SPA router), [`SkyForms_Frontend/logic/syncClass.js`](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/logic/syncClass.js) (State sync), [`SkyForms_Frontend/main.js`](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/main.js) (App startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_router["SPA router<br/>[route.js]"]
  node_startup["App startup<br/>[main.js]"]
  node_landing["Landing page<br/>[landingPage.js]"]
  node_home["Forms home<br/>[homePage.js]"]
  node_editor["Draft editor<br/>[editorPage.js]"]
  node_publish["Publish page<br/>[publishPage.js]"]
  node_preview["Form preview<br/>[previewPublish.js]"]
  node_draft_model["Draft model<br/>[draftClass.js]"]
  node_sync["State sync<br/>[syncClass.js]"]
  node_local_cache[("Browser cache")]
  node_frontend_auth["Google sign-in<br/>[googleAuth.js]"]
  node_frontend_llm["Question API client<br/>[llmResponse.js]"]
end

subgraph group_backend["Backend services"]
  node_backend_api["HTTP API<br/>[main.py]"]
  node_question_generation["Question generation"]
  node_google_verify["Google token verification"]
  node_jwt["JWT sessions"]
end

subgraph group_persistence["Data persistence"]
  node_user_data["User data access<br/>[get_userdata.py]"]
  node_user_store["User records<br/>[user.py]"]
  node_draft_store["Draft persistence"]
  node_published_store["Published forms<br/>[submit_draft.py]"]
end

subgraph group_integrations["External integrations"]
  node_postgres[("PostgreSQL")]
  node_google(("Google identity"))
  node_groq(("Groq API"))
end

node_user(("Form creator"))

node_user -->|"uses"| node_router
node_router -->|"routes to"| node_landing
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_editor
node_router -->|"routes to"| node_publish
node_startup -->|"initializes"| node_router
node_startup -->|"creates"| node_sync
node_startup -->|"loads state"| node_sync
node_startup -->|"verifies session"| node_backend_api
node_editor -->|"edits draft"| node_draft_model
node_editor -->|"navigates"| node_router
node_publish -->|"renders preview"| node_preview
node_frontend_auth -->|"gets credentials"| node_google
node_frontend_auth -->|"signs in"| node_backend_api
node_frontend_auth -->|"sets user state"| node_sync
node_home -->|"requests questions"| node_frontend_llm
node_frontend_llm -->|"posts prompt"| node_backend_api
node_backend_api -->|"generates questions"| node_question_generation
node_question_generation -->|"requests completion"| node_groq
node_backend_api -->|"verifies identity"| node_google_verify
node_google_verify -->|"checks token"| node_google
node_backend_api -->|"issues or verifies"| node_jwt
node_backend_api -->|"looks up or creates"| node_user_store
node_backend_api -->|"fetches user data"| node_user_data
node_backend_api -->|"reads or writes drafts"| node_draft_store
node_backend_api -->|"submits form"| node_published_store
node_sync -->|"reads or writes"| node_local_cache
node_sync -->|"syncs drafts"| node_backend_api
node_sync -->|"fetches home data"| node_backend_api
node_user_data -->|"queries"| node_postgres
node_user_store -->|"queries"| node_postgres
node_draft_store -->|"reads or writes"| node_postgres
node_published_store -->|"writes"| node_postgres

click node_router "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/route.js"
click node_startup "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/main.js"
click node_landing "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/pages/landingPage.js"
click node_home "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/pages/homePage.js"
click node_editor "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/pages/editorPage.js"
click node_publish "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/pages/publishPage.js"
click node_preview "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/components/previewPublish.js"
click node_draft_model "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/logic/draftClass.js"
click node_sync "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/logic/syncClass.js"
click node_frontend_auth "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/api/googleAuth.js"
click node_frontend_llm "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/api/llmResponse.js"
click node_backend_api "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/main.py"
click node_question_generation "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/services/get_questions_llm.py"
click node_google_verify "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/services/verify_google_id_token.py"
click node_jwt "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/services/create_verify_jwt.py"
click node_user_data "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/db/get_userdata.py"
click node_user_store "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/db/user.py"
click node_draft_store "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/db/update_draft_forms.py"
click node_published_store "https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/db/submit_draft.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_router,node_startup,node_landing,node_home,node_editor,node_publish,node_preview,node_draft_model,node_sync,node_local_cache,node_frontend_auth,node_frontend_llm toneBlue
class node_backend_api,node_question_generation,node_google_verify,node_jwt toneAmber
class node_user_data,node_user_store,node_draft_store,node_published_store toneMint
class node_postgres,node_google,node_groq toneRose
class node_user toneIndigo
```

## Components

### Frontend experience

- [SPA router](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/route.js): `SkyForms_Frontend/route.js`
- [App startup](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/main.js): `SkyForms_Frontend/main.js`
- [Landing page](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/pages/landingPage.js): `SkyForms_Frontend/pages/landingPage.js`
- [Forms home](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/pages/homePage.js): `SkyForms_Frontend/pages/homePage.js`
- [Draft editor](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/pages/editorPage.js): `SkyForms_Frontend/pages/editorPage.js`
- [Publish page](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/pages/publishPage.js): `SkyForms_Frontend/pages/publishPage.js`
- [Form preview](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/components/previewPublish.js): `SkyForms_Frontend/components/previewPublish.js`
- [Draft model](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/logic/draftClass.js): `SkyForms_Frontend/logic/draftClass.js`
- [State sync](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/logic/syncClass.js): `SkyForms_Frontend/logic/syncClass.js`
- **Browser cache**
- [Google sign-in](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/api/googleAuth.js): `SkyForms_Frontend/api/googleAuth.js`
- [Question API client](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Frontend/api/llmResponse.js): `SkyForms_Frontend/api/llmResponse.js`

### Backend services

- [HTTP API](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/main.py): `SkyForms_Backend/main.py`
- [Question generation](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/services/get_questions_llm.py): `SkyForms_Backend/services/get_questions_llm.py`
- [Google token verification](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/services/verify_google_id_token.py): `SkyForms_Backend/services/verify_google_id_token.py`
- [JWT sessions](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/services/create_verify_jwt.py): `SkyForms_Backend/services/create_verify_jwt.py`

### Data persistence

- [User data access](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/db/get_userdata.py): `SkyForms_Backend/db/get_userdata.py`
- [User records](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/db/user.py): `SkyForms_Backend/db/user.py`
- [Draft persistence](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/db/update_draft_forms.py): `SkyForms_Backend/db/update_draft_forms.py`
- [Published forms](https://github.com/skysaksham/skyforms/blob/main/SkyForms_Backend/db/submit_draft.py): `SkyForms_Backend/db/submit_draft.py`

### External integrations

- **PostgreSQL**
- **Google identity**
- **Groq API**

### Other components

- **Form creator**

## Connections

- Form creator → SPA router: uses
- SPA router → Landing page: routes to
- SPA router → Forms home: routes to
- SPA router → Draft editor: routes to
- SPA router → Publish page: routes to
- App startup → SPA router: initializes
- App startup → State sync: creates
- App startup → State sync: loads state
- App startup → HTTP API: verifies session
- Draft editor → Draft model: edits draft
- Draft editor → SPA router: navigates
- Publish page → Form preview: renders preview
- Google sign-in → Google identity: gets credentials
- Google sign-in → HTTP API: signs in
- Google sign-in → State sync: sets user state
- Forms home → Question API client: requests questions
- Question API client → HTTP API: posts prompt
- HTTP API → Question generation: generates questions
- Question generation → Groq API: requests completion
- HTTP API → Google token verification: verifies identity
- Google token verification → Google identity: checks token
- HTTP API → JWT sessions: issues or verifies
- HTTP API → User records: looks up or creates
- HTTP API → User data access: fetches user data
- HTTP API → Draft persistence: reads or writes drafts
- HTTP API → Published forms: submits form
- State sync → Browser cache: reads or writes
- State sync → HTTP API: syncs drafts
- State sync → HTTP API: fetches home data
- User data access → PostgreSQL: queries
- User records → PostgreSQL: queries
- Draft persistence → PostgreSQL: reads or writes
- Published forms → PostgreSQL: writes
