How dwp/govuk-casa works
Project type and purpose
• CASA is a Node.js framework/library (not a standalone full-stack application) built on Express.js. It provides:
• A set of middleware, routing, templating and configuration ingestion utilities
• A plugin/hook architecture for extensibility
• Nunjucks-based views and GOV.UK Design System–compliant components
• Multi-language support via i18n
File structure
• Top-level:
• src/ – core library code (lib/, middleware/, routes/, core-plugins/)
• views/ – built-in view components and layouts (Nunjucks macros, templates)
• assets/ – SCSS partials for the GOV.UK theme
• examples/ – sample “consumer” Express apps that mount CASA
• docs/, tests/, scripts/ – documentation, E2E + unit tests, build scripts
• Core architecture patterns:
• Express middleware pipeline
• Plugin/hook registration (pre- and post-steer, custom plugins under core-plugins/)
• Configuration ingestion -> Journey plan builder -> Mutable router
• MVC-style separation:
– “Controller” logic in middleware and route handlers
– “View” logic in Nunjucks templates and component macros
– “Model” logic in definitions (fields/pages/plan)
README for additional insights
• CASA is heavily centered on:
• Configuration-driven “journey” definitions (pages, fields, routing rules)
• Extensibility via hooks and plugins
• Shallow learning curve built on Express
• No prebuilt database or external persistence beyond the session store