How usjav/devlink works
1. System shape
- DevLink is a two-tier application: a React/Vite client in client/ and an Express/MongoDB API server in server/.
- The frontend is the interactive product surface; the backend owns persistence, authentication, and all domain operations.
2. Frontend application shell
- client/src/main.jsx and client/src/App.jsx boot the React app.
- client/src/routes.js defines the page-level navigation, so the UI is organized as a route-driven single-page app rather than server-rendered pages.
3. Role-based UI split
- The client is explicitly divided into two user experiences:
- Developer-facing pages/components for search, recommendations, applications, and profile management.
- Company-facing pages/components for job posting, applicant review, and company settings.
- This is reflected in client/src/pages/dev/* and client/src/pages/company/*, plus role-specific navbars and cards.
4. Shared frontend building blocks
- Reusable UI lives in client/src/components/, including job cards, navbars, footer, settings forms, and application review cards.
- AuthContext.jsx and useAuthContext.jsx centralize auth state for the client, so login/session information is shared across route views.
- globalConstants.js, svgIcons.jsx, and joy_imports.jsx suggest shared styling/icon/config helpers for the design system.
5. Frontend feature surfaces
- Developer flows: job search, job details, apply, recommendations, dashboard, profile setup, settings, password change, delete account.
- Company flows: company dashboard, post a job, job detail/applicant management, profile setup, settings.
- The structure implies the UI is organized around these workflows more than around generic CRUD screens.
6. Client-side data access pattern
- The frontend likely uses Axios to call the backend REST API.
- Pages and components consume server data, then render role-specific cards and forms; state is kept in React and auth context rather than in a separate global store.
7. Backend API boundary
- server/index.js is the Express entry point.
- Routing is split by concern in server/routes/: authRoute, jobRoute, companyRoute, devRoute, aiRoute, and testRoute.
- This means API responsibilities are partitioned by domain rather than by frontend page.
8. Backend domain logic
- Controllers in server/controllers/ hold the business logic:
- userController for auth/user account operations
- devController for developer profile/application actions
- companyController for company profile and hiring actions
- jobController for job post/search/application workflows
- aiController for recommendation or AI-assisted features
- The routes map to these controllers, keeping HTTP handling separate from domain logic.
9. Persistence model
- MongoDB is accessed through Mongoose models in server/models/.
- The domain is split into user, dev, company, and jobpost collections/models, which matches the role-based product design.
- This implies a separation between account identity and role-specific profile data.
10. Authentication and authorization
- The README and file structure indicate JWT-based auth.
- Auth likely starts in the auth route/controller, then client auth state is stored in context and used to gate developer/company views and API calls.
- Role separation is a key architectural boundary: a user is not just “logged in,” but logged in as a developer or company actor.
11. Key data flow
- Typical flow: user action in a page/component → Axios request → Express route → controller → Mongoose model → MongoDB → JSON response → React state update/render.
- For hiring flows, the same path is used for posting jobs, applying, reviewing applicants, and changing application status.
12. AI/recommendation subsystem
- aiRoute and aiController are a distinct subsystem, likely supporting job recommendations or other AI-assisted matching features called out in the README.
- Architecturally, it sits behind the same API layer as the rest of the backend, but it is separate from core CRUD/domain routes.
13. Deployment/runtime boundaries
- The client is a Vite app and includes vercel.json, which suggests frontend deployment is decoupled from the backend.
- The server is a standalone Node/Express process configured via environment variables, with MongoDB as an external dependency.
14. What to draw in an architecture diagram
- Show two primary blocks: browser/client SPA and API server.
- Inside the client, separate developer UX and company UX, both sharing auth context and common components.
- Inside the server, separate routes → controllers → Mongoose models → MongoDB, with a distinct AI path and JWT auth cross-cutting the API.
Main entry points: App.jsx App shell · routes.js Routes · controllers Controllers · authRoute.js Auth route
Components 21
Client SPA
React/Vite browser application with role-based experiences.
- App boot · Bootstraps the React application.
client/src/main.jsx - App shell · Top-level client container and layout.
client/src/App.jsx - Routes · Defines page-level navigation for the single-page app.
client/src/routes.js - Auth context · Shared login/session state for the frontend.
client/src/components/AuthContext.jsx - Shared UI · Reusable cards, navbars, settings forms, and helpers.
client/src/components - Developer UX · Developer-facing search, recommendations, applications, and profile flows.
client/src/pages/dev - Company UX · Company-facing job posting, review, and settings flows.
client/src/pages/company - Public pages · Login and signup entry screens.
client/src/pages/Login.jsx - UI helpers · Constants, icons, and design-system imports used across the client.
client/src/globalConstants.js
API Server
Express application with domain routes, controllers, and persistence.
- Server entry · Starts the Node/Express API server.
server/index.js - API routes · Domain-partitioned HTTP endpoints.
server/routes - Auth route · Login and account authentication endpoints.
server/routes/authRoute.js - Domain routes · Job, company, developer, and AI endpoints.
server/routes/jobRoute.js - Controllers · Holds domain operations behind the HTTP layer.
server/controllers - AI subsystem · Recommendation and AI-assisted matching workflow.
server/controllers/aiController.js
Persistence
MongoDB-backed domain models.
- Models · MongoDB data models for users, roles, and job posts.
server/models - User · Core identity and account record.
server/models/user.js - Role profiles · Developer and company profile data.
server/models/dev.js - Job posts · Job posting and application data.
server/models/jobpost.js - MongoDB · External persistence backing the application.
Other components
- Browser · End-user access point for the SPA.
Connections 22
- Browser → App boot: opens · User loads the SPA in the browser.
- App boot → App shell: boots · React mounts the root application shell.
- App shell → Routes: navigates · App shell delegates view selection to the route map.
- Routes → Public pages: includes · Public auth screens are part of routing.
- Routes → Developer UX: includes · Developer role views are routed here.
- Routes → Company UX: includes · Company role views are routed here.
- App shell → Auth context: shares state · Top-level app provides auth/session context.
- App shell → Shared UI: uses · Shell and pages reuse shared UI building blocks.
- App shell → UI helpers: imports · Shared UI helpers support the client shell.
- Developer UX → Auth context: reads session · Developer views use shared authentication state.
- Company UX → Auth context: reads session · Company views use shared authentication state.
- Developer UX → Auth route: calls api · Developer flows authenticate and fetch protected data.
- Company UX → Auth route: calls api · Company flows authenticate and fetch protected data.
- Server entry → API routes: mounts · Express entry wires up route modules.
- API routes → Auth route: exposes · Authentication endpoints are registered here.
- API routes → Domain routes: exposes · Domain feature endpoints are registered here.
- Auth route → Controllers: delegates · Auth routes forward to user/account logic.
- Domain routes → Controllers: delegates · Domain routes forward to business logic.
- Controllers → Models: queries · Controllers read and write through the model layer.
- Models → MongoDB: persists · Mongoose models store data in MongoDB.
- Controllers → AI subsystem: includes · AI-driven matching/recommendation logic is separated from core CRUD.
- AI subsystem → Models: uses data · AI features rely on stored user/job records.