# paaulmss/lynkn-app architecture

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

- Interactive diagram: https://gitdiagram.com/paaulmss/lynkn-app
- Repository: https://github.com/paaulmss/lynkn-app

## Overview

1. **Repository shape**
   - This is a two-part application: `lynkn-client` is the browser frontend, and `lynkn-server` is the API/backend.
   - The project is centered around a social-style product with authentication, posts, notifications, profiles, exploration/maps, and an admin area.

2. **Frontend runtime and shell**
   - The client is a **React + TypeScript + Vite** app.
   - `main.tsx` boots the app, `App.tsx` defines the top-level routing/layout, and global styles live in `index.css` / `App.css`.
   - The frontend is deployed separately; the presence of `vercel.json` suggests a Vercel-oriented client deployment.

3. **Client-side boundary and API access**
   - The browser does not appear to talk to data stores directly; it uses `src/api/axiosConfig.ts` and service modules to call the backend API.
   - `src/context/AuthProvider.tsx` and `src/context/AuthContext.tsx` hold session/auth state, while `src/hooks/useAuth.ts` is the consumer-facing auth hook.
   - `ProtectedRoute.tsx` is the main route boundary that blocks unauthenticated access.

4. **Frontend feature domains**
   - The UI is organized by product area under `src/pages`: `Home`, `Explore`, `Profile`, `Auth`, `Admin`.
   - There are reusable feature components for posts and notifications under `src/components/posts` and `src/components/notifcations`.
   - Post-related UI is modal-heavy: create post, post card, post detail, and participant panels are separate components.

5. **Specialized frontend integrations**
   - `src/hooks/useMapLibre.ts` and `ProfileMap.tsx` indicate map rendering through **MapLibre** for location-based/profile views.
   - `src/services/faceRecognition.ts` suggests a client-side face verification workflow, likely used around registration or re-verification.
   - `VerifyMobile.tsx` and `ReverifyModal.tsx` imply identity/verification steps beyond basic login.

6. **Backend runtime and structure**
   - The server is a **NestJS** application written in TypeScript.
   - `src/main.ts` is the bootstrap, and `app.module.ts` composes the feature modules.
   - The backend is packaged for containerized deployment via `Dockerfile`.

7. **Backend domain modules**
   - The server is split into clear domains: `auth`, `users`, `posts`, `notifications`, `admin`, and `socket`.
   - Each domain has its own controller/service/module boundary, which is the main architectural seam for the API.
   - Tests exist for the posts controller/service, indicating at least some module-level coverage.

8. **Authentication and authorization path**
   - `auth.controller.ts` and `auth.service.ts` handle login/session-related behavior.
   - `jwt.strategy.ts` and `jwt-auth.guard.ts` show JWT-based authentication on protected routes.
   - `admin.guard.ts` is a separate authorization layer for privileged/admin endpoints.

9. **Persistent data and external backend dependency**
   - `supabase.service.ts` is the strongest signal for the persistence layer: the Nest app likely uses **Supabase** as its primary backend/data provider.
   - The server therefore acts as the application API and policy layer, while Supabase is the external storage/auth/data infrastructure behind it.
   - `user.entity.ts` suggests a typed user model on the server side, even if the actual persistence is mediated through Supabase.

10. **Real-time and event-driven flow**
   - `socket/socket.gateway.ts` provides a WebSocket channel, likely for live notifications or immediate post/activity updates.
   - The notification subsystem has both an HTTP controller/service and a socket layer, implying that notifications can be created server-side and then pushed to connected clients.
   - The frontend notifications page/components are the consumption endpoint for this flow.

11. **Admin boundary**
   - `admin.controller.ts`, `admin.service.ts`, and `admin.module.ts` isolate privileged operations from normal user flows.
   - Access is enforced separately from ordinary JWT auth, so the diagram should show admin as a gated backend lane rather than just another page.

12. **Recommended architecture diagram view**
   - Show the system as: **browser client → NestJS API → Supabase**, with a separate **WebSocket/socket path** for real-time events.
   - On the client side, show distinct UI areas for auth, home/posts, explore/map, profile, notifications, and admin.
   - On the server side, show auth/users/posts/notifications/admin/socket as modules under the NestJS application boundary, with JWT/admin guards sitting in front of protected controllers.

Main entry points: [`lynkn-client/src/App.tsx`](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/App.tsx) (App shell), [`lynkn-server/src/app.module.ts`](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/app.module.ts) (App module), [`lynkn-client/src/api/axiosConfig.ts`](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/api/axiosConfig.ts) (API client), [`lynkn-server/src/supabase.service.ts`](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/supabase.service.ts) (Supabase)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["lynkn-client"]
  node_client_main(("main.tsx<br/>bootstrap<br/>[main.tsx]"))
  node_client_app["App shell<br/>routing/layout<br/>[App.tsx]"]
  node_client_auth["Auth flow<br/>session/ui<br/>[Login.tsx]"]
  node_client_home["Home feed<br/>posts/ui<br/>[Home.tsx]"]
  node_client_explore["Explore map<br/>map/ui<br/>[Explore.tsx]"]
  node_client_profile["Profile area<br/>profile/ui<br/>[Profile.tsx]"]
  node_client_notifications["Notifications<br/>activity/ui"]
  node_client_admin["Admin panel<br/>privileged/ui<br/>[AdminPanel.tsx]"]
  node_client_api["API client<br/>http client<br/>[axiosConfig.ts]"]
  node_client_auth_state["Auth state<br/>context/hook<br/>[AuthProvider.tsx]"]
  node_client_face["Face verify<br/>verification<br/>[faceRecognition.ts]"]
end

subgraph group_server["lynkn-server"]
  node_server_main(("main.ts<br/>bootstrap<br/>[main.ts]"))
  node_server_app["App module<br/>composition<br/>[app.module.ts]"]
  node_server_auth["Auth module<br/>[auth.module.ts]"]
  node_server_users["Users module<br/>[users.module.ts]"]
  node_server_posts["Posts module<br/>[posts.module.ts]"]
  node_server_notifications["Notifications module"]
  node_server_admin["Admin module<br/>[admin.module.ts]"]
  node_server_socket["Socket gateway<br/>realtime<br/>[socket.gateway.ts]"]
end

subgraph group_external["External"]
  node_server_supabase[("Supabase<br/>external backend")]
end

node_client_main -->|"bootstraps"| node_client_app
node_client_app -->|"routes"| node_client_auth
node_client_app -->|"routes"| node_client_home
node_client_app -->|"routes"| node_client_explore
node_client_app -->|"routes"| node_client_profile
node_client_app -->|"routes"| node_client_notifications
node_client_app -->|"routes"| node_client_admin
node_client_auth -->|"uses"| node_client_auth_state
node_client_auth_state -->|"calls"| node_client_api
node_client_home -->|"calls"| node_client_api
node_client_profile -->|"calls"| node_client_api
node_client_explore -->|"calls"| node_client_api
node_client_notifications -->|"calls"| node_client_api
node_client_admin -->|"calls"| node_client_api
node_client_profile -->|"verifies"| node_client_face
node_client_explore -.->|"realtime"| node_server_socket
node_server_main -->|"boots"| node_server_app
node_server_app -->|"composes"| node_server_auth
node_server_app -->|"composes"| node_server_users
node_server_app -->|"composes"| node_server_posts
node_server_app -->|"composes"| node_server_notifications
node_server_app -->|"composes"| node_server_admin
node_server_app -->|"composes"| node_server_socket
node_server_auth -->|"auth/data"| node_server_supabase
node_server_users -->|"reads/writes"| node_server_supabase
node_server_posts -->|"reads/writes"| node_server_supabase
node_server_notifications -->|"reads/writes"| node_server_supabase
node_server_admin -->|"reads/writes"| node_server_supabase
node_server_notifications -->|"pushes"| node_server_socket
node_server_auth -.->|"guards"| node_server_users
node_server_admin -.->|"gated by"| node_server_auth

click node_client_main "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/main.tsx"
click node_client_app "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/App.tsx"
click node_client_auth "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Auth/Login.tsx"
click node_client_home "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Home/Home.tsx"
click node_client_explore "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Explorer/Explore.tsx"
click node_client_profile "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Profile/Profile.tsx"
click node_client_notifications "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/components/notifcations/NotificationsPage.tsx"
click node_client_admin "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Admin/AdminPanel.tsx"
click node_client_api "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/api/axiosConfig.ts"
click node_client_auth_state "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/context/AuthProvider.tsx"
click node_client_face "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/services/faceRecognition.ts"
click node_server_main "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/main.ts"
click node_server_app "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/app.module.ts"
click node_server_auth "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/auth/auth.module.ts"
click node_server_users "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/users/users.module.ts"
click node_server_posts "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/posts/posts.module.ts"
click node_server_notifications "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/notifications/notifications.module.ts"
click node_server_admin "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/admin/admin.module.ts"
click node_server_socket "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/socket/socket.gateway.ts"
click node_server_supabase "https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/supabase.service.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_client_main,node_client_app,node_client_auth,node_client_home,node_client_explore,node_client_profile,node_client_notifications,node_client_admin,node_client_api,node_client_auth_state,node_client_face toneBlue
class node_server_main,node_server_app,node_server_auth,node_server_users,node_server_posts,node_server_notifications,node_server_admin,node_server_socket toneAmber
class node_server_supabase toneMint
```

## Components

### lynkn-client

React/Vite browser application

- [main.tsx](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/main.tsx): bootstrap · Client entrypoint that mounts the app · `lynkn-client/src/main.tsx`
- [App shell](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/App.tsx): routing/layout · Top-level routing and global layout · `lynkn-client/src/App.tsx`
- [Auth flow](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Auth/Login.tsx): session/ui · Login, register, verification, and route protection · `lynkn-client/src/pages/Auth/Login.tsx`
- [Home feed](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Home/Home.tsx): posts/ui · Main social feed and post creation/detail UI · `lynkn-client/src/pages/Home/Home.tsx`
- [Explore map](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Explorer/Explore.tsx): map/ui · Discovery view with MapLibre-based location rendering · `lynkn-client/src/pages/Explorer/Explore.tsx`
- [Profile area](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Profile/Profile.tsx): profile/ui · User profile, editing, reverify, and profile map · `lynkn-client/src/pages/Profile/Profile.tsx`
- [Notifications](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/components/notifcations/NotificationsPage.tsx): activity/ui · Notification list and item rendering · `lynkn-client/src/components/notifcations/NotificationsPage.tsx`
- [Admin panel](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/pages/Admin/AdminPanel.tsx): privileged/ui · Front-end surface for privileged operations · `lynkn-client/src/pages/Admin/AdminPanel.tsx`
- [API client](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/api/axiosConfig.ts): http client · Axios configuration and service layer for backend calls · `lynkn-client/src/api/axiosConfig.ts`
- [Auth state](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/context/AuthProvider.tsx): context/hook · Auth context, provider, and consumer hook · `lynkn-client/src/context/AuthProvider.tsx`
- [Face verify](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-client/src/services/faceRecognition.ts): verification · Client-side face recognition and mobile verification · `lynkn-client/src/services/faceRecognition.ts`

### lynkn-server

NestJS API application

- [main.ts](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/main.ts): bootstrap · NestJS application bootstrap · `lynkn-server/src/main.ts`
- [App module](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/app.module.ts): composition · Root module composing backend feature modules · `lynkn-server/src/app.module.ts`
- [Auth module](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/auth/auth.module.ts): auth · Login, JWT strategy, and auth guard boundaries · `lynkn-server/src/auth/auth.module.ts`
- [Users module](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/users/users.module.ts): users · User domain controller and service · `lynkn-server/src/users/users.module.ts`
- [Posts module](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/posts/posts.module.ts): posts · Post domain API and business logic · `lynkn-server/src/posts/posts.module.ts`
- [Notifications module](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/notifications/notifications.module.ts): notifications · Notification creation, retrieval, and push flow · `lynkn-server/src/notifications/notifications.module.ts`
- [Admin module](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/admin/admin.module.ts): admin · Privileged backend operations behind admin guard · `lynkn-server/src/admin/admin.module.ts`
- [Socket gateway](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/socket/socket.gateway.ts): realtime · WebSocket channel for live events · `lynkn-server/src/socket/socket.gateway.ts`

### External

Outside services used by the backend and client

- [Supabase](https://github.com/paaulmss/lynkn-app/blob/main/lynkn-server/src/supabase.service.ts): external backend · Primary persistence/backend dependency · `lynkn-server/src/supabase.service.ts`

## Connections

- main.tsx → App shell: bootstraps · Client entrypoint mounts the app shell
- App shell → Auth flow: routes · App shell exposes authentication and protected routes
- App shell → Home feed: routes · App shell exposes the feed/home experience
- App shell → Explore map: routes · App shell exposes discovery/map views
- App shell → Profile area: routes · App shell exposes profile screens
- App shell → Notifications: routes · App shell exposes notifications
- App shell → Admin panel: routes · App shell exposes admin area
- Auth flow → Auth state: uses · Authentication UI depends on auth context and hook
- Auth state → API client: calls · Auth state and services call backend API
- Home feed → API client: calls · Feed and post actions use the API client
- Profile area → API client: calls · Profile data and edits flow through the API client
- Explore map → API client: calls · Discovery data is fetched through backend endpoints
- Notifications → API client: calls · Notification data is loaded from the API
- Admin panel → API client: calls · Admin UI issues privileged backend requests
- Profile area → Face verify: verifies · Profile flow can invoke face/mobile verification
- Explore map → Socket gateway: realtime · Map and discovery views may react to live events
- main.ts → App module: boots · Nest bootstrap loads the root app module
- App module → Auth module: composes · Root module includes auth domain
- App module → Users module: composes · Root module includes users domain
- App module → Posts module: composes · Root module includes posts domain
- App module → Notifications module: composes · Root module includes notifications domain
- App module → Admin module: composes · Root module includes admin domain
- App module → Socket gateway: composes · Root module includes websocket gateway
- Auth module → Supabase: auth/data · Authentication logic relies on backend data services
- Users module → Supabase: reads/writes · User operations are mediated through Supabase
- Posts module → Supabase: reads/writes · Post storage and retrieval go through Supabase
- Notifications module → Supabase: reads/writes · Notification persistence uses Supabase
- Admin module → Supabase: reads/writes · Admin workflows operate on the same backend data layer
- Notifications module → Socket gateway: pushes · Notification service can broadcast live updates
- Auth module → Users module: guards · JWT-authenticated requests depend on user identity
- Admin module → Auth module: gated by · Admin operations are protected by admin authorization
