# aswin327/senm-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/aswin327/senm-frontend
- Repository: https://github.com/aswin327/senm-frontend

## Overview

This is a SENM engineering-services marketplace frontend, built as a Next.js application. Users can register as clients or engineers, sign in, and access marketplace and account areas including opportunities, projects, quotes, messages, profiles, reviews, and settings. The evidenced engineer-registration flow validates details, submits professional information and completes registration through React Query hooks and API modules. The UI also has profile, portfolio, quote-building, and project-workspace capabilities. Many feature pages are present in the tree, but their runtime connections are not shown in the excerpts; those links are omitted rather than inferred.

Main entry points: [`lib/api/index.ts`](https://github.com/aswin327/senm-frontend/blob/main/lib/api/index.ts) (API exports), [`app/register/page.tsx`](https://github.com/aswin327/senm-frontend/blob/main/app/register/page.tsx) (Registration entry), [`app/register/components/EngineerWizard.tsx`](https://github.com/aswin327/senm-frontend/blob/main/app/register/components/EngineerWizard.tsx) (Engineer registration), [`hooks/useAuth.ts`](https://github.com/aswin327/senm-frontend/blob/main/hooks/useAuth.ts) (Authentication state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app_shell["Application shell<br/>[layout.tsx]"]
  node_navigation["Navigation"]
end

subgraph group_onboard["Identity and onboarding"]
  node_login_page["Sign in<br/>[page.tsx]"]
  node_auth_hook["Authentication state<br/>[useAuth.ts]"]
  node_auth_api["Authentication API<br/>[auth.api.ts]"]
  node_register_page["Registration entry<br/>[page.tsx]"]
  node_role_select["Role selection<br/>[RoleSelect.tsx]"]
  node_client_form["Client registration<br/>[ClientForm.tsx]"]
  node_engineer_wizard["Engineer registration<br/>[EngineerWizard.tsx]"]
  node_engineer_confirm["Submission confirmation"]
  node_registration_hook["Registration workflow<br/>[useRegistration.ts]"]
  node_registration_api["Registration API"]
end

subgraph group_market["Marketplace work"]
  node_opportunities["Opportunities<br/>[Opportunities.tsx]"]
  node_opportunity_detail["Opportunity details"]
  node_projects["Projects<br/>[Projects.tsx]"]
  node_workspace["Project workspace"]
  node_workspace_data["Workspace data<br/>[workspace.ts]"]
  node_quotes["Quotes<br/>[Quotes.tsx]"]
  node_quote_builder["Quote builder<br/>[QuoteBuilder.tsx]"]
  node_quote_data["Quote builder data<br/>[quote-builder.ts]"]
  node_messages["Messages<br/>[Messages.tsx]"]
end

subgraph group_account["Professional account"]
  node_portfolio_hook["Portfolio mutations<br/>[usePortfolio.ts]"]
  node_portfolio_api["Portfolio API<br/>[portfolio.api.ts]"]
  node_profile_editor["Profile editor<br/>[ProfileEditor.tsx]"]
  node_profile_hook["Profile data<br/>[useProfile.ts]"]
  node_profile_api["Profile API<br/>[profile.api.ts]"]
  node_profile_reviews["Profile reviews<br/>[ProfileReviews.tsx]"]
  node_reviews["Reviews<br/>[Reviews.tsx]"]
  node_settings["Settings<br/>[Settings.tsx]"]
end

subgraph group_platform["Client data access"]
  node_api_facade["API exports<br/>[index.ts]"]
  node_api_client["HTTP client<br/>[client.ts]"]
  node_access_token["Access token<br/>[token.ts]"]
  node_error_handler["API error handling<br/>[error-handler.ts]"]
end

node_visitor(("Visitor or user"))

node_visitor -->|"opens"| node_app_shell
node_app_shell -->|"renders"| node_navigation
node_visitor -->|"signs in"| node_login_page
node_login_page -->|"uses"| node_auth_hook
node_auth_hook -->|"calls"| node_auth_api
node_visitor -->|"registers"| node_register_page
node_register_page -->|"renders"| node_role_select
node_register_page -->|"renders"| node_client_form
node_register_page -->|"renders"| node_engineer_wizard
node_register_page -->|"renders"| node_engineer_confirm
node_engineer_wizard -->|"uses"| node_auth_hook
node_engineer_wizard -->|"submits through"| node_registration_hook
node_engineer_wizard -->|"uses"| node_portfolio_hook
node_registration_hook -->|"calls"| node_registration_api
node_portfolio_hook -->|"calls"| node_portfolio_api
node_visitor -->|"browses"| node_opportunities
node_visitor -->|"views"| node_projects
node_visitor -.->|"opens"| node_workspace
node_workspace -->|"reads"| node_workspace_data
node_visitor -.->|"views"| node_quotes
node_visitor -.->|"builds quote"| node_quote_builder
node_quote_builder -->|"reads"| node_quote_data
node_visitor -.->|"opens"| node_messages
node_visitor -->|"edits profile"| node_profile_editor
node_profile_editor -.->|"uses"| node_profile_hook
node_profile_hook -->|"calls"| node_profile_api
node_visitor -.->|"views"| node_profile_reviews
node_visitor -.->|"views"| node_reviews
node_visitor -->|"opens"| node_settings
node_auth_hook -->|"imports"| node_api_facade
node_registration_hook -->|"imports"| node_api_facade
node_portfolio_hook -->|"imports"| node_api_facade
node_api_facade -->|"exports"| node_auth_api
node_api_facade -->|"exports"| node_registration_api
node_api_facade -->|"exports"| node_portfolio_api
node_api_facade -->|"exports"| node_profile_api
node_auth_api -->|"uses"| node_api_client
node_api_client -->|"reads and updates"| node_access_token

click node_app_shell "https://github.com/aswin327/senm-frontend/blob/main/app/layout.tsx"
click node_navigation "https://github.com/aswin327/senm-frontend/blob/main/components/layout/NavigationWrapper.tsx"
click node_login_page "https://github.com/aswin327/senm-frontend/blob/main/app/login/page.tsx"
click node_auth_hook "https://github.com/aswin327/senm-frontend/blob/main/hooks/useAuth.ts"
click node_auth_api "https://github.com/aswin327/senm-frontend/blob/main/lib/api/auth.api.ts"
click node_register_page "https://github.com/aswin327/senm-frontend/blob/main/app/register/page.tsx"
click node_role_select "https://github.com/aswin327/senm-frontend/blob/main/app/register/components/RoleSelect.tsx"
click node_client_form "https://github.com/aswin327/senm-frontend/blob/main/app/register/components/ClientForm.tsx"
click node_engineer_wizard "https://github.com/aswin327/senm-frontend/blob/main/app/register/components/EngineerWizard.tsx"
click node_engineer_confirm "https://github.com/aswin327/senm-frontend/blob/main/app/register/components/EngineerConfirm.tsx"
click node_registration_hook "https://github.com/aswin327/senm-frontend/blob/main/hooks/useRegistration.ts"
click node_registration_api "https://github.com/aswin327/senm-frontend/blob/main/lib/api/registration.api.ts"
click node_portfolio_hook "https://github.com/aswin327/senm-frontend/blob/main/hooks/usePortfolio.ts"
click node_portfolio_api "https://github.com/aswin327/senm-frontend/blob/main/lib/api/portfolio.api.ts"
click node_opportunities "https://github.com/aswin327/senm-frontend/blob/main/components/opportunities/Opportunities.tsx"
click node_opportunity_detail "https://github.com/aswin327/senm-frontend/blob/main/components/opportunities/OpportunityDetail.tsx"
click node_projects "https://github.com/aswin327/senm-frontend/blob/main/components/projects/Projects.tsx"
click node_workspace "https://github.com/aswin327/senm-frontend/blob/main/components/projects/ProjectWorkspace.tsx"
click node_workspace_data "https://github.com/aswin327/senm-frontend/blob/main/data/workspace.ts"
click node_quotes "https://github.com/aswin327/senm-frontend/blob/main/components/quotes/Quotes.tsx"
click node_quote_builder "https://github.com/aswin327/senm-frontend/blob/main/components/quotes/QuoteBuilder.tsx"
click node_quote_data "https://github.com/aswin327/senm-frontend/blob/main/data/quote-builder.ts"
click node_messages "https://github.com/aswin327/senm-frontend/blob/main/components/messages/Messages.tsx"
click node_profile_editor "https://github.com/aswin327/senm-frontend/blob/main/components/profile/ProfileEditor.tsx"
click node_profile_hook "https://github.com/aswin327/senm-frontend/blob/main/hooks/useProfile.ts"
click node_profile_api "https://github.com/aswin327/senm-frontend/blob/main/lib/api/profile.api.ts"
click node_profile_reviews "https://github.com/aswin327/senm-frontend/blob/main/components/profile/ProfileReviews.tsx"
click node_reviews "https://github.com/aswin327/senm-frontend/blob/main/components/reviews/Reviews.tsx"
click node_settings "https://github.com/aswin327/senm-frontend/blob/main/components/settings/Settings.tsx"
click node_api_facade "https://github.com/aswin327/senm-frontend/blob/main/lib/api/index.ts"
click node_api_client "https://github.com/aswin327/senm-frontend/blob/main/lib/api/client.ts"
click node_access_token "https://github.com/aswin327/senm-frontend/blob/main/lib/auth/token.ts"
click node_error_handler "https://github.com/aswin327/senm-frontend/blob/main/lib/utils/error-handler.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_shell,node_navigation,node_visitor toneBlue
class node_login_page,node_auth_hook,node_auth_api,node_register_page,node_role_select,node_client_form,node_engineer_wizard,node_engineer_confirm,node_registration_hook,node_registration_api toneAmber
class node_opportunities,node_opportunity_detail,node_projects,node_workspace,node_workspace_data,node_quotes,node_quote_builder,node_quote_data,node_messages toneMint
class node_portfolio_hook,node_portfolio_api,node_profile_editor,node_profile_hook,node_profile_api,node_profile_reviews,node_reviews,node_settings toneRose
class node_api_facade,node_api_client,node_access_token,node_error_handler toneIndigo
```

## Components

### Web experience

- [Application shell](https://github.com/aswin327/senm-frontend/blob/main/app/layout.tsx): `app/layout.tsx`
- [Navigation](https://github.com/aswin327/senm-frontend/blob/main/components/layout/NavigationWrapper.tsx): `components/layout/NavigationWrapper.tsx`

### Identity and onboarding

- [Sign in](https://github.com/aswin327/senm-frontend/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Authentication state](https://github.com/aswin327/senm-frontend/blob/main/hooks/useAuth.ts): `hooks/useAuth.ts`
- [Authentication API](https://github.com/aswin327/senm-frontend/blob/main/lib/api/auth.api.ts): `lib/api/auth.api.ts`
- [Registration entry](https://github.com/aswin327/senm-frontend/blob/main/app/register/page.tsx): `app/register/page.tsx`
- [Role selection](https://github.com/aswin327/senm-frontend/blob/main/app/register/components/RoleSelect.tsx): `app/register/components/RoleSelect.tsx`
- [Client registration](https://github.com/aswin327/senm-frontend/blob/main/app/register/components/ClientForm.tsx): `app/register/components/ClientForm.tsx`
- [Engineer registration](https://github.com/aswin327/senm-frontend/blob/main/app/register/components/EngineerWizard.tsx): `app/register/components/EngineerWizard.tsx`
- [Submission confirmation](https://github.com/aswin327/senm-frontend/blob/main/app/register/components/EngineerConfirm.tsx): `app/register/components/EngineerConfirm.tsx`
- [Registration workflow](https://github.com/aswin327/senm-frontend/blob/main/hooks/useRegistration.ts): `hooks/useRegistration.ts`
- [Registration API](https://github.com/aswin327/senm-frontend/blob/main/lib/api/registration.api.ts): `lib/api/registration.api.ts`

### Marketplace work

- [Opportunities](https://github.com/aswin327/senm-frontend/blob/main/components/opportunities/Opportunities.tsx): `components/opportunities/Opportunities.tsx`
- [Opportunity details](https://github.com/aswin327/senm-frontend/blob/main/components/opportunities/OpportunityDetail.tsx): `components/opportunities/OpportunityDetail.tsx`
- [Projects](https://github.com/aswin327/senm-frontend/blob/main/components/projects/Projects.tsx): `components/projects/Projects.tsx`
- [Project workspace](https://github.com/aswin327/senm-frontend/blob/main/components/projects/ProjectWorkspace.tsx): `components/projects/ProjectWorkspace.tsx`
- [Workspace data](https://github.com/aswin327/senm-frontend/blob/main/data/workspace.ts): `data/workspace.ts`
- [Quotes](https://github.com/aswin327/senm-frontend/blob/main/components/quotes/Quotes.tsx): `components/quotes/Quotes.tsx`
- [Quote builder](https://github.com/aswin327/senm-frontend/blob/main/components/quotes/QuoteBuilder.tsx): `components/quotes/QuoteBuilder.tsx`
- [Quote builder data](https://github.com/aswin327/senm-frontend/blob/main/data/quote-builder.ts): `data/quote-builder.ts`
- [Messages](https://github.com/aswin327/senm-frontend/blob/main/components/messages/Messages.tsx): `components/messages/Messages.tsx`

### Professional account

- [Portfolio mutations](https://github.com/aswin327/senm-frontend/blob/main/hooks/usePortfolio.ts): `hooks/usePortfolio.ts`
- [Portfolio API](https://github.com/aswin327/senm-frontend/blob/main/lib/api/portfolio.api.ts): `lib/api/portfolio.api.ts`
- [Profile editor](https://github.com/aswin327/senm-frontend/blob/main/components/profile/ProfileEditor.tsx): `components/profile/ProfileEditor.tsx`
- [Profile data](https://github.com/aswin327/senm-frontend/blob/main/hooks/useProfile.ts): `hooks/useProfile.ts`
- [Profile API](https://github.com/aswin327/senm-frontend/blob/main/lib/api/profile.api.ts): `lib/api/profile.api.ts`
- [Profile reviews](https://github.com/aswin327/senm-frontend/blob/main/components/profile/ProfileReviews.tsx): `components/profile/ProfileReviews.tsx`
- [Reviews](https://github.com/aswin327/senm-frontend/blob/main/components/reviews/Reviews.tsx): `components/reviews/Reviews.tsx`
- [Settings](https://github.com/aswin327/senm-frontend/blob/main/components/settings/Settings.tsx): `components/settings/Settings.tsx`

### Client data access

- [API exports](https://github.com/aswin327/senm-frontend/blob/main/lib/api/index.ts): `lib/api/index.ts`
- [HTTP client](https://github.com/aswin327/senm-frontend/blob/main/lib/api/client.ts): `lib/api/client.ts`
- [Access token](https://github.com/aswin327/senm-frontend/blob/main/lib/auth/token.ts): `lib/auth/token.ts`
- [API error handling](https://github.com/aswin327/senm-frontend/blob/main/lib/utils/error-handler.ts): `lib/utils/error-handler.ts`

### Other components

- **Visitor or user**

## Connections

- Visitor or user → Application shell: opens
- Application shell → Navigation: renders (evidence: `app/layout.tsx`)
- Visitor or user → Sign in: signs in (evidence: `app/login/page.tsx`)
- Sign in → Authentication state: uses (evidence: `app/login/page.tsx`)
- Authentication state → Authentication API: calls (evidence: `hooks/useAuth.ts`)
- Visitor or user → Registration entry: registers (evidence: `app/register/page.tsx`)
- Registration entry → Role selection: renders (evidence: `app/register/page.tsx`)
- Registration entry → Client registration: renders (evidence: `app/register/page.tsx`)
- Registration entry → Engineer registration: renders (evidence: `app/register/page.tsx`)
- Registration entry → Submission confirmation: renders (evidence: `app/register/page.tsx`)
- Engineer registration → Authentication state: uses (evidence: `app/register/components/EngineerWizard.tsx`)
- Engineer registration → Registration workflow: submits through (evidence: `app/register/components/EngineerWizard.tsx`)
- Engineer registration → Portfolio mutations: uses (evidence: `app/register/components/EngineerWizard.tsx`)
- Registration workflow → Registration API: calls (evidence: `hooks/useRegistration.ts`)
- Portfolio mutations → Portfolio API: calls (evidence: `hooks/usePortfolio.ts`)
- Visitor or user → Opportunities: browses
- Visitor or user → Projects: views
- Visitor or user → Project workspace: opens
- Project workspace → Workspace data: reads (evidence: `components/projects/ProjectWorkspace.tsx`)
- Visitor or user → Quotes: views
- Visitor or user → Quote builder: builds quote
- Quote builder → Quote builder data: reads (evidence: `components/quotes/QuoteBuilder.tsx`)
- Visitor or user → Messages: opens
- Visitor or user → Profile editor: edits profile
- Profile editor → Profile data: uses
- Profile data → Profile API: calls (evidence: `hooks/useProfile.ts`)
- Visitor or user → Profile reviews: views
- Visitor or user → Reviews: views
- Visitor or user → Settings: opens
- Authentication state → API exports: imports (evidence: `hooks/useAuth.ts`)
- Registration workflow → API exports: imports (evidence: `hooks/useRegistration.ts`)
- Portfolio mutations → API exports: imports (evidence: `hooks/usePortfolio.ts`)
- API exports → Authentication API: exports (evidence: `lib/api/index.ts`)
- API exports → Registration API: exports (evidence: `lib/api/index.ts`)
- API exports → Portfolio API: exports (evidence: `lib/api/index.ts`)
- API exports → Profile API: exports (evidence: `lib/api/index.ts`)
- Authentication API → HTTP client: uses (evidence: `lib/api/auth.api.ts`)
- HTTP client → Access token: reads and updates (evidence: `lib/api/client.ts`)
