Genairus logoGenAI-R-Us
Genairus logoGenAI-R-Us
Open Source

Capacitor

Universal Data Modeling Language

Define your data model once and generate schemas, migrations, and SDKs for any database. Switch from PostgreSQL to MongoDB without rewriting your data layer. Support multiple databases simultaneously. Keep frontend and backend teams synchronized with a single source of truth. Built to work seamlessly with AI coding agents.

Database Flexibility Without the Cost

Define your data model once and generate schemas, migrations, and SDKs for PostgreSQL, MongoDB, DynamoDB, Cassandra, and more. Switch databases or support multiple data stores without rewriting your data access layer. Perfect for multi-cloud or migration scenarios.

Safe Migrations, Every Time

Generate database migrations automatically from schema changes. Capacitor analyzes your changes and produces safe, backward-compatible migrations. No more hand-crafted ALTER TABLE scripts. No more production migration disasters. Version control your data model, not your SQL.

Shared Data Models Across Teams

Define entities once, use them everywhere. Frontend teams get TypeScript SDKs. Backend teams get repositories and migrations. Data teams get documentation and lineage tracking. Everyone works from the same source of truth. No more schema drift between services or "I didn't know that field existed" surprises.

Supported Databases

PostgreSQL
MySQL
MongoDB
DynamoDB
Cassandra
SQLite

Why Capacitor?

Stop rewriting schemas for every database. Define your data model once and let Capacitor handle the rest.

AI-First Design

Optimized for LLM code generation with clear, unambiguous syntax that both humans and AI can easily understand and write.

Universal Schema

Write one schema that works across SQL and NoSQL databases. No more maintaining separate schemas for each database.

Smart Code Generation

Generate type-safe SDKs, ORMs, migration scripts, and infrastructure code for your target database.

Native + Shim Architecture

Use native database features when available. Capacitor automatically generates application-level shims for missing features.

Built-in Validation

Built-in linter catches issues before deployment. Get warnings about shimmed features and errors for impossible operations.

Easy Migration

Switching databases? Capacitor analyzes your schema and generates migration plans showing what works and what needs adjustment.

Enterprise Ready

Built-in support for multi-tenancy, audit trails, soft deletes, schema versioning, and other enterprise patterns.

Repository Pattern

Define type-safe repositories, DTOs, and queries as part of your schema. Generate complete data access layers with proper separation of concerns.

How It Works

Capacitor uses a generator philosophy similar to Protocol Buffers and Smithy. Define your schema once, generate everything you need.

1

Define Your Schema

Write your data model in Capacitor's simple, expressive syntax. Define models, relationships, constraints, and validations.

model Product {
  id    String
  name  String
  price Decimal
}
2

Generate Code

Run the Capacitor CLI to generate database schemas, migrations, type-safe SDKs, and infrastructure code.

$ capacitor generate \
  --target postgresql \
  --output ./generated

 Generated schema.sql
 Generated SDK
3

Use in Your App

Import the generated SDK and enjoy full type safety, autocompletion, and validation.

const product = await
  db.product.create({
    name: "Widget",
    price: 19.99
  });

The Generator Philosophy

Capacitor follows the same philosophy as successful tools like Protocol Buffers and Smithy: define your contract in a generative domain language, then use generators to produce target-specific implementations. This approach ensures consistency, reduces errors, and makes multi-database support practical.

Native Implementation

When a database supports a feature natively (like PostgreSQL enums), Capacitor generates native code.

Automatic Shims

When a feature isn't native (like enums in MongoDB), Capacitor generates application-level shims automatically.

Getting Started

Get up and running with Capacitor in minutes.

1. Install Capacitor CLI

Terminal
$ npm install -g @capacitordata/cli
# or
$ brew install capacitor

2. Create Your First Schema

schema.capacitor
model User {
  id        String   @id @default(uuid)
  email     String   @unique
  name      String
  createdAt DateTime @default(now)
}

3. Generate for Your Database

Terminal
# PostgreSQL
$ capacitor generate --target postgresql --output ./generated

# MongoDB
$ capacitor generate --target mongodb --output ./generated

# DynamoDB
$ capacitor generate --target dynamodb --output ./generated

4. Use the Generated SDK

app.ts
import { db } from './generated';

const user = await db.user.create({
  email: 'alice@example.com',
  name: 'Alice'
});

const users = await db.user.findMany({
  where: { email: { contains: '@example.com' } }
});

Next Steps

Join the Community

Capacitor is open source and community-driven. Contribute, ask questions, or share your capacitor projects.