How ma7moudalysalem/scholarpath works
1. Overall shape
ScholarPath is a monorepo with three main runtime areas: a React/Vite client, an ASP.NET Core 10 backend, and a separate analytics stack. The core business system follows Clean Architecture: the API host is thin, application logic is organized by feature module, domain entities stay pure, and infrastructure contains persistence and external integrations.
2. Client boundary
client/ is a single-page app built with React 19, TypeScript, Vite, Tailwind v4, TanStack Query, Zustand, and SignalR clients. It is the only user-facing presentation layer; all business operations go through client/src/services/api/* or real-time hubs. Routing, role-based layouts, and auth guards live in client/src/routes and client/src/components/layout, which mirrors the platform’s gated access model.
3. Backend entrypoint
server/src/ScholarPath.API is the HTTP host. It contains controllers per feature area, middleware for exceptions, maintenance mode, and security headers, plus SignalR hubs and webhook endpoints. The API does not implement business rules directly; controllers dispatch into MediatR request handlers in the application layer.
4. Application layer as the orchestration center
server/src/ScholarPath.Application is the main use-case layer. It is split into modules matching product epics such as Auth, Profile, Scholarships, Applications, Bookings, Community, AI, Payments, Notifications, Admin, Audit, ProfitShare, Resources, and Analytics. Each module exposes commands, queries, DTOs, validators, and event handlers, which makes it the best place to place functional boundaries on a diagram.
5. Domain layer
server/src/ScholarPath.Domain holds the business model: entities, enums, domain events, exceptions, and small shared abstractions like ICurrentUserService. This layer models the platform’s core concepts such as users, scholarships, applications, bookings, payments, notifications, chat, community posts, documents, reviews, upgrade requests, and audit-related state. It is deliberately dependency-free and is the center of the architecture.
6. Infrastructure layer
server/src/ScholarPath.Infrastructure implements persistence and integration concerns. It contains the EF Core ApplicationDbContext, migrations, seed data, encryption-aware model configuration, background jobs, SignalR presence tracking, file storage, email delivery, Stripe, Azure OpenAI, Azure Communication Services, Power BI, audit services, and local/stub implementations for development. This layer is where external systems enter the platform.
7. Primary data stores and external services
The operational store is SQL Server 2022 via EF Core. Redis supports real-time scale-out and/or ephemeral coordination. MailHog is used for development email capture. External services include Stripe for payments and Connect payouts, Azure services for AI, key management, and meetings, plus Blob storage and Key Vault in production. These integrations materially shape the architecture because they are wrapped behind application interfaces.
8. Authentication and access flow
Auth is built around ASP.NET Core Identity plus RS256 JWTs and refresh-token rotation. The flow includes registration, login, email verification, password reset, SSO, role selection/switching, and onboarding gating. The client uses auth state and route guards; the server enforces access by role and current-user context.
9. Realtime and event-driven paths
The platform uses SignalR for chat, community updates, and notifications. In the backend, application event handlers translate domain/application events into notifications, audits, and hub pushes. Presence tracking and message delivery live in infrastructure, so the real-time boundary is: command/query handlers update state, then event handlers fan out updates to connected clients.
10. Payments and financial workflow
Payments are a first-class subsystem, not a library call. Stripe PaymentIntents, webhooks, refunds, Connect accounts, and payout jobs are all modeled explicitly. Booking payments, scholarship provider review payments, and profit-share configuration are separate but related flows, with business rules implemented in application services and state transitions enforced before infrastructure calls.
11. AI and knowledge subsystem
The AI module includes chatbot, eligibility checking, recommendation generation, recommendation-click logging, import of external scholarships, knowledge-base rebuild, and fine-tuning workflows. Infrastructure provides OpenAI/embedding services, knowledge retrieval/indexing, and dataset providers. The analytics and AI subsystems are connected through curated data, not direct client-side computation.
12. Analytics stack
analytics/ is a separate data platform that extracts CDC data into bronze storage through Azure Data Factory, transforms it with dbt into silver/gold models, and publishes Power BI/streaming outputs. It is fed from operational SQL data and supports admin, consultant, and student reporting. This is a distinct read-optimized boundary from the OLTP backend.
13. Background processing and automation
Scheduled and asynchronous work is centralized in infrastructure jobs: booking reminders, completion handling, data export/delete, no-show sweeps, scholarship auto-close, review timeouts/refunds, session expiry, payout processing, and redaction sampling. These jobs are the backbone for SLA-driven behavior that should be drawn separately from request/response paths.
14. Security, audit, and compliance
Security-sensitive behavior is cross-cutting: field encryption, file scanning, audit logging, rate limiting, and webhook idempotency are built into the backend. Audit and privacy workflows include data export/delete requests, redaction review, and compliance logs. These concerns appear throughout the layers rather than as a single module.
15. Testing and delivery
The repo is heavily test-driven at both layers: xUnit integration/unit tests on the backend and Vitest/Playwright on the frontend. GitHub Actions runs build, test, lint/typecheck, docs, and security scans. Containerized local dev (docker-compose.yml, Dockerfiles) supports the backend, client, SQL Server, Redis, and mail services.
16. How to diagram it
A good architecture diagram should show a thin SPA client calling a .NET API host, the API delegating into MediatR-based application modules, those modules depending on pure domain abstractions, and infrastructure binding the app to SQL Server and external systems like Stripe, Azure OpenAI, email, file storage, SignalR, and analytics pipelines. The strongest boundaries are: presentation vs API, application vs domain, domain vs infrastructure, and operational OLTP vs analytics warehouse.
Main entry points: ScholarPath.API API Host · ScholarPath.Application Application · src SPA · ScholarPath.Infrastructure Infrastructure
Components 22
Client
React/Vite SPA presentation layer
- SPA · Single-page app for students, consultants, companies, and admins
client/src - Routes · Route guards, role-based layouts, and page composition
client/src/routes - API SDK · Typed client wrappers for backend endpoints
client/src/services/api - Realtime · Chat, community, and notification hub connections
client/src/services/signalR
Server
ASP.NET Core clean architecture backend
- API Host · Thin HTTP entrypoint with controllers, hubs, and middleware
server/src/ScholarPath.API - Controllers · Feature controllers, webhooks, diagnostics, and status endpoints
server/src/ScholarPath.API/Controllers - Middleware · Exception handling, maintenance mode, and security headers
server/src/ScholarPath.API/Middleware - Application · MediatR orchestration layer split by product epics
server/src/ScholarPath.Application - Auth & Profile · Registration, login, role switching, onboarding, profile, and privacy
server/src/ScholarPath.Application/Auth - Business Ops · Scholarships, applications, bookings, payments, reviews, resources, and admin
server/src/ScholarPath.Application/Scholarships - Events · Domain/application events fan out to notifications and hub pushes
server/src/ScholarPath.Application/Streaming - Domain · Pure business model and shared domain contracts
server/src/ScholarPath.Domain - Infrastructure · EF Core context, repositories, external services, and adapters
server/src/ScholarPath.Infrastructure - Persistence · DbContext, migrations, seeding, and model configuration
server/src/ScholarPath.Infrastructure/Persistence - Integrations · Stripe, email, AI, file storage, key vault, Power BI, and auth support
server/src/ScholarPath.Infrastructure/Services - Jobs · Reminders, refunds, expiries, export/delete, payout, and audit sweeps
server/src/ScholarPath.Infrastructure/Jobs
Analytics
Separate reporting and warehouse stack
- Analytics · CDC ingestion, dbt modeling, and Power BI outputs
analytics - ADF · Copies operational SQL changes into bronze storage and reverse ETL
analytics/adf - dbt · Silver and gold transformations for reporting marts
analytics/dbt - Power BI · Embedded reports, dataflows, and streaming datasets
analytics/powerbi
Connections 26
- SPA → Routes: uses · SPA renders through route guards and layout shells
- SPA → API SDK: calls · User actions go through typed HTTP clients
- SPA → Realtime: subscribes · Live updates flow through SignalR clients
- API SDK → API Host: HTTP · Front end talks to the .NET API host
- Realtime → API Host: SignalR · Client connects to backend hubs
- API Host → Controllers: exposes · Controllers and webhooks define the external API
- API Host → Middleware: wraps · Request pipeline is protected by middleware
- Controllers → Application: dispatches · Controllers forward requests into application handlers
- Application → Auth & Profile: contains · Identity and onboarding use cases
- Application → Business Ops: contains · Domain workflows and feature modules
- Application → Events: publishes · Event handlers project updates to notifications and hubs
- Application → Domain: depends on · Application logic depends on pure domain concepts
- Domain → Infrastructure: implemented by · Infrastructure supplies persistence and adapters behind domain-facing interfaces
- Infrastructure → Persistence: persists to · EF Core maps the domain to SQL Server
- Infrastructure → Integrations: integrates with · External services are wrapped behind application ports
- Infrastructure → Jobs: runs · Scheduled and asynchronous workflows live here
- Events → Integrations: pushes via · Notifications and real-time notifications are delivered through infrastructure adapters
- Business Ops → Integrations: uses · Payments, email, AI, file storage, and meetings are accessed through ports
- Analytics → ADF: ingests · CDC and reverse ETL land into bronze
- Analytics → dbt: transforms · Warehouse models are built from staged data
- Analytics → Power BI: publishes · Modeled data feeds embedded and operational reports
- Tests → API Host: verifies · Integration tests cover API behavior
- Tests → SPA: verifies · Frontend tests cover UI and flows
- Deploy → API Host: deploys · Container and cloud definitions package the backend
- Deploy → SPA: deploys · Client container and hosting assets package the SPA
- Deploy → Analytics: provisions · Infra and CI include the analytics stack