How hhs/head-start-ttadp works
Core Components
• Frontend: Located in the “frontend” directory. This is a React-based Single Page Application (SPA) that runs on localhost:3000 (when deployed locally) and proxies API calls to the backend.
• Backend API: The primary business logic is in the “src” directory. It contains routes, middleware, models, services, migrations, and tests. This layer handles authentication, validation, business rules, and data transformation.
• Similarity Microservice: The “similarity_api” directory is a separate Python service (complete with its own Dockerfile, runtime.txt, and routes) that likely handles specialized similarity computations.
• Database: PostgreSQL is used as the persistent datastore. The numerous migration scripts (in “src/migrations”) and seeders indicate a strong focus on maintaining and version‑managing the relational schema.
• File Storage: Minio (S3‑compatible file storage) is integrated. The README shows that minio runs on localhost:9000 and is used for file uploads.
• Automation & Infrastructure: There are automation scripts (in directories like “automation/…”), CI configurations (.circleci), Terraform files (in “terraform/…”), and deployment manifests. These underpin testing, continuous integration (via CircleCI), and deployments (Cloud.gov-based environments).
• Additional Tools/Integrations: There are scripts for tasks like running tests, linting, backups, and data processing. There’s also evidence for integration with external services through Cloud.gov and possibly Redis for caching (inferred from binding to common ports and the existence of “automation/ci/scripts” and “bin” scripts).
Relationships and Interactions
• The Frontend sends HTTP requests to the Backend via REST APIs. Note that the frontend uses proxying (as per the README) so that unknown paths are forwarded.
• The Backend communicates directly with the PostgreSQL database for CRUD operations, applies migrations on startup, and maintains transactional integrity.
• The Backend also uses external file storage (minio) for handling uploads and downloads.
• Specialized requests may be routed (or a backend service call may be made) to the Similarity API for computations.
• CI/CD is handled by CircleCI using Docker containers that build, test, and deploy the application across different environments (sandbox, dev, staging, prod), and Terraform configuration files define the persistent infrastructure (for the database, etc.).
• Automated scripts for testing, backups, and pre‑commit hooks (e.g., linting and Terraform formatting) run locally or in the CI pipelines.
• The application also integrates with monitoring (NewRelic), authentication services (as indicated by AUTH_CLIENT_ID/SECRET and HSES integrations in middleware), and various messaging/email services (via “src/lib/mailer”).
Architectural Patterns and Design Principles
• Separation of Concerns: The project clearly separates presentation (frontend), business logic (backend services, middleware, and routes), data access (models, migrations), and external integrations.
• Microservices: The existence of the “similarity_api” as a separate service emphasizes a microservice approach for specialized tasks.
• Containerization: Dockerfiles, docker-compose configurations, and scripts (e.g., “yarn docker:reset”, “yarn docker:start”) reflect a containerized deployment strategy.
• CI/CD and Infrastructure as Code: CircleCI pipelines and Terraform scripts underline modern DevOps practices.
• Testing and Quality: Extensive directories for unit, integration, and e2e tests show that the project uses a strategy to keep each component well‑tested via isolation, snapshots (for database state), and linting processes.
• Extensibility: With clearly demarcated modules (such as controllers, middleware, services, and helpers), adding new features or replacement components is straightforward.