How dfe-digital/dfe-complete-conversions-transfers-and-changes works
This project is a complex, monolithic Ruby on Rails application built for managing “conversions, transfers and changes” in the education context (specifically for academy-related processes). The overall architecture follows the classic MVC pattern and separates concerns well among controllers, models, views, and service objects. It also exposes API endpoints (under app/api) and leverages multiple external dependencies (such as APIs for academies data, GOV.UK Notify, Azure Application Insights for monitoring, and background job processing with Sidekiq/Redis).
Main components
• Client/User Interface – Represent browsers and end-user devices interacting with the application. Note that the frontend uses GOV.UK and DfE design components and JavaScript helpers.
• Web Application Layer – The core Rails monolith, including:
– API Layer: (app/api) exposing endpoints (v1/conversions, healthcheck, transfers, etc.)
– Controllers: Organized into separate domains (conversions, transfers, date history, local authorities, external contacts, etc.)
– Views and components: Handlebars-like components and ERB files for rendering the HTML UI.
– Service Layer: Service objects (in app/services and lib) handling business logic such as project creation, processing conversion/transfer tasks, exports, and integration with external APIs.
– Job Processing: Background jobs (in app/jobs) for non-interactive tasks.
• Data Storage – The database layer (schema/db & migrations) storing projects, user accounts, task lists, and additional domain entities.
• External Integrations:
– External APIs (academies API, persons API) – The Rails application calls these services to fetch data about establishments and trusts.
– Email Services: For instance, GOV.UK Notify (referenced in the documentation).
– Monitoring & Logging: Integration with Azure Application Insights (with distinct dashboards for development, test, production).
– Infrastructure as Code: Terraform components for managing deployment, container orchestration (Docker, Kubernetes or container host), and configuration.
– Background Processing: Likely a Redis-backed Sidekiq system as indicated by decisions to use “sidekiq and redis” for background job processing.
Relationships and interactions
• User devices send HTTP requests to the Rails application via a web server (using a Docker container or deployed on a managed service).
• Requests are routed through the application’s controllers and, if needed, interact with API endpoints to fetch or update project data.
• The controllers invoke service objects that encapsulate business logic and call out to:
– The database (active record ORM) for CRUD operations,
– External API clients to fetch updated academy/trust data,
– Background jobs for asynchronous processing such as imports or long-running tasks.
• Email notifications, logging, and monitoring actions cross-cut the application, with integrations to external services.
• Infrastructure components (Docker, GitHub workflows, Terraform) manage deployment, continuous integration, and maintainability of the application across environments.
Important architectural patterns and design principles
• MVC Pattern: Clear separation of presentation (views), control (controllers), and business logic (models & service objects).
• Modularization of Domain Concerns: The project separates conversions from transfers and further splits responsibilities using subdirectories (e.g., app/forms, app/services, app/controllers) for each domain.
• API-First Approach: With a dedicated API folder, the system supports both internal page rendering and external API consumption.
• Infrastructure as Code: Managed through Terraform scripts in the terraform directory and using containerization (Dockerfile, devcontainer) for development consistency.