How abrartoha/educonnect works
1. Repository shape
EduConnect is a monorepo with three user-facing runtimes and one shared backend: server/ for the API, client/ for the web SPA, and mobile/ for the Expo app. The web and mobile apps both consume the same backend API rather than talking directly to the database.
2. Backend as the system of record
The server/ workspace is the architectural center. It is a Node 20 + Express application using Prisma to persist data in PostgreSQL. All core business state lives here: users, profiles, posts, marketplace listings, leads/enquiries, campaigns, reviews, and admin operations.
3. Module boundaries on the server
The backend is split by feature area under server/src/modules/: auth, posts, directory, business, and admin. Each module has controllers, routes, and schemas, which makes the API surface explicit and keeps feature logic separated. The directory and business modules are especially important because they power the marketplace and enquiry workflows.
4. Data access and schema layer
Prisma is the persistence boundary. server/prisma/schema.prisma defines the domain model, while migrations show the evolution of features such as universities, meetings, messaging, and later simplification/removal of some of those models. This indicates the architecture is database-first with generated typed access through Prisma rather than ad hoc SQL.
5. Authentication and session model
Authentication is handled on the server with JWTs, cookies, CSRF protection, password hashing, and shared auth middleware. The repo uses both access/refresh token helpers and cookie utilities, so the system is designed around browser sessions rather than pure bearer-token APIs. Role-based access is a first-class concern because the app serves students, universities, agents, consultants, and admins.
6. Primary user flows
The most important product flows are feed/posts, marketplace browsing, role dashboards, and enquiry submission. Students can create and browse posts, explore directory listings for universities/agents/consultants, and contact a listing owner. Recipients can then review leads from their dashboards and update status through the backend.
7. Email-backed enquiries
A key architectural feature is the enquiry pipeline. When a student submits an enquiry, the server persists a Lead record and sends an email via nodemailer to the recipient, with the student as reply-to. In production this uses configured SMTP; in development it falls back to Ethereal preview URLs, so the email service is part of the core product flow rather than a peripheral notification layer.
8. Scheduled background jobs
server/src/jobs/cron.js introduces background processing for cleanup and lifecycle automation, including token cleanup and campaign auto-ending. This means some domain transitions happen asynchronously rather than only during request/response cycles.
9. Web client architecture
The client/ workspace is a React 19 + Vite SPA with React Router and Zustand. It is organized by page and component categories: landing pages, feed, marketplace, auth, dashboards, admin, and static/legal pages. The client is responsible for rendering the public marketing site plus authenticated role-specific UI.
10. Client-server integration
The web app has a dedicated API layer under client/src/api/ with endpoint definitions, mappers, and an API client, plus a useApiResource hook for data fetching. That separation suggests the UI consumes a normalized backend contract and then adapts raw API responses into view-friendly shapes. The store folder handles auth hydration and shared state across the SPA.
11. Mobile app parity
The mobile/ workspace mirrors much of the client’s domain structure: feed, marketplace, business, profile, admin, posts, and auth. It uses React Navigation with auth and main stacks, and stores auth tokens in AsyncStorage. This indicates the mobile app is a parallel client of the same backend, not a separate product with its own data model.
12. Shared domain surfaces across clients
Both clients expose the same core product concepts—feed/posts, directory listings, dashboards, and enquiries—but with different UI stacks. The mobile app has a slightly more compact feature set and native navigation, while the web app includes richer landing pages, admin screens, and an exploratory campus experience under client/src/pages/explore/.
13. Deployment and runtime boundaries
The repository includes containerization artifacts for both server and client, plus a Vercel config for the web app and a GitHub Actions deploy workflow. The practical runtime split is: Express API on port 5050, web SPA on 5173 in dev, and Expo Metro for mobile. PostgreSQL is an external infrastructure dependency required by the backend.
14. Cross-cutting concerns
Shared server middleware covers CORS, CSRF, security headers, rate limiting, validation, and centralized error handling. Those concerns define the trust boundary between clients and the API, and they are part of the architecture diagram because they sit in front of every feature module.
15. How to draw the diagram
A good architecture diagram should place PostgreSQL and email delivery as external dependencies behind the server, with the server in the center exposing role-aware API routes. The web SPA and mobile app should be shown as separate consumers of the same API, while background cron jobs attach to the server/database side for asynchronous maintenance.
Main entry points: schema.prisma Prisma Schema · index.js Modules · App.js Mobile Shell · campaigns.controller.js Business
Components 21
Server
Express API, Prisma persistence, shared middleware, and scheduled jobs.
- API App · Bootstraps the Node API and wires modules and middleware.
server/src/app.js - Modules · Feature-sliced route surface for auth, posts, directory, business, and admin.
server/src/modules/index.js - Auth · Login, signup, tokens, cookies, and session handling.
server/src/modules/auth/auth.controller.js - Posts · Feed and post lifecycle APIs.
server/src/modules/posts/posts.controller.js - Directory · Profiles and marketplace directory APIs for universities and advisors.
server/src/modules/directory/directory.controller.js - Business · Leads, campaigns, and reviews workflows for recipient dashboards.
server/src/modules/business/campaigns.controller.js - Admin · Administrative management APIs for platform oversight.
server/src/modules/admin/admin.controller.js - Prisma Schema · Domain model and generated database access boundary.
server/prisma/schema.prisma - Cron Jobs · Asynchronous cleanup and lifecycle automation.
server/src/jobs/cron.js - Security Layer · CORS, CSRF, auth, validation, security headers, rate limits, and errors.
server/src/shared/middleware/auth.js
Web SPA
React/Vite browser client with pages, UI composition, and API integration.
- Web SPA · Browser client for landing pages, dashboards, marketplace, and admin UI.
client/src/App.jsx - API Layer · Endpoint definitions, response mappers, and API client wrapper.
client/src/api/client.js - Store · Shared auth and UI state hydration for the SPA.
client/src/store/useStore.js - Pages · Landing, feed, marketplace, dashboards, auth, static, and explore screens.
client/src/pages/Landing.jsx
Mobile App
Expo/React Native client with navigation, screens, and local auth storage.
- Mobile Shell · React Native app shell with navigation and app bootstrap.
mobile/App.js - Navigator · Auth and main navigation stacks for native routing.
mobile/src/navigation/RootNavigator.js - API Layer · Endpoint definitions, mappers, and API client for the shared backend.
mobile/src/api/client.js - Auth State · Token persistence and auth context for native sessions.
mobile/src/auth/AuthContext.js - Screens · Feed, marketplace, business, posts, profile, admin, auth, and dashboard screens.
mobile/src/screens/feed/FeedScreen.js
External Infra
Database and email delivery services used by the backend.
- Email Service · Sends enquiry emails and development previews.
- PostgreSQL · System of record for users, posts, listings, leads, campaigns, and related state.
Connections 26
- API App → Security Layer: uses · All requests pass through shared security and validation controls.
- API App → Modules: mounts · The app composes the feature route modules.
- Modules → Auth: exposes · Authentication endpoints.
- Modules → Posts: exposes · Feed and post endpoints.
- Modules → Directory: exposes · Directory and profile endpoints.
- Modules → Business: exposes · Lead, campaign, and review endpoints.
- Modules → Admin: exposes · Admin endpoints.
- Auth → Prisma Schema: reads/writes · User accounts, sessions, and auth-related records.
- Posts → Prisma Schema: reads/writes · Post and feed state.
- Directory → Prisma Schema: reads/writes · Profiles and marketplace listings.
- Business → Prisma Schema: reads/writes · Leads, campaigns, and reviews.
- Admin → Prisma Schema: reads/writes · Administrative data operations.
- Business → Email Service: sends · Enquiry notifications to listing owners.
- Cron Jobs → Prisma Schema: maintains · Cleans up tokens and closes campaigns.
- Prisma Schema → PostgreSQL: persists · Prisma stores the domain model in PostgreSQL.
- Web SPA → API Layer: uses · The SPA talks to the backend through its API layer.
- Web SPA → Store: shares state · Authentication and UI state are centralized in the store.
- Web SPA → Pages: renders · Pages provide the major user-facing surfaces.
- API Layer → API App: calls · Web client requests the shared backend API.
- Mobile Shell → Navigator: uses · Native app bootstraps through the navigator.
- Mobile Shell → API Layer: uses · Mobile client talks to the same backend API.
- Mobile Shell → Auth State: shares state · Tokens and auth context are managed locally.
- Mobile Shell → Screens: renders · Screens implement the main native experiences.
- API Layer → API App: calls · Mobile client consumes the shared backend API.
- Auth State → Auth: supports · Native login and session flows depend on server auth.
- Business → Directory: depends on · Marketplace enquiries connect directory listings to leads.