# benjiavdullahu/intellex architecture

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

- Interactive diagram: https://gitdiagram.com/benjiavdullahu/intellex
- Repository: https://github.com/benjiavdullahu/intellex

## Overview

1. **Overall shape**
   - This is a **Next.js App Router** application with a mostly client-side React UI, styled with **Tailwind CSS** and built from **shadcn/ui**-style primitives.
   - The repo is organized around a product flow for an educational matching platform: landing, onboarding/form, dashboard, session, leaderboard, and a small API layer.

2. **Primary user flows**
   - The app appears to guide a user through:
     - entering or creating a profile,
     - answering skill-interest questions,
     - landing in a dashboard where matching and progress are surfaced,
     - joining a learning session,
     - and viewing a leaderboard/rewards view.
   - The readme confirms the product goal: peer-to-peer skill sharing with weekly rewards.

3. **Route-level architecture**
   - `app/page.tsx` is the landing/home entry point.
   - `app/form/page.tsx` likely handles the onboarding / skill input form.
   - `app/dashboard/page.tsx` and `app/dashboard/create/page.tsx` support the core authenticated workspace and a create/match action.
   - `app/session/page.tsx` is the live learning session experience.
   - `app/leaderboard/page.tsx` presents rankings and reward status.
   - `app/api/verbwire/route.ts` is the only explicit server route and acts as an integration point for blockchain/NFT operations.

4. **Client UI composition**
   - `components/component/*` contains feature-oriented UI pieces rather than generic atoms:
     - `navbar`, `profile-icon`, `mode-toggle`, and `dots` are shared shell elements.
     - `summary/summary.tsx` suggests a dashboard card or status summary.
     - `survey/*` contains the onboarding/questionnaire experience and completion/thank-you states.
   - `components/ui/*` provides the lower-level reusable primitives such as buttons, cards, tables, forms, inputs, sliders, radios, dropdowns, and avatar.

5. **State and auth boundary**
   - `lib/hooks/use-auth.ts` is the main auth hook, indicating client components likely read a shared authentication state.
   - `lib/sign-in-or-create.ts` suggests a helper that either logs in an existing user or creates a new one, which is a key boundary between UI and identity management.
   - `lib/get-user-data.ts` likely bridges auth identity to profile/survey data needed across dashboard and session screens.

6. **Data and backend services**
   - `lib/firebase.ts` is the central Firebase initialization/configuration layer.
   - Firebase is the main application data backend implied by the readme and file structure; it likely stores user profiles, survey responses, match data, and leaderboard-related records.
   - Because there is no broader server directory, most business logic seems to live in client code and Firebase-backed helpers, with Next.js server routes used only for specific integrations.

7. **Blockchain / reward integration**
   - The readme highlights Verbwire and NFT rewards for top weekly learners.
   - `app/api/verbwire/route.ts` is the architecture boundary for minting or reward-related blockchain actions, insulating the rest of the app from direct API handling.
   - This suggests the leaderboard flow is not just cosmetic; it likely culminates in an external minting or asset issuance step.

8. **Session experience**
   - `app/session/page.tsx` plus the survey-related components imply a dedicated interactive session area.
   - The readme says the platform supports **1:1 video calls**, whiteboard collaboration, and screen sharing, though it also notes the build is currently failing because of the `100ms` video feature.
   - Architecturally, this means the session surface is a distinct integration-heavy boundary compared with the rest of the app.

9. **Matching / survey workflow**
   - `lib/questions.ts` and the `survey/*` components indicate a questionnaire-driven profile capture step.
   - The likely data flow is: user answers questions → responses are persisted or derived into skill preferences → dashboard/matching logic uses that profile to suggest peers or sessions.
   - `app/form/page.tsx` is probably the entry point for this matching input pipeline.

10. **Theming and app shell**
   - `app/layout.tsx`, `components/theme-provider.tsx`, and `components/component/mode-toggle.tsx` define the global shell and theme behavior.
   - `app/globals.css`, `tailwind.config.js`, and `postcss.config.js` support the visual system.
   - This indicates the app has a shared top-level layout with persistent theming across all routes.

11. **External dependencies that matter to the architecture**
   - **Firebase**: primary app data/auth backend.
   - **Verbwire**: external API for NFT/reward functionality.
   - **100ms**: session/video layer mentioned in the readme, currently a build-risk area.
   - The deployment target is **Vercel**, which fits the Next.js App Router and route-handler structure.

12. **How to draw the system**
   - At the center is a Next.js client app with route-based screens.
   - Surrounding it are shared UI components and a small set of lib helpers.
   - Firebase forms the persistent data layer for users, profiles, and matching state.
   - The `/api/verbwire` route is a narrow server-side integration for reward minting.
   - The session page is the most externally integrated feature, with video/collaboration tooling separated from the rest of the product flow.

Main entry points: [`lib/firebase.ts`](https://github.com/benjiavdullahu/intellex/blob/master/lib/firebase.ts) (Firebase), [`app/form/page.tsx`](https://github.com/benjiavdullahu/intellex/blob/master/app/form/page.tsx) (Onboarding), [`components/component/navbar.tsx`](https://github.com/benjiavdullahu/intellex/blob/master/components/component/navbar.tsx) (Navbar), [`components/component/survey/input-form.tsx`](https://github.com/benjiavdullahu/intellex/blob/master/components/component/survey/input-form.tsx) (Survey Form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routes["App routes"]
  node_app_page["Home<br/>route<br/>[page.tsx]"]
  node_app_form_page["Onboarding<br/>route<br/>[page.tsx]"]
  node_app_dashboard_page["Dashboard<br/>route<br/>[page.tsx]"]
  node_app_dashboard_create_page["Create Match<br/>route<br/>[page.tsx]"]
  node_app_session_page["Session<br/>route<br/>[page.tsx]"]
  node_app_leaderboard_page["Leaderboard<br/>route<br/>[page.tsx]"]
  node_app_api_verbwire_route["Verbwire API<br/>server route<br/>[route.ts]"]
end

subgraph group_ui["Shared UI"]
  node_navbar["Navbar<br/>shell component<br/>[navbar.tsx]"]
  node_profile_icon(("Profile Icon<br/>shell component<br/>[profile-icon.tsx]"))
  node_mode_toggle(("Theme Toggle<br/>shell component<br/>[mode-toggle.tsx]"))
  node_summary["Summary<br/>dashboard component<br/>[summary.tsx]"]
  node_survey_input_form["Survey Form<br/>survey component<br/>[input-form.tsx]"]
  node_survey_questions["Questions<br/>survey component"]
  node_survey_complete["Survey Done<br/>survey component"]
  node_thanks_survey["Thanks Screen<br/>survey component<br/>[thanks-survey.tsx]"]
end

subgraph group_lib["Lib layer"]
  node_firebase[("Firebase<br/>backend init<br/>[firebase.ts]")]
  node_auth_hook(("Auth Hook<br/>state hook<br/>[use-auth.ts]"))
  node_sign_in_or_create["Sign In/Create<br/>identity helper"]
  node_get_user_data["User Data<br/>data helper<br/>[get-user-data.ts]"]
  node_questions["Questions<br/>content helper<br/>[questions.ts]"]
end

subgraph group_infra["App infra"]
  node_theme_provider["Theme Provider<br/>app shell<br/>[theme-provider.tsx]"]
end

node_app_page -->|"uses shell"| node_navbar
node_app_page -->|"uses theme"| node_theme_provider
node_app_form_page -->|"renders"| node_survey_input_form
node_app_form_page -->|"asks"| node_survey_questions
node_app_form_page -->|"identity flow"| node_sign_in_or_create
node_app_dashboard_page -->|"shows"| node_summary
node_app_dashboard_page -->|"loads profile"| node_get_user_data
node_app_dashboard_create_page -->|"extends"| node_app_dashboard_page
node_app_session_page -->|"loads profile"| node_get_user_data
node_app_leaderboard_page -->|"reads data"| node_firebase
node_app_api_verbwire_route -->|"integrates data"| node_firebase
node_app_api_verbwire_route -.->|"rewards flow"| node_app_leaderboard_page
node_navbar -->|"includes"| node_profile_icon
node_navbar -->|"includes"| node_mode_toggle
node_survey_input_form -->|"uses"| node_questions
node_survey_input_form -->|"persists"| node_firebase
node_survey_complete -->|"flows to"| node_thanks_survey
node_theme_provider -->|"supports"| node_mode_toggle
node_auth_hook -->|"coordinates"| node_sign_in_or_create
node_get_user_data -->|"reads"| node_firebase

click node_app_page "https://github.com/benjiavdullahu/intellex/blob/master/app/page.tsx"
click node_app_form_page "https://github.com/benjiavdullahu/intellex/blob/master/app/form/page.tsx"
click node_app_dashboard_page "https://github.com/benjiavdullahu/intellex/blob/master/app/dashboard/page.tsx"
click node_app_dashboard_create_page "https://github.com/benjiavdullahu/intellex/blob/master/app/dashboard/create/page.tsx"
click node_app_session_page "https://github.com/benjiavdullahu/intellex/blob/master/app/session/page.tsx"
click node_app_leaderboard_page "https://github.com/benjiavdullahu/intellex/blob/master/app/leaderboard/page.tsx"
click node_app_api_verbwire_route "https://github.com/benjiavdullahu/intellex/blob/master/app/api/verbwire/route.ts"
click node_navbar "https://github.com/benjiavdullahu/intellex/blob/master/components/component/navbar.tsx"
click node_profile_icon "https://github.com/benjiavdullahu/intellex/blob/master/components/component/profile-icon.tsx"
click node_mode_toggle "https://github.com/benjiavdullahu/intellex/blob/master/components/component/mode-toggle.tsx"
click node_summary "https://github.com/benjiavdullahu/intellex/blob/master/components/component/summary/summary.tsx"
click node_survey_input_form "https://github.com/benjiavdullahu/intellex/blob/master/components/component/survey/input-form.tsx"
click node_survey_questions "https://github.com/benjiavdullahu/intellex/blob/master/components/component/survey/survey-questions.tsx"
click node_survey_complete "https://github.com/benjiavdullahu/intellex/blob/master/components/component/survey/survey-complete.tsx"
click node_thanks_survey "https://github.com/benjiavdullahu/intellex/blob/master/components/component/survey/thanks-survey.tsx"
click node_theme_provider "https://github.com/benjiavdullahu/intellex/blob/master/components/theme-provider.tsx"
click node_firebase "https://github.com/benjiavdullahu/intellex/blob/master/lib/firebase.ts"
click node_auth_hook "https://github.com/benjiavdullahu/intellex/blob/master/lib/hooks/use-auth.ts"
click node_sign_in_or_create "https://github.com/benjiavdullahu/intellex/blob/master/lib/sign-in-or-create.ts"
click node_get_user_data "https://github.com/benjiavdullahu/intellex/blob/master/lib/get-user-data.ts"
click node_questions "https://github.com/benjiavdullahu/intellex/blob/master/lib/questions.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_app_page,node_app_form_page,node_app_dashboard_page,node_app_dashboard_create_page,node_app_session_page,node_app_leaderboard_page,node_app_api_verbwire_route toneBlue
class node_navbar,node_profile_icon,node_mode_toggle,node_summary,node_survey_input_form,node_survey_questions,node_survey_complete,node_thanks_survey toneAmber
class node_firebase,node_auth_hook,node_sign_in_or_create,node_get_user_data,node_questions toneMint
class node_theme_provider toneRose
```

## Components

### App routes

Next.js route-level screens and server endpoints.

- [Home](https://github.com/benjiavdullahu/intellex/blob/master/app/page.tsx): route · Landing entry point for the product. · `app/page.tsx`
- [Onboarding](https://github.com/benjiavdullahu/intellex/blob/master/app/form/page.tsx): route · Profile and skill-interest form flow. · `app/form/page.tsx`
- [Dashboard](https://github.com/benjiavdullahu/intellex/blob/master/app/dashboard/page.tsx): route · Core workspace for matched learning activity. · `app/dashboard/page.tsx`
- [Create Match](https://github.com/benjiavdullahu/intellex/blob/master/app/dashboard/create/page.tsx): route · Dashboard sub-route for creating or starting a match. · `app/dashboard/create/page.tsx`
- [Session](https://github.com/benjiavdullahu/intellex/blob/master/app/session/page.tsx): route · Interactive learning session and collaboration surface. · `app/session/page.tsx`
- [Leaderboard](https://github.com/benjiavdullahu/intellex/blob/master/app/leaderboard/page.tsx): route · Weekly rankings and rewards view. · `app/leaderboard/page.tsx`
- [Verbwire API](https://github.com/benjiavdullahu/intellex/blob/master/app/api/verbwire/route.ts): server route · Backend integration boundary for reward or NFT actions. · `app/api/verbwire/route.ts`

### Shared UI

Reusable shell, survey, and primitive components.

- [Navbar](https://github.com/benjiavdullahu/intellex/blob/master/components/component/navbar.tsx): shell component · Top-level navigation shell shared across screens. · `components/component/navbar.tsx`
- [Profile Icon](https://github.com/benjiavdullahu/intellex/blob/master/components/component/profile-icon.tsx): shell component · User identity and profile access affordance. · `components/component/profile-icon.tsx`
- [Theme Toggle](https://github.com/benjiavdullahu/intellex/blob/master/components/component/mode-toggle.tsx): shell component · Light/dark mode control for the app shell. · `components/component/mode-toggle.tsx`
- [Summary](https://github.com/benjiavdullahu/intellex/blob/master/components/component/summary/summary.tsx): dashboard component · Dashboard status or progress summary card. · `components/component/summary/summary.tsx`
- [Survey Form](https://github.com/benjiavdullahu/intellex/blob/master/components/component/survey/input-form.tsx): survey component · Interactive onboarding input form. · `components/component/survey/input-form.tsx`
- [Questions](https://github.com/benjiavdullahu/intellex/blob/master/components/component/survey/survey-questions.tsx): survey component · Questionnaire content for skill and interest capture. · `components/component/survey/survey-questions.tsx`
- [Survey Done](https://github.com/benjiavdullahu/intellex/blob/master/components/component/survey/survey-complete.tsx): survey component · Completion state for the onboarding flow. · `components/component/survey/survey-complete.tsx`
- [Thanks Screen](https://github.com/benjiavdullahu/intellex/blob/master/components/component/survey/thanks-survey.tsx): survey component · Post-survey acknowledgement screen. · `components/component/survey/thanks-survey.tsx`

### Lib layer

Authentication, data access, and questionnaire helpers.

- [Firebase](https://github.com/benjiavdullahu/intellex/blob/master/lib/firebase.ts): backend init · Central Firebase configuration and initialization. · `lib/firebase.ts`
- [Auth Hook](https://github.com/benjiavdullahu/intellex/blob/master/lib/hooks/use-auth.ts): state hook · Shared client auth state accessor. · `lib/hooks/use-auth.ts`
- [Sign In/Create](https://github.com/benjiavdullahu/intellex/blob/master/lib/sign-in-or-create.ts): identity helper · Sign-in and account creation boundary. · `lib/sign-in-or-create.ts`
- [User Data](https://github.com/benjiavdullahu/intellex/blob/master/lib/get-user-data.ts): data helper · Fetches user profile data for downstream screens. · `lib/get-user-data.ts`
- [Questions](https://github.com/benjiavdullahu/intellex/blob/master/lib/questions.ts): content helper · Question set used by the onboarding survey. · `lib/questions.ts`

### App infra

Global layout, styling, and theme plumbing.

- [Theme Provider](https://github.com/benjiavdullahu/intellex/blob/master/components/theme-provider.tsx): app shell · Global theme context for the UI. · `components/theme-provider.tsx`

## Connections

- Home → Navbar: uses shell · Landing page is wrapped by the shared navigation shell.
- Home → Theme Provider: uses theme · Landing page participates in global theming.
- Onboarding → Survey Form: renders · Onboarding route hosts the input form.
- Onboarding → Questions: asks · Form is driven by the questionnaire content.
- Onboarding → Sign In/Create: identity flow · Form flow likely creates or authenticates the user.
- Dashboard → Summary: shows · Dashboard surfaces progress and match summary.
- Dashboard → User Data: loads profile · Dashboard needs user-specific data to render.
- Create Match → Dashboard: extends · Create route is a dashboard sub-flow.
- Session → User Data: loads profile · Session view depends on the current user profile.
- Leaderboard → Firebase: reads data · Leaderboard likely consumes persisted rankings/reward data.
- Verbwire API → Firebase: integrates data · Server route likely reads or updates reward state around minting.
- Verbwire API → Leaderboard: rewards flow · Leaderboard culminates in an external reward action.
- Navbar → Profile Icon: includes · Shared navigation includes identity controls.
- Navbar → Theme Toggle: includes · Shared navigation includes theme switching.
- Survey Form → Questions: uses · Input form is driven by question definitions.
- Survey Form → Firebase: persists · Survey responses are stored in Firebase.
- Survey Done → Thanks Screen: flows to · Completion state transitions into the thank-you screen.
- Theme Provider → Theme Toggle: supports · Theme provider enables UI mode switching.
- Auth Hook → Sign In/Create: coordinates · Auth state underpins sign-in and account creation behavior.
- User Data → Firebase: reads · User data helper bridges UI state to Firebase records.
