- AtomicBinding (Imprint)
- Table of Contents
- Project Overview
- Core Features
- System Architecture
- Prerequisites
- Local Development Setup
- Local Access Points
- Environment Configuration Guide
- Deterministic Build Gates
- Available CLI Scripts
- Project Directory Structure
- Troubleshooting Guide
- Contributing Guidelines
- Contributors
- License
Modern content infrastructure presents a dilemma: engineering teams prefer Git-backed Markdown with structured pull request workflows, while marketing and product teams require headless CMS interfaces with intuitive form controls.
AtomicBinding (Imprint) reconciles these models. Markdown documentation from Git and relational entities from the CMS are ingested and normalised into a single unified, strongly-typed content graph (Node[]). Downstream consumers (such as Next.js React components and API routes) render from this graph seamlessly without branching on the content source origin. Six automated build gates guard the graph to guarantee type safety, link integrity, and prevent schema drift in production.
- Dual-Source Normalisation: Unifies Git-tracked Markdown frontmatter and SQLite/Postgres database records into a single consolidated graph.
- Zero-Codegen Schema Architecture: A single TypeScript schema definition drives runtime validation, Studio form rendering, delivery API schemas, React component props, and CI build invariants.
- Mathematical Binding Compiler: Compiles flat
{ source, target }rows into strongly-typed UI components with round-trip verification (compile(decompile(rows)) === rows). - Six Deterministic Build Gates: Automated CI validations that catch route collisions, broken hyperlinks, unresolved foreign references, and schema violations.
- Embedded Studio Engine: Provides real-time visual schema editing and draft preview capabilities over postMessage iframe communication.
Every document and block type is declared exactly once in schema/ using primitives like defineDocument and defineBlock. This unified definition drives five distinct system boundaries:
- Storage and Write Path: Compiles into a runtime Zod validator enforcing database and API constraints.
- Editor Manifest: Directs the Studio UI to render context-aware form controls.
- Delivery API Contract: Defines the JSON schema and serialization structure for API consumers.
- Render Props: Provides compile-time TypeScript type definitions to React components.
- Build Gates: Generates invariants checked across the entire content graph prior to release.
graph TD
subgraph "Authoring Surfaces"
Git["content/**/*.md<br/>Engineers via Git PRs"]
CMS["Headless CMS<br/>Authors via Studio UI"]
end
subgraph "Adapters"
FSAdapter["FS Adapter<br/>Frontmatter + Directives"]
CMSAdapter["CMS Adapter<br/>Two-Row Storage + Zod"]
end
subgraph "Unified Engine"
Graph["Unified Content Graph<br/>Node[] (Source-Tagged and Route-Indexed)"]
Gates["Six Build Gates<br/>Automated CI Verification"]
end
subgraph "Delivery Surfaces"
Next["Next.js Web Application"]
API["Content Delivery API"]
end
Git --> FSAdapter
CMS --> CMSAdapter
FSAdapter --> Graph
CMSAdapter --> Graph
Graph --> Gates
Graph --> Next
Graph --> API
Dynamic feeds (such as integration directories or changelog listings) bind to target UI cards. While persisted as flat { source, target } rows for performance, the authoring surface uses compile-time checked mappings:
bind(integrations, integrationCard)
.replicate()
.map({
title: (i) => i.title,
image: (i) => i.logo.absolutePath,
href: (i) => i.route,
});The binding compiler guarantees type integrity: referencing invalid fields or type mismatches triggers compilation failures before runtime execution.
Ensure your environment satisfies the following minimum system requirements:
| Dependency | Minimum Version | Verification Command |
|---|---|---|
| Node.js | >= 22.5.0 |
node -v |
| npm | >= 10.0.0 |
npm -v |
| Git | >= 2.30.0 |
git -v |
Follow these steps to configure and launch the development environment locally:
git clone https://github.com/SrishtiSonam/AtomicBinding.gitnpm installCreate your local environment configuration from the provided template:
cp .env.example .env.localOpen .env.local and configure your development token and paths:
IMPRINT_TOKEN=dev-secret-token-change-me
IMPRINT_DRIVER=sqlite
IMPRINT_SQLITE_PATH=./data/imprint.db
IMPRINT_STUDIO_ORIGIN=http://localhost:3100Run the database migration and seed script to populate baseline schema entities and sample records:
npm run seed -- --reset --legacynpm run devNavigate to http://localhost:3100 in your web browser.
| Route | Description |
|---|---|
http://localhost:3100 |
Public website serving unified Git documentation and CMS content |
http://localhost:3100/studio |
Headless Content Studio with visual schema form controls |
http://localhost:3100/studio/health |
System health overview and diagnostic status of build gates |
AtomicBinding uses the following environment variables. Default values are pre-configured in .env.example:
| Variable | Type | Default Value | Description |
|---|---|---|---|
IMPRINT_TOKEN |
Required | dev-secret-token-change-me |
Bearer token used for authenticating draft preview reads and write endpoints. |
IMPRINT_DRIVER |
Optional | sqlite |
Primary storage engine backend (sqlite or postgres). |
IMPRINT_SQLITE_PATH |
Optional | ./data/imprint.db |
Local filesystem path for the SQLite database file. |
IMPRINT_STUDIO_ORIGIN |
Optional | http://localhost:3100 |
Allowed cross-origin domain for iframe communication between Studio and Canvas. |
NO_COLOR |
Optional | (unset) | When set to 1 or true, disables ANSI terminal color formatting in CLI commands. |
Six automated build gates validate the content graph during build steps and CI runs. Any validation failure halts execution with exit code 1:
| Gate | Validation Target | Failure Mode Prevented |
|---|---|---|
| Route Uniqueness | Verifies route collisions across Git and CMS sources. | Prevents silent page overwrites and ambiguous route resolution. |
| Link Integrity | Traces every internal hyperlink (from -> to). |
Prevents broken 404 links across documentation and marketing pages. |
| Reference Resolution | Checks foreign key references across graph nodes. | Identifies dangling entity references and reports the holding field. |
| Schema Validity | Validates documents against current schema versions. | Reports structural incompatibilities gracefully instead of runtime crashes. |
| Binding Validity | Validates feed bindings against target brand types. | Prevents field missing errors in dynamic UI card collections. |
| Binding Round-Trip | Tests bi-directional compile and decompile paths. | Guarantees lossless persistence and schema transformation fidelity. |
The root workspace provides commands for local development, database operations, and quality assurance:
# Development and Build
npm run dev # Start Next.js development server on port 3100
npm run build # Compile production application bundle
npm run start # Launch production server on port 3100
# Verification and Testing
npm run typecheck # Run TypeScript strict typecheck across all workspaces
npm test # Execute test suite using Vitest
npm test:watch # Run Vitest test runner in watch mode
npm run gates # Run all six deterministic build gates against current graph
npm run doctor # Diagnose sources, types, migrations, and gate health
# Database Management
npm run migrate # Perform dry-run of pending database migrations
npm run migrate -- --apply # Apply pending migrations to database
npm run seed # Populate database with seed data (--reset, --legacy)AtomicBinding/
├── app/ # Next.js App Router (routes, layouts, API endpoints)
├── content/ # Git-tracked Markdown documentation and blog entries
│ ├── blog/ # Blog posts and articles
│ └── docs/ # Technical documentation and guides
├── migrations/ # Database migration definitions (SQLite and PostgreSQL DDL)
├── packages/
│ ├── cli/ # Imprint CLI tools (doctor, gates, migrate, seed)
│ ├── graph/ # Unified content graph and gate validation logic
│ ├── schema/ # Schema definition primitives and binding compiler
│ └── store/ # Storage adapters and two-row persistence engine
├── schema/ # Application-level schemas and ownership manifests
│ ├── blocks/ # Reusable block definitions
│ ├── cards.ts # UI card schema declarations
│ ├── feeds.ts # Content feed definitions
│ └── index.ts # Main schema registry and ownership manifest
├── src/
│ ├── lib/ # Shared utilities and authentication middleware
│ ├── render/ # Component renderers and canvas integration
│ └── studio/ # Headless CMS Studio UI and dynamic form components
├── test/ # Vitest test suites (schema, storage, gates, bindings)
├── .env.example # Environment variable template
├── package.json # Root workspace configuration and scripts
└── tsconfig.json # TypeScript configuration
Ensure you are in the repository root. A template file .env.example is provided in the repository root. Copy it using:
cp .env.example .env.localThis repository requires Node.js version 22.5.0 or higher. Check your version with:
node -vIf using nvm (Node Version Manager), switch to Node 22:
nvm install 22
nvm use 22Next.js is configured to run on port 3100. If port 3100 is occupied:
- Stop any existing process occupying the port.
- Or specify an alternate port:
npm run dev -- -p 3200Remember to update IMPRINT_STUDIO_ORIGIN in .env.local if changing ports.
If you encounter database lock or corruption issues during development, reset the local SQLite store:
npm run seed -- --reset --legacyTo identify exact failure points across routes, references, or bindings, run:
npm run gatesUse npm run doctor to get an itemised diagnostic report of all registered types, sources, and migrations.
Contributions are welcome. Please adhere to the following workflow:
- Fork the Repository: Fork the project on GitHub to your account.
- Clone and Setup Upstream:
git clone https://github.com/<your-username>/AtomicBinding.git git remote add upstream https://github.com/SrishtiSonam/AtomicBinding.git
- Create a Feature Branch:
git checkout -b fix/issue-description
- Configure Local Environment: Follow the Local Development Setup instructions.
- Enforce Quality Standards:
- Maintain strict TypeScript type safety without
any. - Preserve existing schema definitions and validation invariants.
- Run validation before pushing:
npm run typecheck npm run gates npm test
- Maintain strict TypeScript type safety without
- Submit a Pull Request: Push your branch to your fork and submit a Pull Request to
upstream/mainwith a clear description of the resolved issue.
Thank you to all contributors who participate in building and improving AtomicBinding.
This project is open source and available under the terms specified in the repository license.