d9 + projen: building a solid backend backbone with CMS + project-as-code
We use d9 as the core backbone of our backends. We edit as much as we can via the powerful interface and write custom extensions in plain code to complete the core functionality.
To keep that visual power while maintaining a clean developer workflow, we couple it with projen (Project-as-Code). This lets us manage our entire stack, from the local dev environment to a multi-package extension architecture, using a simple configuration:
import { D9Project } from '@wbce/projen-d9';
import { D9ExtensionType } from '@wbce/projen-d9-extension';
const project = new D9Project({ name: 'my-backend' });
// Automates the pnpm workspace boilerplate for custom hooks/endpoints
project.addExtension('audit-log', [D9ExtensionType.HOOK]);
project.synth();
This combination gives us the best of two worlds:
- a good visual editing experience: non-tech teams get the autonomy they need to manage content and workflows.
- a good developer experience: we get an automated local environment that mimics a production one, and clean Docker builds without managing manual boilerplate.
We open-sourced this template for anyone wanting to use it in their own workflow. Documentation is here.
If you like this approach, feel free to check out the details, adapt the templates to your use cases, or share yours!