# lxwkxy/mobg architecture

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

- Interactive diagram: https://gitdiagram.com/lxwkxy/mobg
- Repository: https://github.com/lxwkxy/mobg

## Overview

MobG is a team project-management application. The intended user workflow spans sign-in, project and membership management, then tasks, comments, activity, and dashboard views. The README distinguishes implemented backend capabilities from contract-only features and a frontend that still uses local mocks; the graph reflects that boundary rather than implying a live web-to-API integration. Backend routes, guards, project persistence, and mapping are shown where excerpts or the source index support them; unsampled feature implementations are not inferred.

Main entry points: [`backend/src/middleware/auth.ts`](https://github.com/lxwkxy/mobg/blob/main/backend/src/middleware/auth.ts) (Session and role guards), [`backend/src/routes/projects.ts`](https://github.com/lxwkxy/mobg/blob/main/backend/src/routes/projects.ts) (Project routes), [`backend/src/server.ts`](https://github.com/lxwkxy/mobg/blob/main/backend/src/server.ts) (Auth endpoint), [`backend/src/services/projectDb.ts`](https://github.com/lxwkxy/mobg/blob/main/backend/src/services/projectDb.ts) (Project data access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_web_auth["Login and register<br/>[page.tsx]"]
  node_web_projects["Project screens"]
  node_web_tasks["Task list<br/>[page.tsx]"]
  node_web_dashboard["Dashboard<br/>[page.tsx]"]
  node_web_project_api["Project API client<br/>[projectApi.ts]"]
end

subgraph group_api["Backend API"]
  node_auth_routes["Auth endpoint<br/>[server.ts]"]
  node_me_route["Current user route<br/>[me.ts]"]
  node_users_route["Users route<br/>[users.ts]"]
  node_projects_route["Project routes<br/>[projects.ts]"]
  node_contracts["API contracts<br/>[api.ts]"]
end

subgraph group_identity["Identity and provisioning"]
  node_auth_engine["Better Auth setup<br/>[auth.ts]"]
  node_guards["Session and role guards<br/>[auth.ts]"]
  node_provisioning["Account provisioning<br/>[accounts.ts]"]
end

subgraph group_data["Persistence and mapping"]
  node_project_store["Project data access<br/>[projectDb.ts]"]
  node_auth_store["Identity lookup<br/>[authDb.ts]"]
  node_mapping["Project response mapping<br/>[project.ts]"]
  node_db_helpers["Database helpers<br/>[dbHelpers.ts]"]
end

node_user(("Team member"))
node_postgres[("PostgreSQL")]

node_user -->|"uses"| node_web_auth
node_user -->|"uses"| node_web_projects
node_user -->|"uses"| node_web_tasks
node_user -->|"uses"| node_web_dashboard
node_web_projects -.->|"uses"| node_web_project_api
node_auth_routes -->|"dispatches"| node_auth_engine
node_auth_routes -->|"routes"| node_me_route
node_auth_routes -->|"routes"| node_users_route
node_auth_routes -->|"routes"| node_projects_route
node_me_route -->|"guards"| node_guards
node_users_route -->|"guards"| node_guards
node_projects_route -->|"guards"| node_guards
node_projects_route -->|"queries"| node_project_store
node_projects_route -->|"maps responses"| node_mapping
node_projects_route -->|"types responses"| node_contracts
node_guards -->|"checks sessions"| node_auth_engine
node_guards -->|"resolves identity"| node_auth_store
node_guards -->|"checks membership"| node_project_store
node_project_store -->|"uses transactions"| node_db_helpers
node_mapping -->|"converts IDs"| node_db_helpers
node_auth_store -->|"queries"| node_postgres
node_project_store -->|"reads and writes"| node_postgres
node_auth_engine -->|"stores auth data"| node_postgres
node_provisioning -->|"creates accounts"| node_auth_engine
node_provisioning -->|"links profiles"| node_postgres
node_web_tasks -.->|"feature contract"| node_contracts
node_web_dashboard -.->|"feature contract"| node_contracts

click node_web_auth "https://github.com/lxwkxy/mobg/blob/main/web/app/(auth)/login/page.tsx"
click node_web_projects "https://github.com/lxwkxy/mobg/tree/main/web/app/(main)/projects"
click node_web_tasks "https://github.com/lxwkxy/mobg/blob/main/web/app/(main)/mytasks/page.tsx"
click node_web_dashboard "https://github.com/lxwkxy/mobg/blob/main/web/app/(main)/dashboard/page.tsx"
click node_web_project_api "https://github.com/lxwkxy/mobg/blob/main/web/lib/projectApi.ts"
click node_auth_routes "https://github.com/lxwkxy/mobg/blob/main/backend/src/server.ts"
click node_me_route "https://github.com/lxwkxy/mobg/blob/main/backend/src/routes/me.ts"
click node_users_route "https://github.com/lxwkxy/mobg/blob/main/backend/src/routes/users.ts"
click node_projects_route "https://github.com/lxwkxy/mobg/blob/main/backend/src/routes/projects.ts"
click node_contracts "https://github.com/lxwkxy/mobg/blob/main/backend/src/contracts/api.ts"
click node_auth_engine "https://github.com/lxwkxy/mobg/blob/main/backend/src/auth.ts"
click node_guards "https://github.com/lxwkxy/mobg/blob/main/backend/src/middleware/auth.ts"
click node_provisioning "https://github.com/lxwkxy/mobg/blob/main/backend/src/provisioning/accounts.ts"
click node_project_store "https://github.com/lxwkxy/mobg/blob/main/backend/src/services/projectDb.ts"
click node_auth_store "https://github.com/lxwkxy/mobg/blob/main/backend/src/services/authDb.ts"
click node_mapping "https://github.com/lxwkxy/mobg/blob/main/backend/src/mappers/project.ts"
click node_db_helpers "https://github.com/lxwkxy/mobg/blob/main/backend/src/services/dbHelpers.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_web_auth,node_web_projects,node_web_tasks,node_web_dashboard,node_web_project_api toneBlue
class node_auth_routes,node_me_route,node_users_route,node_projects_route,node_contracts,node_postgres toneAmber
class node_auth_engine,node_guards,node_provisioning toneMint
class node_project_store,node_auth_store,node_mapping,node_db_helpers toneRose
class node_user toneIndigo
```

## Components

### Web experience

- [Login and register](https://github.com/lxwkxy/mobg/blob/main/web/app/(auth)/login/page.tsx): `web/app/(auth)/login/page.tsx`
- [Project screens](https://github.com/lxwkxy/mobg/tree/main/web/app/(main)/projects): `web/app/(main)/projects`
- [Task list](https://github.com/lxwkxy/mobg/blob/main/web/app/(main)/mytasks/page.tsx): `web/app/(main)/mytasks/page.tsx`
- [Dashboard](https://github.com/lxwkxy/mobg/blob/main/web/app/(main)/dashboard/page.tsx): `web/app/(main)/dashboard/page.tsx`
- [Project API client](https://github.com/lxwkxy/mobg/blob/main/web/lib/projectApi.ts): `web/lib/projectApi.ts`

### Backend API

- [Auth endpoint](https://github.com/lxwkxy/mobg/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Current user route](https://github.com/lxwkxy/mobg/blob/main/backend/src/routes/me.ts): `backend/src/routes/me.ts`
- [Users route](https://github.com/lxwkxy/mobg/blob/main/backend/src/routes/users.ts): `backend/src/routes/users.ts`
- [Project routes](https://github.com/lxwkxy/mobg/blob/main/backend/src/routes/projects.ts): `backend/src/routes/projects.ts`
- [API contracts](https://github.com/lxwkxy/mobg/blob/main/backend/src/contracts/api.ts): `backend/src/contracts/api.ts`

### Identity and provisioning

- [Better Auth setup](https://github.com/lxwkxy/mobg/blob/main/backend/src/auth.ts): `backend/src/auth.ts`
- [Session and role guards](https://github.com/lxwkxy/mobg/blob/main/backend/src/middleware/auth.ts): `backend/src/middleware/auth.ts`
- [Account provisioning](https://github.com/lxwkxy/mobg/blob/main/backend/src/provisioning/accounts.ts): `backend/src/provisioning/accounts.ts`

### Persistence and mapping

- [Project data access](https://github.com/lxwkxy/mobg/blob/main/backend/src/services/projectDb.ts): `backend/src/services/projectDb.ts`
- [Identity lookup](https://github.com/lxwkxy/mobg/blob/main/backend/src/services/authDb.ts): `backend/src/services/authDb.ts`
- [Project response mapping](https://github.com/lxwkxy/mobg/blob/main/backend/src/mappers/project.ts): `backend/src/mappers/project.ts`
- [Database helpers](https://github.com/lxwkxy/mobg/blob/main/backend/src/services/dbHelpers.ts): `backend/src/services/dbHelpers.ts`

### Other components

- **Team member**
- **PostgreSQL**

## Connections

- Team member → Login and register: uses (evidence: `README.md`)
- Team member → Project screens: uses (evidence: `README.md`)
- Team member → Task list: uses (evidence: `README.md`)
- Team member → Dashboard: uses (evidence: `README.md`)
- Project screens → Project API client: uses
- Auth endpoint → Better Auth setup: dispatches (evidence: `backend/src/server.ts`)
- Auth endpoint → Current user route: routes (evidence: `backend/src/server.ts`)
- Auth endpoint → Users route: routes (evidence: `backend/src/server.ts`)
- Auth endpoint → Project routes: routes (evidence: `backend/src/server.ts`)
- Current user route → Session and role guards: guards (evidence: `backend/src/routes/me.ts`)
- Users route → Session and role guards: guards (evidence: `backend/src/routes/users.ts`)
- Project routes → Session and role guards: guards (evidence: `backend/src/routes/projects.ts`)
- Project routes → Project data access: queries (evidence: `backend/src/routes/projects.ts`)
- Project routes → Project response mapping: maps responses (evidence: `backend/src/routes/projects.ts`)
- Project routes → API contracts: types responses (evidence: `backend/src/routes/projects.ts`)
- Session and role guards → Better Auth setup: checks sessions (evidence: `backend/src/middleware/auth.ts`)
- Session and role guards → Identity lookup: resolves identity (evidence: `backend/src/middleware/auth.ts`)
- Session and role guards → Project data access: checks membership (evidence: `backend/src/middleware/auth.ts`)
- Project data access → Database helpers: uses transactions (evidence: `backend/src/services/projectDb.ts`)
- Project response mapping → Database helpers: converts IDs (evidence: `backend/src/mappers/project.ts`)
- Identity lookup → PostgreSQL: queries (evidence: `backend/src/services/authDb.ts`)
- Project data access → PostgreSQL: reads and writes (evidence: `backend/src/services/projectDb.ts`)
- Better Auth setup → PostgreSQL: stores auth data (evidence: `backend/src/auth.ts`)
- Account provisioning → Better Auth setup: creates accounts (evidence: `backend/src/provisioning/accounts.ts`)
- Account provisioning → PostgreSQL: links profiles (evidence: `backend/src/provisioning/accounts.ts`)
- Task list → API contracts: feature contract (evidence: `README.md`)
- Dashboard → API contracts: feature contract (evidence: `README.md`)
