How paaulmss/lynkn-app works
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: App.tsx App shell · app.module.ts App module · axiosConfig.ts API client · supabase.service.ts Supabase
Components 20
lynkn-client
React/Vite browser application
- main.tsx · Client entrypoint that mounts the app
lynkn-client/src/main.tsx - App shell · Top-level routing and global layout
lynkn-client/src/App.tsx - Auth flow · Login, register, verification, and route protection
lynkn-client/src/pages/Auth/Login.tsx - Home feed · Main social feed and post creation/detail UI
lynkn-client/src/pages/Home/Home.tsx - Explore map · Discovery view with MapLibre-based location rendering
lynkn-client/src/pages/Explorer/Explore.tsx - Profile area · User profile, editing, reverify, and profile map
lynkn-client/src/pages/Profile/Profile.tsx - Notifications · Notification list and item rendering
lynkn-client/src/components/notifcations/NotificationsPage.tsx - Admin panel · Front-end surface for privileged operations
lynkn-client/src/pages/Admin/AdminPanel.tsx - API client · Axios configuration and service layer for backend calls
lynkn-client/src/api/axiosConfig.ts - Auth state · Auth context, provider, and consumer hook
lynkn-client/src/context/AuthProvider.tsx - Face verify · Client-side face recognition and mobile verification
lynkn-client/src/services/faceRecognition.ts
lynkn-server
NestJS API application
- main.ts · NestJS application bootstrap
lynkn-server/src/main.ts - App module · Root module composing backend feature modules
lynkn-server/src/app.module.ts - Auth module · Login, JWT strategy, and auth guard boundaries
lynkn-server/src/auth/auth.module.ts - Users module · User domain controller and service
lynkn-server/src/users/users.module.ts - Posts module · Post domain API and business logic
lynkn-server/src/posts/posts.module.ts - Notifications module · Notification creation, retrieval, and push flow
lynkn-server/src/notifications/notifications.module.ts - Admin module · Privileged backend operations behind admin guard
lynkn-server/src/admin/admin.module.ts - Socket gateway · WebSocket channel for live events
lynkn-server/src/socket/socket.gateway.ts
External
Outside services used by the backend and client
- Supabase · Primary persistence/backend dependency
lynkn-server/src/supabase.service.ts
Connections 31
- 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