# thenabinamallik/webgoai architecture

> Architecture diagram of the GitHub repository thenabinamallik/webgoai, 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/thenabinamallik/webgoai
- Repository: https://github.com/thenabinamallik/webgoai

## Overview

WebGoAI lets users generate, refine, preview, deploy, and download AI-created websites, with Google sign-in and credit purchases. The main workflow runs from the React app through website API routes to the generation controller, which uses OpenRouter and stores website state in MongoDB; the editor then supports iteration and deployment. The README documents additional product capabilities, while some frontend and backend implementation details were not sampled, so those links are shown only where documented or indexed.

Main entry points: [`frontend/src/App.jsx`](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/App.jsx) (React router), [`backend/controllers/websiteController.js`](https://github.com/thenabinamallik/webgoai/blob/main/backend/controllers/websiteController.js) (Website controller), [`backend/models/userModel.js`](https://github.com/thenabinamallik/webgoai/blob/main/backend/models/userModel.js) (User records), [`frontend/src/pages/WebsiteEditor.jsx`](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/WebsiteEditor.jsx) (Website editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web app"]
  node_app["React router<br/>[App.jsx]"]
  node_home["Home<br/>[Home.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_generate["Generate page<br/>[Generate.jsx]"]
  node_editor["Website editor<br/>[WebsiteEditor.jsx]"]
  node_chat["AI chat panel<br/>[ChatPanel.jsx]"]
  node_live["Public site<br/>[LiveSite.jsx]"]
  node_pricing["Pricing page<br/>[Pricing.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
end

subgraph group_website["Website workflow"]
  node_websiteroutes["Website routes<br/>[websiteRoute.js]"]
  node_website["Website controller"]
  node_websites[("Website records<br/>[websiteModel.js]")]
  node_json["JSON extraction<br/>[extractJson.js]"]
end

subgraph group_identity["Identity and credits"]
  node_login["Login modal<br/>[LoginModal.jsx]"]
  node_userstate["User state<br/>[userSlice.js]"]
  node_authroutes["Auth routes<br/>[authRoute.js]"]
  node_auth["Auth controller<br/>[authController.js]"]
  node_authguard["JWT middleware<br/>[isAuthenticated.js]"]
  node_users[("User records<br/>[userModel.js]")]
  node_paymentroutes["Payment routes<br/>[paymentRoute.js]"]
  node_payments["Payment controller"]
  node_paymentrecords[("Payment records<br/>[paymentModel.js]")]
end

subgraph group_services["External services"]
  node_openrouter["AI request client<br/>[openRouter.js]"]
  node_ai["OpenRouter AI"]
  node_razorconfig["Razorpay config<br/>[razorpay.js]"]
  node_razorpay["Razorpay"]
  node_firebase["Firebase Auth<br/>[firebase.js]"]
  node_mongo[("MongoDB")]
end

node_visitor(("Website user"))

node_visitor -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_generate
node_app -->|"routes to"| node_editor
node_app -->|"routes to"| node_live
node_app -->|"routes to"| node_pricing
node_home -->|"renders"| node_navbar
node_navbar -->|"opens"| node_login
node_login -->|"authenticates with"| node_firebase
node_login -->|"updates"| node_userstate
node_editor -->|"renders"| node_chat
node_editor -->|"requests website API"| node_websiteroutes
node_editor -->|"opens deployed site"| node_live
node_websiteroutes -->|"dispatches to"| node_website
node_website -->|"requests generation"| node_openrouter
node_openrouter -->|"sends prompt"| node_ai
node_website -->|"parses response"| node_json
node_website -->|"checks and updates credits"| node_users
node_website -->|"reads and saves sites"| node_websites
node_websiteroutes -->|"protects routes"| node_authguard
node_authroutes -->|"dispatches to"| node_auth
node_authroutes -->|"protects logout"| node_authguard
node_auth -->|"finds or creates"| node_users
node_authguard -->|"loads user"| node_users
node_pricing -->|"purchases credits"| node_paymentroutes
node_paymentroutes -->|"dispatches to"| node_payments
node_payments -->|"creates order"| node_razorconfig
node_razorconfig -->|"configures client"| node_razorpay
node_payments -->|"records payment"| node_paymentrecords
node_payments -->|"adds credits"| node_users
node_paymentroutes -->|"protects routes"| node_authguard
node_websites -.->|"persists in"| node_mongo
node_users -.->|"persists in"| node_mongo

click node_app "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/Home.jsx"
click node_dashboard "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/Dashboard.jsx"
click node_generate "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/Generate.jsx"
click node_editor "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/WebsiteEditor.jsx"
click node_chat "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/components/ChatPanel.jsx"
click node_live "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/LiveSite.jsx"
click node_pricing "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/Pricing.jsx"
click node_navbar "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/components/Navbar.jsx"
click node_login "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/components/LoginModal.jsx"
click node_userstate "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/redux/userSlice.js"
click node_authroutes "https://github.com/thenabinamallik/webgoai/blob/main/backend/routes/authRoute.js"
click node_auth "https://github.com/thenabinamallik/webgoai/blob/main/backend/controllers/authController.js"
click node_authguard "https://github.com/thenabinamallik/webgoai/blob/main/backend/middlewares/isAuthenticated.js"
click node_users "https://github.com/thenabinamallik/webgoai/blob/main/backend/models/userModel.js"
click node_paymentroutes "https://github.com/thenabinamallik/webgoai/blob/main/backend/routes/paymentRoute.js"
click node_payments "https://github.com/thenabinamallik/webgoai/blob/main/backend/controllers/paymentController.js"
click node_paymentrecords "https://github.com/thenabinamallik/webgoai/blob/main/backend/models/paymentModel.js"
click node_websiteroutes "https://github.com/thenabinamallik/webgoai/blob/main/backend/routes/websiteRoute.js"
click node_website "https://github.com/thenabinamallik/webgoai/blob/main/backend/controllers/websiteController.js"
click node_websites "https://github.com/thenabinamallik/webgoai/blob/main/backend/models/websiteModel.js"
click node_json "https://github.com/thenabinamallik/webgoai/blob/main/backend/utils/extractJson.js"
click node_openrouter "https://github.com/thenabinamallik/webgoai/blob/main/backend/config/openRouter.js"
click node_razorconfig "https://github.com/thenabinamallik/webgoai/blob/main/backend/config/razorpay.js"
click node_firebase "https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/firebase.js"

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_app,node_home,node_dashboard,node_generate,node_editor,node_chat,node_live,node_pricing,node_navbar,node_visitor toneBlue
class node_websiteroutes,node_website,node_websites,node_json toneAmber
class node_login,node_userstate,node_authroutes,node_auth,node_authguard,node_users,node_paymentroutes,node_payments,node_paymentrecords toneMint
class node_openrouter,node_ai,node_razorconfig,node_razorpay,node_firebase,node_mongo toneRose
```

## Components

### Web app

- [React router](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Home](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Dashboard](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Generate page](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/Generate.jsx): `frontend/src/pages/Generate.jsx`
- [Website editor](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/WebsiteEditor.jsx): `frontend/src/pages/WebsiteEditor.jsx`
- [AI chat panel](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/components/ChatPanel.jsx): `frontend/src/components/ChatPanel.jsx`
- [Public site](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/LiveSite.jsx): `frontend/src/pages/LiveSite.jsx`
- [Pricing page](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/pages/Pricing.jsx): `frontend/src/pages/Pricing.jsx`
- [Navigation](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`

### Website workflow

- [Website routes](https://github.com/thenabinamallik/webgoai/blob/main/backend/routes/websiteRoute.js): `backend/routes/websiteRoute.js`
- [Website controller](https://github.com/thenabinamallik/webgoai/blob/main/backend/controllers/websiteController.js): `backend/controllers/websiteController.js`
- [Website records](https://github.com/thenabinamallik/webgoai/blob/main/backend/models/websiteModel.js): `backend/models/websiteModel.js`
- [JSON extraction](https://github.com/thenabinamallik/webgoai/blob/main/backend/utils/extractJson.js): `backend/utils/extractJson.js`

### Identity and credits

- [Login modal](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/components/LoginModal.jsx): `frontend/src/components/LoginModal.jsx`
- [User state](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/redux/userSlice.js): `frontend/src/redux/userSlice.js`
- [Auth routes](https://github.com/thenabinamallik/webgoai/blob/main/backend/routes/authRoute.js): `backend/routes/authRoute.js`
- [Auth controller](https://github.com/thenabinamallik/webgoai/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [JWT middleware](https://github.com/thenabinamallik/webgoai/blob/main/backend/middlewares/isAuthenticated.js): `backend/middlewares/isAuthenticated.js`
- [User records](https://github.com/thenabinamallik/webgoai/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [Payment routes](https://github.com/thenabinamallik/webgoai/blob/main/backend/routes/paymentRoute.js): `backend/routes/paymentRoute.js`
- [Payment controller](https://github.com/thenabinamallik/webgoai/blob/main/backend/controllers/paymentController.js): `backend/controllers/paymentController.js`
- [Payment records](https://github.com/thenabinamallik/webgoai/blob/main/backend/models/paymentModel.js): `backend/models/paymentModel.js`

### External services

- [AI request client](https://github.com/thenabinamallik/webgoai/blob/main/backend/config/openRouter.js): `backend/config/openRouter.js`
- **OpenRouter AI**
- [Razorpay config](https://github.com/thenabinamallik/webgoai/blob/main/backend/config/razorpay.js): `backend/config/razorpay.js`
- **Razorpay**
- [Firebase Auth](https://github.com/thenabinamallik/webgoai/blob/main/frontend/src/firebase.js): `frontend/src/firebase.js`
- **MongoDB**

### Other components

- **Website user**

## Connections

- Website user → React router: uses (evidence: `README.md`)
- React router → Home: routes to (evidence: `frontend/src/App.jsx`)
- React router → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React router → Generate page: routes to (evidence: `frontend/src/App.jsx`)
- React router → Website editor: routes to (evidence: `frontend/src/App.jsx`)
- React router → Public site: routes to (evidence: `frontend/src/App.jsx`)
- React router → Pricing page: routes to (evidence: `frontend/src/App.jsx`)
- Home → Navigation: renders (evidence: `frontend/src/pages/Home.jsx`)
- Navigation → Login modal: opens (evidence: `frontend/src/components/Navbar.jsx`)
- Login modal → Firebase Auth: authenticates with (evidence: `frontend/src/components/LoginModal.jsx`)
- Login modal → User state: updates (evidence: `frontend/src/components/LoginModal.jsx`)
- Website editor → AI chat panel: renders (evidence: `frontend/src/pages/WebsiteEditor.jsx`)
- Website editor → Website routes: requests website API (evidence: `frontend/src/pages/WebsiteEditor.jsx`)
- Website editor → Public site: opens deployed site
- Website routes → Website controller: dispatches to (evidence: `backend/routes/websiteRoute.js`)
- Website controller → AI request client: requests generation (evidence: `backend/controllers/websiteController.js`)
- AI request client → OpenRouter AI: sends prompt (evidence: `backend/config/openRouter.js`)
- Website controller → JSON extraction: parses response (evidence: `backend/controllers/websiteController.js`)
- Website controller → User records: checks and updates credits (evidence: `backend/controllers/websiteController.js`)
- Website controller → Website records: reads and saves sites (evidence: `backend/controllers/websiteController.js`)
- Website routes → JWT middleware: protects routes (evidence: `backend/routes/websiteRoute.js`)
- Auth routes → Auth controller: dispatches to (evidence: `backend/routes/authRoute.js`)
- Auth routes → JWT middleware: protects logout (evidence: `backend/routes/authRoute.js`)
- Auth controller → User records: finds or creates (evidence: `backend/controllers/authController.js`)
- JWT middleware → User records: loads user (evidence: `backend/middlewares/isAuthenticated.js`)
- Pricing page → Payment routes: purchases credits (evidence: `README.md`)
- Payment routes → Payment controller: dispatches to (evidence: `backend/routes/paymentRoute.js`)
- Payment controller → Razorpay config: creates order (evidence: `backend/controllers/paymentController.js`)
- Razorpay config → Razorpay: configures client (evidence: `backend/config/razorpay.js`)
- Payment controller → Payment records: records payment (evidence: `backend/controllers/paymentController.js`)
- Payment controller → User records: adds credits (evidence: `backend/controllers/paymentController.js`)
- Payment routes → JWT middleware: protects routes (evidence: `backend/routes/paymentRoute.js`)
- Website records → MongoDB: persists in (evidence: `README.md`)
- User records → MongoDB: persists in (evidence: `README.md`)
