How quartermasters/epaethicsapp works
Project Type & Purpose
• This is a full-stack, cross-platform federal ethics training system (“EthicsGo”) composed of:
– A React-based Admin Portal (Next.js)
– A React Native mobile app (Expo)
– A Node.js backend API (Express/Fastify)
• Mission: Deliver compliant, accessible, secure ethics training with AI-powered learning paths, real-time analytics, and multi-platform sync.
High-Level File-Structure Analysis
• Top-level directories:
– admin-portal → Next.js app (app folder, components, content-management, quiz-editor, auth pages, styling, Tailwind, TypeScript).
– mobile → Expo/React Native app (App.tsx, src/components, src/screens, AuthContext, services/api, assets, design system).
– backend → Node.js API (routes, middleware, config, utils, tests, Dockerfile, database init.sql).
– docs/Documentation → Compliance and project documentation.
• Root config: docker-compose.yml, .env.example, CI/CD workflows (.github), Dockerfiles in each service, shell scripts for local startup (start-*.sh), tests/integration.
README Insights
• Technology stacks: React Native 0.72/Next.js 14, Node 20+, Express/Fastify, GraphQL + REST, PostgreSQL 16, Redis, Docker Swarm/ECS, GitHub Actions, OAuth2/OIDC, JWT, WAF, Vault.
• Emphasizes FedRAMP, WCAG compliance, performance targets, CI/CD pipeline, monitoring, future roadmap.
a. Main Components
• Clients: Mobile App (Expo), Web Admin Portal (Next.js), Desktop PWA (planned).
• API Gateway: Single ingress for REST and GraphQL.
• Backend Services:
– Auth Service (OAuth2/OIDC, JWT issuance, refresh token flow).
– Core API (modules, progress, quiz engine) implemented in Express/Fastify.
– AI Engine (personalization, learning‐path generator).
– Analytics Hub (real-time progress analytics, time-series DB).
• Data Stores: PostgreSQL (primary relational store), Time Series DB (analytics), Redis (cache/session).
• Cross-cutting: Security Layer (WAF, rate limiting, zero-trust), Logging & Monitoring (Prometheus, Grafana, SIEM).
• CI/CD & Infrastructure: GitHub Actions → Docker images → AWS ECS Fargate/Kubernetes → Terraform, Auto-scaling, Multi-cloud.
b. Relationships & Data Flows
• Clients → API Gateway: authenticated calls over HTTPS.
• API Gateway → Auth Service: token validation, user info.
• API Gateway → Core API → DB.
• Core API → AI Engine & Analytics via internal RPC/HTTP.
• Analytics Hub writes metrics to Time Series DB.
• Background jobs / Redis used for rate-limit counters, session store.
• CI/CD updates containers → orchestrator → service mesh.
• Monitoring tools pull metrics from API, AI Engine, DB; alerts to SIEM.
c. Architectural Patterns & Principles
• Microservices-in-containers (Auth, Core API, AI, Analytics separated).
• API Gateway pattern (single entry point, routing, security enforcement).
• CQRS for analytics (separate write path vs. read path).
• Zero-trust network (service-to-service auth, Vault for secrets).
• Infrastructure as Code & GitOps for reproducible deployments.
d. Key Technologies to Call Out
• Frontend: Next.js (App Router), React Native + Expo SDK 49, TypeScript.
• Backend: Node.js, Express.js / Fastify, GraphQL & REST.
• Databases: PostgreSQL 16, Redis, Time Series (e.g., InfluxDB).
• DevOps: GitHub Actions, Docker, AWS ECS Fargate, Kubernetes, Terraform.
• Security: OAuth2/OIDC, JWT, WAF, Vault, Rate Limiting.
• Monitoring: Prometheus, Grafana, SIEM.
Be Detailed & Complete
• Every service folder: auth.ts middleware, modules/progress routes, AI engine worker if present.
• External dependencies: third-party AI service, email/SMS gateway if used.
• CI/CD workflow connecting to container registry → cloud environment.
• Don’t over-simplify; include the major pieces you see in file tree (scripts, Dockerfiles, tests).