# const-ahmed/unschema architecture

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

- Interactive diagram: https://gitdiagram.com/const-ahmed/unschema
- Repository: https://github.com/const-ahmed/unschema

## Overview

Unschema is a server-rendered profile-form app whose English-language rules are evaluated by Jev. Visitors complete the form; Turnstile verification and rate limiting guard live field checks and the final submission check. The final result is displayed and the form resets; submissions are not persisted. The graph follows the documented flow and indexed imports, but some server-function implementations and route wiring were not excerpted, so uncertain relationships are omitted.

Main entry points: [`src/components/ProfileForm.tsx`](https://github.com/const-ahmed/unschema/blob/main/src/components/ProfileForm.tsx) (Profile Form), [`src/validation/verify-human.ts`](https://github.com/const-ahmed/unschema/blob/main/src/validation/verify-human.ts) (Verification Endpoints), [`src/validation/validate-field.ts`](https://github.com/const-ahmed/unschema/blob/main/src/validation/validate-field.ts) (Live Check Endpoint), [`src/validation/submit-profile.ts`](https://github.com/const-ahmed/unschema/blob/main/src/validation/submit-profile.ts) (Submit Endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and Form"]
  node_router["App Router<br/>[router.tsx]"]
  node_route_tree["Route Tree<br/>[routeTree.gen.ts]"]
  node_root_route["Root Route<br/>[__root.tsx]"]
  node_home_route["Profile Page<br/>[index.tsx]"]
  node_profile_form["Profile Form<br/>[ProfileForm.tsx]"]
  node_form_field["Field Feedback<br/>[FormField.tsx]"]
  node_toast["Toast<br/>[Toast.tsx]"]
end

subgraph group_validation["Validation"]
  node_profile_rules["Profile Rules<br/>[profile.ts]"]
  node_live_checks["Live Check Tracker<br/>[live-checks.ts]"]
  node_validation_logic["Validation Timing"]
  node_request_parsing["Request Guards<br/>[request.ts]"]
  node_field_check["Live Check Endpoint<br/>[validate-field.ts]"]
  node_profile_submit["Submit Endpoint<br/>[submit-profile.ts]"]
end

subgraph group_jev["Jev Evaluation"]
  node_rules["English Rule Evaluation<br/>[rules.ts]"]
  node_jev_client["Jev Client<br/>[jev.ts]"]
end

subgraph group_human["Human Verification"]
  node_human_client["Human Session Client<br/>[human-session.ts]"]
  node_human_api["Verification Endpoints<br/>[verify-human.ts]"]
  node_human_constants["Human Check Rules<br/>[human.ts]"]
  node_session_security["Session Security<br/>[human-session.ts]"]
  node_rate_limiter["Rate Limiter<br/>[verify-human.ts]"]
end

node_visitor(("Visitor"))
node_workers_ai{{"Workers AI"}}
node_turnstile{{"Cloudflare Turnstile"}}
node_limiting_service{{"Cloudflare Rate Limiter"}}

node_visitor -->|"opens"| node_home_route
node_router -->|"uses"| node_route_tree
node_route_tree -->|"routes to"| node_home_route
node_route_tree -->|"parents"| node_root_route
node_home_route -->|"renders"| node_profile_form
node_home_route -->|"loads site key"| node_human_api
node_root_route -->|"uses"| node_human_client
node_profile_form -->|"reads field rules"| node_profile_rules
node_profile_form -->|"tracks checks"| node_live_checks
node_profile_form -->|"uses timing"| node_validation_logic
node_profile_form -->|"runs requests through"| node_human_client
node_profile_form -->|"requests live check"| node_field_check
node_profile_form -->|"submits profile"| node_profile_submit
node_profile_form -->|"verifies visitor"| node_human_api
node_profile_form -->|"renders feedback"| node_form_field
node_profile_form -->|"renders notices"| node_toast
node_field_check -->|"validates request"| node_request_parsing
node_field_check -->|"requires human and limit"| node_human_api
node_field_check -->|"checks field"| node_rules
node_profile_submit -->|"validates submission"| node_request_parsing
node_profile_submit -->|"requires human and limit"| node_human_api
node_profile_submit -->|"checks profile"| node_rules
node_rules -->|"uses field rules"| node_profile_rules
node_rules -->|"asks Jev"| node_jev_client
node_jev_client -->|"runs model"| node_workers_ai
node_human_api -->|"validates token"| node_request_parsing
node_human_api -->|"uses verification rules"| node_human_constants
node_human_api -->|"verifies token and session"| node_session_security
node_human_api -->|"verifies token"| node_turnstile
node_human_api -->|"limits requests"| node_rate_limiter
node_rate_limiter -->|"checks quota"| node_limiting_service

click node_router "https://github.com/const-ahmed/unschema/blob/main/src/router.tsx"
click node_route_tree "https://github.com/const-ahmed/unschema/blob/main/src/routeTree.gen.ts"
click node_root_route "https://github.com/const-ahmed/unschema/blob/main/src/routes/__root.tsx"
click node_home_route "https://github.com/const-ahmed/unschema/blob/main/src/routes/index.tsx"
click node_profile_form "https://github.com/const-ahmed/unschema/blob/main/src/components/ProfileForm.tsx"
click node_form_field "https://github.com/const-ahmed/unschema/blob/main/src/components/FormField.tsx"
click node_toast "https://github.com/const-ahmed/unschema/blob/main/src/components/Toast.tsx"
click node_human_client "https://github.com/const-ahmed/unschema/blob/main/src/components/human-session.ts"
click node_profile_rules "https://github.com/const-ahmed/unschema/blob/main/src/validation/profile.ts"
click node_live_checks "https://github.com/const-ahmed/unschema/blob/main/src/validation/live-checks.ts"
click node_validation_logic "https://github.com/const-ahmed/unschema/blob/main/src/validation/validation-logic.ts"
click node_request_parsing "https://github.com/const-ahmed/unschema/blob/main/src/validation/request.ts"
click node_field_check "https://github.com/const-ahmed/unschema/blob/main/src/validation/validate-field.ts"
click node_profile_submit "https://github.com/const-ahmed/unschema/blob/main/src/validation/submit-profile.ts"
click node_human_api "https://github.com/const-ahmed/unschema/blob/main/src/validation/verify-human.ts"
click node_human_constants "https://github.com/const-ahmed/unschema/blob/main/src/validation/human.ts"
click node_session_security "https://github.com/const-ahmed/unschema/blob/main/src/server/human-session.ts"
click node_rate_limiter "https://github.com/const-ahmed/unschema/blob/main/src/validation/verify-human.ts"
click node_rules "https://github.com/const-ahmed/unschema/blob/main/src/server/rules.ts"
click node_jev_client "https://github.com/const-ahmed/unschema/blob/main/src/server/jev.ts"

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_route_tree,node_root_route,node_home_route,node_profile_form,node_form_field,node_toast toneBlue
class node_profile_rules,node_live_checks,node_validation_logic,node_request_parsing,node_field_check,node_profile_submit toneAmber
class node_rules,node_jev_client toneMint
class node_human_client,node_human_api,node_human_constants,node_session_security,node_rate_limiter,node_workers_ai toneRose
class node_visitor,node_turnstile,node_limiting_service toneIndigo
```

## Components

### App and Form

- [App Router](https://github.com/const-ahmed/unschema/blob/main/src/router.tsx): `src/router.tsx`
- [Route Tree](https://github.com/const-ahmed/unschema/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [Root Route](https://github.com/const-ahmed/unschema/blob/main/src/routes/__root.tsx): `src/routes/__root.tsx`
- [Profile Page](https://github.com/const-ahmed/unschema/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Profile Form](https://github.com/const-ahmed/unschema/blob/main/src/components/ProfileForm.tsx): `src/components/ProfileForm.tsx`
- [Field Feedback](https://github.com/const-ahmed/unschema/blob/main/src/components/FormField.tsx): `src/components/FormField.tsx`
- [Toast](https://github.com/const-ahmed/unschema/blob/main/src/components/Toast.tsx): `src/components/Toast.tsx`

### Validation

- [Profile Rules](https://github.com/const-ahmed/unschema/blob/main/src/validation/profile.ts): `src/validation/profile.ts`
- [Live Check Tracker](https://github.com/const-ahmed/unschema/blob/main/src/validation/live-checks.ts): `src/validation/live-checks.ts`
- [Validation Timing](https://github.com/const-ahmed/unschema/blob/main/src/validation/validation-logic.ts): `src/validation/validation-logic.ts`
- [Request Guards](https://github.com/const-ahmed/unschema/blob/main/src/validation/request.ts): `src/validation/request.ts`
- [Live Check Endpoint](https://github.com/const-ahmed/unschema/blob/main/src/validation/validate-field.ts): `src/validation/validate-field.ts`
- [Submit Endpoint](https://github.com/const-ahmed/unschema/blob/main/src/validation/submit-profile.ts): `src/validation/submit-profile.ts`

### Jev Evaluation

- [English Rule Evaluation](https://github.com/const-ahmed/unschema/blob/main/src/server/rules.ts): `src/server/rules.ts`
- [Jev Client](https://github.com/const-ahmed/unschema/blob/main/src/server/jev.ts): `src/server/jev.ts`

### Human Verification

- [Human Session Client](https://github.com/const-ahmed/unschema/blob/main/src/components/human-session.ts): `src/components/human-session.ts`
- [Verification Endpoints](https://github.com/const-ahmed/unschema/blob/main/src/validation/verify-human.ts): `src/validation/verify-human.ts`
- [Human Check Rules](https://github.com/const-ahmed/unschema/blob/main/src/validation/human.ts): `src/validation/human.ts`
- [Session Security](https://github.com/const-ahmed/unschema/blob/main/src/server/human-session.ts): `src/server/human-session.ts`
- [Rate Limiter](https://github.com/const-ahmed/unschema/blob/main/src/validation/verify-human.ts): `src/validation/verify-human.ts`

### Other components

- **Visitor**
- **Workers AI**
- **Cloudflare Turnstile**
- **Cloudflare Rate Limiter**

## Connections

- Visitor → Profile Page: opens (evidence: `README.md`)
- App Router → Route Tree: uses (evidence: `src/router.tsx`)
- Route Tree → Profile Page: routes to (evidence: `src/routeTree.gen.ts`)
- Route Tree → Root Route: parents (evidence: `src/routeTree.gen.ts`)
- Profile Page → Profile Form: renders (evidence: `src/routes/index.tsx`)
- Profile Page → Verification Endpoints: loads site key (evidence: `src/routes/index.tsx`)
- Root Route → Human Session Client: uses (evidence: `src/routes/__root.tsx`)
- Profile Form → Profile Rules: reads field rules (evidence: `src/components/ProfileForm.tsx`)
- Profile Form → Live Check Tracker: tracks checks (evidence: `src/components/ProfileForm.tsx`)
- Profile Form → Validation Timing: uses timing (evidence: `src/components/ProfileForm.tsx`)
- Profile Form → Human Session Client: runs requests through (evidence: `src/components/ProfileForm.tsx`)
- Profile Form → Live Check Endpoint: requests live check (evidence: `src/components/ProfileForm.tsx`)
- Profile Form → Submit Endpoint: submits profile (evidence: `src/components/ProfileForm.tsx`)
- Profile Form → Verification Endpoints: verifies visitor (evidence: `src/components/ProfileForm.tsx`)
- Profile Form → Field Feedback: renders feedback (evidence: `src/components/ProfileForm.tsx`)
- Profile Form → Toast: renders notices (evidence: `src/components/ProfileForm.tsx`)
- Live Check Endpoint → Request Guards: validates request (evidence: `src/validation/validate-field.ts`)
- Live Check Endpoint → Verification Endpoints: requires human and limit (evidence: `src/validation/validate-field.ts`)
- Live Check Endpoint → English Rule Evaluation: checks field (evidence: `src/validation/validate-field.ts`)
- Submit Endpoint → Request Guards: validates submission (evidence: `src/validation/submit-profile.ts`)
- Submit Endpoint → Verification Endpoints: requires human and limit (evidence: `src/validation/submit-profile.ts`)
- Submit Endpoint → English Rule Evaluation: checks profile (evidence: `src/validation/submit-profile.ts`)
- English Rule Evaluation → Profile Rules: uses field rules (evidence: `src/server/rules.ts`)
- English Rule Evaluation → Jev Client: asks Jev (evidence: `src/server/rules.ts`)
- Jev Client → Workers AI: runs model (evidence: `src/server/jev.ts`)
- Verification Endpoints → Request Guards: validates token (evidence: `src/validation/verify-human.ts`)
- Verification Endpoints → Human Check Rules: uses verification rules (evidence: `src/validation/verify-human.ts`)
- Verification Endpoints → Session Security: verifies token and session (evidence: `src/validation/verify-human.ts`)
- Verification Endpoints → Cloudflare Turnstile: verifies token
- Verification Endpoints → Rate Limiter: limits requests (evidence: `src/validation/verify-human.ts`)
- Rate Limiter → Cloudflare Rate Limiter: checks quota (evidence: `src/validation/verify-human.ts`)
