Baseplate Architecture
Baseplate is a sophisticated code generation platform designed to help developers bootstrap codebases and continuously add new features. This page explains the underlying architecture that powers Baseplate’s code generation capabilities.
Architecture Overview
Section titled “Architecture Overview”Baseplate operates through a two-tier architecture designed to transform high-level configurations into production-ready code:
The Project Builder UI produces a Project Definition, which the Sync Engine turns into your Codebase.
Project Builder
Section titled “Project Builder”The Project Builder is the user-facing component that provides an intuitive UI for configuring your application:
- Configuration Interface: Define data models, authentication systems, and other high-level features through a visual interface
- Project Definition: Your UI configurations are captured in a high-level JSON schema that defines your entire project
- Bundle Compilation: When generation is triggered, the Project Builder transforms your project definition into lower-level generator bundles
The Project Builder abstracts away implementation complexity while ensuring that your high-level design decisions are properly translated into technical specifications.
Sync Engine
Section titled “Sync Engine”The Sync Engine takes the generator bundles and produces actual code:
- Dependency Resolution: Creates a dependency tree for each generator to determine execution order
- Generator System: Each generator provides code templates and providers that others can consume
- Provider Pattern: Generators can expose functionality for others (e.g., the Node generator provides a template for package.json and lets other generators add packages)
- Synchronization: Generated code is compared against your existing codebase using a Git Diff3 algorithm to safely merge changes
This approach allows Baseplate to:
- Generate new code based on your specifications
- Update existing code without overwriting your custom modifications
- Integrate seamlessly with your development workflow
Example Generator Flow
Section titled “Example Generator Flow”Here’s how generators work together in practice:
- The Node Generator creates the base package.json and project structure
- The Prisma Generator adds its dependencies and creates model definitions based on your data model configuration
- The GraphQL Generator uses Prisma’s provider to access model information and create corresponding GraphQL types and resolvers
Through this cascading generator system, Baseplate produces a fully integrated codebase where each component works harmoniously with others.
Continuous Integration
Section titled “Continuous Integration”What makes Baseplate unique is that it’s not just for initial bootstrapping—it serves as an ongoing development tool:
- Make changes to your application design in the Baseplate UI
- Generate updates that integrate with your existing codebase
- Maintain full customization ability while benefiting from automatic code generation
This continuous integration approach allows you to focus on building unique features while Baseplate handles scaffolding and boilerplate.