How abraham3stack/migrate-ai works
Purpose and Deployable Entry Points
MigrateAI is a full-stack migration-services platform: public pathway discovery, authenticated user migration workflows, and role-restricted administration. The Next.js 15 frontend starts at web/src/app/layout.tsx and route groups under web/src/app; the Express API starts at server/src/server.ts, configures middleware/routes in server/src/app.ts, and aggregates API modules in server/src/routes/index.ts.
Frontend Delivery and Route Domains
Next App Router separates marketing, authentication, user dashboard, and admin experiences through layouts and route groups. Feature modules encapsulate UI, API adapters, hooks, and types, while pages mostly compose these modules.
• User application shell: web/src/app/(dashboard)/layout.tsx, web/src/components/layout/dashboard-shell.tsx
• Marketing/public pathways: web/src/app/(marketing)/pathways/page.tsx, web/src/modules/marketing/components/pathways-content.tsx
• Admin operations: web/src/app/(admin)/layout.tsx, web/src/modules/admin/components/admin-page.tsx
• Route protection occurs at web/src/middleware.ts and web/src/modules/auth/components/protected-route.tsx.
Client State, API, and Real-Time Boundary
The browser uses Axios API adapters, TanStack Query feature hooks, and Zustand for cross-page auth/notification/layout state. The API client owns JWT attachment and refresh behavior; UI calls domain-specific adapters rather than Express directly. Socket clients receive real-time notifications/admin events.
• web/src/lib/api/client.ts, web/src/lib/api/auth.api.ts
• web/src/store/auth-store.ts, web/src/components/providers/query-provider.tsx
• web/src/lib/socket/client.ts, web/src/modules/notifications/hooks/use-realtime-notifications.ts
API Layer and Security Pipeline
Express follows route → controller → service → Prisma flow. DTOs/validation constrain inputs; shared async/error middleware standardizes failures. JWT authentication, refresh-token handling, role guards, and per-domain rate-limit middleware establish the principal trust boundary between public, user, and admin APIs.
• server/src/routes/index.ts, server/src/common/middleware/error.middleware.ts
• server/src/modules/auth/routes/auth.routes.ts, server/src/modules/auth/middleware/auth.middleware.ts, server/src/modules/auth/middleware/role.guard.ts
• server/src/modules/auth/services/auth.service.ts
Migration Workflow Domain
Pathways are the core catalog and user-engagement domain, supporting saved pathways, contact requests, and applications. Profile/assessment data drives readiness and dashboard views; documents support upload and administrative review; fees/payment entries track migration financial steps.
• server/src/modules/pathways/services/pathway.service.ts, server/src/modules/applications/services/application.service.ts
• server/src/modules/profile/services/profile.service.ts, server/src/modules/dashboard/services/dashboard.service.ts
• server/src/modules/documents/services/document.service.ts, server/src/modules/fees/services/fee.service.ts
Platform Engagement and Administration
Feeds, notifications/activity, resources, webinars, and success stories provide community and content surfaces. Admin routes manage users and operational entities; Socket.IO authenticates connections and supports event delivery.
• server/src/modules/feeds/services/feed.service.ts, server/src/modules/notifications/services/notification.service.ts
• server/src/modules/admin/services/admin.service.ts, server/src/common/socket/socket.server.ts
• server/src/modules/webinars/services/webinar.service.ts, server/src/modules/resources/services/resource.service.ts
Persistence and External Integrations
Prisma models and migrations define a PostgreSQL-backed system of record, including auth/audit, pathways, documents, AI conversations, Google accounts, and payment foundations. AI services abstract Gemini, OpenAI, and OpenRouter behind one domain service. Payments integrate Paystack. Google OAuth is configured server-side. Current avatar/document upload middleware uses server-local storage, requiring object storage for durable production deployments.
• server/prisma/schema.prisma, server/prisma/migrations/20260528100000_add_ai_conversations/migration.sql
• server/src/modules/ai/services/ai.service.ts, server/src/modules/ai/providers/openai-provider.ts
• server/src/modules/payments/services/paystack.service.ts, server/src/modules/documents/middleware/document-upload.middleware.ts
Main entry points: auth.middleware.ts Security pipeline · schema.prisma PostgreSQL system of record · layout.tsx Route domains · document.service.ts Documents and fees
Components 20
Next.js frontend
- Next app entry
web/src/app/layout.tsx - Route domains · Marketing, dashboard, and admin route groups separate experiences.
web/src/app/(dashboard)/layout.tsx - Public pathways UI
web/src/modules/marketing/components/pathways-content.tsx - Admin UI
web/src/modules/admin/components/admin-page.tsx - Route protection
web/src/middleware.ts - Client data boundary · Adapters attach and refresh JWTs; hooks manage server state.
web/src/lib/api/client.ts - Realtime client
web/src/modules/notifications/hooks/use-realtime-notifications.ts
Express API
- Express server
server/src/server.ts - API route registry
server/src/routes/index.ts - Security pipeline · Authentication, refresh handling, role guards, rate limits, and error handling.
server/src/modules/auth/middleware/auth.middleware.ts - Socket.IO server · Authenticates connections and delivers notification/admin events.
server/src/common/socket/socket.server.ts
Domain services
- Auth service
server/src/modules/auth/services/auth.service.ts - Migration workflow · Catalog, saved pathways, contacts, and migration applications.
server/src/modules/pathways/services/pathway.service.ts - User progress · Profile, assessment, and readiness/dashboard views.
server/src/modules/profile/services/profile.service.ts - Documents and fees · Upload/review documents and track financial steps.
server/src/modules/documents/services/document.service.ts - Engagement content · Feeds, notifications, resources, webinars, and stories.
server/src/modules/notifications/services/notification.service.ts - Admin operations
server/src/modules/admin/services/admin.service.ts
Persistence & integrations
- PostgreSQL system of record · Models cover auth, audit, migration data, documents, AI, and payments.
server/prisma/schema.prisma - External services · AI providers are abstracted behind one service.
server/src/modules/ai/services/ai.service.ts - Local upload storage · Current document storage needs object storage for durable production use.
server/src/modules/documents/middleware/document-upload.middleware.ts
Connections 27
- Next app entry → Route domains: renders
- Route domains → Public pathways UI: public pathway pages
- Route domains → Admin UI: admin pages
- Route protection → Route domains: protects
- Route domains → Client data boundary: uses
- Client data boundary → Express server: HTTPS API
- Realtime client → Socket.IO server: Socket.IO
- Express server → API route registry: mounts
- API route registry → Security pipeline: applies trust boundary
- Security pipeline → Auth service: auth requests
- Security pipeline → Migration workflow: authorized requests
- Security pipeline → User progress: authorized requests
- Security pipeline → Documents and fees: authorized requests
- Security pipeline → Engagement content: authorized requests
- Security pipeline → Admin operations: role-restricted requests
- Auth service → PostgreSQL system of record: persists identities
- Migration workflow → PostgreSQL system of record: persists workflow
- User progress → PostgreSQL system of record: persists progress
- Documents and fees → PostgreSQL system of record: persists records
- Documents and fees → Local upload storage: uploads files
- Engagement content → PostgreSQL system of record: persists content
- Admin operations → PostgreSQL system of record: manages entities
- Engagement content → Socket.IO server: emits events
- Admin operations → Socket.IO server: emits admin events
- Migration workflow → External services: AI assistance
- Documents and fees → External services: payment processing
- Auth service → External services: Google OAuth