How abdelqaouinabil/smirisapp works
Project Type & Purpose
• This is a monorepo full-stack web application (“SmirisApp”), a language-learning platform connecting students, tutors, and schools.
• Frontend: React/TypeScript SPA (Vite, Tailwind, i18n)
• Backend: Node.js/TypeScript API (Express-style routes, Passport JWT auth)
• Database: PostgreSQL
Main Components
a. User Clients
• Web browser (desktop, tablet, mobile)
• Roles: Student, Tutor, School, Admin
b. Frontend SPA
• Vite dev/production server
• Routes & pages (Homepage, Dashboards, Booking, Admin Panel, etc.)
• Contexts (AuthContext, ComparisonContext)
• UI component library (accordion, button, form, etc.)
• i18n subsystem (locale JSON files)
• PaymentIntegration & OAuth2Integration modules
c. Backend API Server
• Entry: server/src/server.ts
• Middleware: auth (JWT via Passport), errorHandler
• Routes (admin, auth, bookings, courses, payments, reviews, schools, tutors, visa)
• Database layer: connection.ts, migrations (init, add-subject-column), seed.ts, schema.sql
• File storage: server/uploads (CVs, certificates)
d. Database
• PostgreSQL instance
• Key tables: users, schools, tutors, courses, bookings, payments, visa_services
e. External Services
• Payment gateway (Stripe or similar)
• OAuth providers (Google, Facebook, etc.)
• (Optional) Email/SMS notifications, third-party visa API
f. Deployment & DevOps
• Dockerfiles (prod/dev), docker-compose.yml, deploy.sh
• CI/CD target (Vercel for frontend, container registry)
Relationships & Data Flows
• User → Frontend SPA (UI interactions, form submissions)
• SPA → Backend API (/api/*) over HTTP(S)
• Attaches JWT (access, refresh) for protected routes
• API → PostgreSQL via parameterized queries (connection.ts)
• API ↔ External services (payment gateway calls, OAuth token exchange, visa API if any)
• API → File Storage for upload/download of tutor files
• Backend emits notifications (pulled via API or websockets if implemented)
Architectural Patterns & Principles
• Monorepo separation: “src/” frontend vs. “server/src/” backend
• Layered backend:
• Config layer (passport.ts, connection.ts)
• Middleware layer (auth, error handling)
• Routing layer (per-entity route modules)
• Data access (migrations, seeds, raw SQL)
• SPA state management via React Context + custom hooks
• Internationalization via resource bundles (JSON locales)
• Component-driven UI library (atomic components under ui/)
• Secure RESTful API with role-based access control
Detailed Capture of Architectural Elements
• API authentication flow: login request, token issuance, token refresh, protected route check
• File upload/download path (HTTP multipart to /api/tutors/:id/files → uploads/)
• Major REST endpoints clusters (e.g., /api/bookings, /api/payments)
• Call out i18n lookup sequence if relevant (SPA → locales/*.json)