# omaralabaseery/neuralnetworkco architecture

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

- Interactive diagram: https://gitdiagram.com/omaralabaseery/neuralnetworkco
- Repository: https://github.com/omaralabaseery/neuralnetworkco

## Overview

This repository combines a bilingual company website and lead-capture/CMS backend with a separate customer portal and role-protected CRM. The public workflow runs from browsing service and content pages to submitting a project inquiry; administrators manage leads, content, and contact settings. The portal and platform implement account and business workflows. Some connections are documented in the README; portal internals were not excerpted, so its UI-to-worker relationship is shown as documented rather than as inspected call flow.

Main entry points: [`components/site.tsx`](https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/site.tsx) (Site routing), [`db/index.ts`](https://github.com/omaralabaseery/neuralnetworkco/blob/main/db/index.ts) (D1 access), [`platform/src/worker.mjs`](https://github.com/omaralabaseery/neuralnetworkco/blob/main/platform/src/worker.mjs) (Portal API worker), [`portal/app.js`](https://github.com/omaralabaseery/neuralnetworkco/blob/main/portal/app.js) (Portal and CRM)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public website"]
  node_site["Site routing<br/>[site.tsx]"]
  node_home["Home capabilities<br/>[premium-home.tsx]"]
  node_secondary["Secondary pages"]
  node_service["Service details<br/>[service-detail.tsx]"]
  node_contentdata["Bilingual content<br/>[content.ts]"]
  node_ui["UI primitives"]
  node_leadform["Project inquiry<br/>[site.tsx]"]
end

subgraph group_backend["Website backend"]
  node_leadsapi["Lead intake<br/>[route.ts]"]
  node_admin["Admin interface<br/>[page.tsx]"]
  node_adminapi["Admin API<br/>[route.ts]"]
  node_contentapi["Content API<br/>[route.ts]"]
  node_dbaccess["D1 access<br/>[index.ts]"]
  node_schema[("Website records<br/>[schema.ts]")]
end

subgraph group_portal["Portal and CRM"]
  node_portalui["Portal and CRM<br/>[app.js]"]
  node_signinscreen["Portal sign-in<br/>[website.js]"]
end

subgraph group_platform["Platform services"]
  node_worker["Portal API worker<br/>[worker.mjs]"]
  node_security["Sessions and roles<br/>[security.mjs]"]
  node_validation["Request validation<br/>[validation.mjs]"]
end

node_visitor(("Site visitor"))
node_customer(("Portal user"))
node_staff(("CRM staff"))

node_visitor -->|"browses"| node_site
node_site -->|"renders"| node_home
node_site -->|"renders"| node_secondary
node_site -->|"renders"| node_service
node_site -->|"reads"| node_contentdata
node_site -.->|"uses"| node_ui
node_visitor -->|"submits inquiry"| node_leadform
node_leadform -->|"sends inquiry"| node_leadsapi
node_leadsapi -->|"stores lead"| node_dbaccess
node_dbaccess -->|"maps records"| node_schema
node_admin -->|"manages content and leads"| node_adminapi
node_adminapi -->|"reads and updates"| node_dbaccess
node_contentapi -->|"reads content"| node_dbaccess
node_site -->|"fetches content"| node_contentapi
node_customer -->|"signs in"| node_signinscreen
node_staff -->|"uses CRM"| node_portalui
node_customer -->|"uses portal"| node_portalui
node_portalui -.->|"uses platform API"| node_worker
node_worker -->|"uses security helpers"| node_security
node_worker -->|"uses validators"| node_validation

click node_site "https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/site.tsx"
click node_home "https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/premium-home.tsx"
click node_secondary "https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/premium-secondary.tsx"
click node_service "https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/service-detail.tsx"
click node_contentdata "https://github.com/omaralabaseery/neuralnetworkco/blob/main/lib/content.ts"
click node_ui "https://github.com/omaralabaseery/neuralnetworkco/tree/main/components/ui"
click node_leadform "https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/site.tsx"
click node_leadsapi "https://github.com/omaralabaseery/neuralnetworkco/blob/main/app/api/leads/route.ts"
click node_admin "https://github.com/omaralabaseery/neuralnetworkco/blob/main/app/admin/page.tsx"
click node_adminapi "https://github.com/omaralabaseery/neuralnetworkco/blob/main/app/api/admin/route.ts"
click node_contentapi "https://github.com/omaralabaseery/neuralnetworkco/blob/main/app/api/content/route.ts"
click node_dbaccess "https://github.com/omaralabaseery/neuralnetworkco/blob/main/db/index.ts"
click node_schema "https://github.com/omaralabaseery/neuralnetworkco/blob/main/db/schema.ts"
click node_portalui "https://github.com/omaralabaseery/neuralnetworkco/blob/main/portal/app.js"
click node_signinscreen "https://github.com/omaralabaseery/neuralnetworkco/blob/main/portal/website.js"
click node_worker "https://github.com/omaralabaseery/neuralnetworkco/blob/main/platform/src/worker.mjs"
click node_security "https://github.com/omaralabaseery/neuralnetworkco/blob/main/platform/src/security.mjs"
click node_validation "https://github.com/omaralabaseery/neuralnetworkco/blob/main/platform/src/validation.mjs"

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_site,node_home,node_secondary,node_service,node_contentdata,node_ui,node_leadform,node_customer toneBlue
class node_leadsapi,node_admin,node_adminapi,node_contentapi,node_dbaccess,node_schema toneAmber
class node_portalui,node_signinscreen toneMint
class node_worker,node_security,node_validation toneRose
class node_visitor,node_staff toneIndigo
```

## Components

### Public website

- [Site routing](https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/site.tsx): `components/site.tsx`
- [Home capabilities](https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/premium-home.tsx): `components/premium-home.tsx`
- [Secondary pages](https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/premium-secondary.tsx): `components/premium-secondary.tsx`
- [Service details](https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/service-detail.tsx): `components/service-detail.tsx`
- [Bilingual content](https://github.com/omaralabaseery/neuralnetworkco/blob/main/lib/content.ts): `lib/content.ts`
- [UI primitives](https://github.com/omaralabaseery/neuralnetworkco/tree/main/components/ui): `components/ui`
- [Project inquiry](https://github.com/omaralabaseery/neuralnetworkco/blob/main/components/site.tsx): `components/site.tsx`

### Website backend

- [Lead intake](https://github.com/omaralabaseery/neuralnetworkco/blob/main/app/api/leads/route.ts): `app/api/leads/route.ts`
- [Admin interface](https://github.com/omaralabaseery/neuralnetworkco/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Admin API](https://github.com/omaralabaseery/neuralnetworkco/blob/main/app/api/admin/route.ts): `app/api/admin/route.ts`
- [Content API](https://github.com/omaralabaseery/neuralnetworkco/blob/main/app/api/content/route.ts): `app/api/content/route.ts`
- [D1 access](https://github.com/omaralabaseery/neuralnetworkco/blob/main/db/index.ts): `db/index.ts`
- [Website records](https://github.com/omaralabaseery/neuralnetworkco/blob/main/db/schema.ts): `db/schema.ts`

### Portal and CRM

- [Portal and CRM](https://github.com/omaralabaseery/neuralnetworkco/blob/main/portal/app.js): `portal/app.js`
- [Portal sign-in](https://github.com/omaralabaseery/neuralnetworkco/blob/main/portal/website.js): `portal/website.js`

### Platform services

- [Portal API worker](https://github.com/omaralabaseery/neuralnetworkco/blob/main/platform/src/worker.mjs): `platform/src/worker.mjs`
- [Sessions and roles](https://github.com/omaralabaseery/neuralnetworkco/blob/main/platform/src/security.mjs): `platform/src/security.mjs`
- [Request validation](https://github.com/omaralabaseery/neuralnetworkco/blob/main/platform/src/validation.mjs): `platform/src/validation.mjs`

### Other components

- **Site visitor**
- **Portal user**
- **CRM staff**

## Connections

- Site visitor → Site routing: browses
- Site routing → Home capabilities: renders (evidence: `components/site.tsx`)
- Site routing → Secondary pages: renders (evidence: `components/site.tsx`)
- Site routing → Service details: renders (evidence: `components/site.tsx`)
- Site routing → Bilingual content: reads (evidence: `components/site.tsx`)
- Site routing → UI primitives: uses
- Site visitor → Project inquiry: submits inquiry (evidence: `README.md`)
- Project inquiry → Lead intake: sends inquiry (evidence: `README.md`)
- Lead intake → D1 access: stores lead (evidence: `app/api/leads/route.ts`)
- D1 access → Website records: maps records (evidence: `db/index.ts`)
- Admin interface → Admin API: manages content and leads (evidence: `README.md`)
- Admin API → D1 access: reads and updates (evidence: `app/api/admin/route.ts`)
- Content API → D1 access: reads content (evidence: `app/api/content/route.ts`)
- Site routing → Content API: fetches content (evidence: `components/site.tsx`)
- Portal user → Portal sign-in: signs in (evidence: `README.md`)
- CRM staff → Portal and CRM: uses CRM (evidence: `README.md`)
- Portal user → Portal and CRM: uses portal (evidence: `README.md`)
- Portal and CRM → Portal API worker: uses platform API (evidence: `README.md`)
- Portal API worker → Sessions and roles: uses security helpers (evidence: `platform/src/worker.mjs`)
- Portal API worker → Request validation: uses validators (evidence: `platform/src/worker.mjs`)
