JSPM

@constructive-io/cli

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2162
  • Score
    100M100P100Q120525F
  • License SEE LICENSE IN LICENSE

Platform for schemas, APIs, and application programming

Package Exports

  • @constructive-io/cli
  • @constructive-io/cli/esm/index.js
  • @constructive-io/cli/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@constructive-io/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

constructive — Platform for building Schemas, APIs, and Apps

A unified cloud platform for data, APIs, and application development.

constructive brings together everything teams need to model data, ship APIs, and deploy modern applications. It provides a modular foundation for defining schemas, automating infrastructure, and delivering fast, secure experiences—without the complexity of traditional backend stacks.

✨ Features

  • 🧱 Modular Building Blocks — Compose your app from reusable modules for data, logic, storage, and services. Swap, version, and extend components without rewriting your backend.
  • 🔄 Automated Schema & API Generation — Define your data and relationships once; get auto-generated APIs, migrations, types, and client code across languages.
  • ☁️ Zero-Config Cloud Deployments — Push code, get production. Deploy databases, APIs, functions, and frontends with instant environments and built-in rollout safety.
  • 🏗️ Full-Stack Workspacesconstructive init creates a complete workspace with data models, API routes, auth, edge functions, and CI/CD already wired together.
  • 📊 Versioned Infrastructure — Every schema, API, and service change is tracked and versioned, enabling reproducible deployments and safe rollbacks.
  • 🌐 Portable by Design — Built on open standards and SQL-first workflows, your app runs anywhere—from the constructive cloud to your own infra.
  • 🚀 Optimized Developer Experience — Type-safe SDKs, hot reloading for data and APIs, local-first dev, and zero boilerplate to get from idea → production fast.

🚀 Quick Start

Install & Setup

# Install constructive globally
npm install -g @constructive-io/cli

# Start local Postgres (via Docker) and export env vars
constructive docker start
eval "$(constructive env)"

Tip: Already running Postgres? Skip the Docker step and just export your PG* vars.


Create a Workspace and Install a Package

# 1. Create a workspace
constructive init --workspace
cd my-app

# 2. Create your first module
constructive init
cd packages/your-module

# 3. Install a package
constructive install @pgpm/faker

# 4. Deploy everything
constructive deploy --createdb --database mydb1
psql -d mydb1 -c "SELECT faker.city('MI');"
>  Ann Arbor

🛠️ Commands

Getting Started

  • constructive init - Initialize a new module
  • constructive init --workspace - Initialize a new workspace

Development Setup

  • constructive docker start - Start PostgreSQL container (via Docker)
  • constructive docker stop - Stop PostgreSQL container
  • constructive env - Print PostgreSQL environment variables for shell export

Database Operations

  • constructive deploy - Deploy database changes and migrations
  • constructive verify - Verify database state matches expected migrations
  • constructive revert - Safely revert database changes

Migration Management

  • constructive migrate - Comprehensive migration management
  • constructive migrate init - Initialize migration tracking
  • constructive migrate status - Check migration status
  • constructive migrate list - List all changes
  • constructive migrate deps - Show change dependencies

Module Management

  • constructive install - Install database modules as dependencies
  • constructive extension - Interactively manage module dependencies
  • constructive tag - Version your changes with tags

Packaging and Distribution

  • constructive plan - Generate deployment plans for your modules
  • constructive package - Package your module for distribution

Utilities

  • constructive add - Add a new database change
  • constructive remove - Remove a database change
  • constructive export - Export migrations from existing databases
  • constructive clear - Clear database state
  • constructive kill - Clean up database connections
  • constructive analyze - Analyze database structure
  • constructive rename - Rename database changes
  • constructive admin-users - Manage admin users

💡 Common Workflows

Starting a New Project and Adding a Change

# 1. Create workspace
constructive init --workspace
cd my-app

# 2. Create your first module
constructive init
cd packages/new-module

# 3. Add some SQL migrations to sql/ directory
constructive add some_change

# 4. Deploy to database
constructive deploy --createdb

Working with Existing Projects

# 1. Navigate to your module
cd packages/your-module

# 2. Install a package
constructive install @pgpm/faker

# 3. Deploy all installed modules
constructive deploy --createdb --database mydb1
psql -d mydb1 -c "SELECT faker.city('MI');"
>  Ann Arbor

Testing a module in a workspace

# 1. Install workspace dependencies
pnpm install

# 2. Enter the packages/<yourmodule>
cd packages/yourmodule

# 3. Test the module in watch mode
pnpm test:watch

Database Operations

constructive deploy

Deploy your database changes and migrations.

# Deploy to selected database
constructive deploy

# Create database if it doesn't exist
constructive deploy --createdb

# Deploy specific package to a tag
constructive deploy --package mypackage --to @v1.0.0

# Fast deployment without transactions
constructive deploy --fast --no-tx

constructive verify

Verify your database state matches expected migrations.

# Verify current state
constructive verify

# Verify specific package
constructive verify --package mypackage

constructive revert

Safely revert database changes.

# Revert latest changes
constructive revert

# Revert to specific tag
constructive revert --to @v1.0.0

Migration Management

constructive migrate

Comprehensive migration management.

# Initialize migration tracking
constructive migrate init

# Check migration status
constructive migrate status

# List all changes
constructive migrate list

# Show change dependencies
constructive migrate deps

Module Management

constructive install

Install database modules as dependencies.

# Install single package
constructive install @pgpm/base32

# Install multiple packages
constructive install @pgpm/base32 @pgpm/faker

constructive extension

Interactively manage module dependencies.

constructive extension

constructive tag

Version your changes with tags.

# Tag latest change
constructive tag v1.0.0

# Tag with comment
constructive tag v1.0.0 --comment "Initial release"

# Tag specific change
constructive tag v1.1.0 --package mypackage --changeName my-change

Packaging and Distribution

constructive plan

Generate deployment plans for your modules.

constructive plan

constructive package

Package your module for distribution.

# Package with defaults
constructive package

# Package without deployment plan
constructive package --no-plan

Utilities

constructive export

Export migrations from existing databases.

constructive export

constructive kill

Clean up database connections and optionally drop databases.

# Kill connections and drop databases
constructive kill

# Only kill connections
constructive kill --no-drop

⚙️ Configuration

Environment Variables

constructive uses standard PostgreSQL environment variables (PGHOST, PGPORT, PGDATABASE, PGUSER, PGPASSWORD).

Quick setup (recommended):

eval "$(constructive env)"

Manual setup (if you prefer):

export PGHOST=localhost
export PGPORT=5432
export PGDATABASE=myapp
export PGUSER=postgres
export PGPASSWORD=password

Supabase local development:

eval "$(constructive env --supabase)"

Getting Help

Command Help

# Global help
constructive --help

# Command-specific help
constructive deploy --help
constructive tag -h

Common Options

Most commands support these global options:

  • --help, -h - Show help information
  • --version, -v - Show version information
  • --cwd <dir> - Set working directory

Education and Tutorials

  1. 🚀 Quickstart: Getting Up and Running Get started with modular databases in minutes. Install prerequisites and deploy your first module.

  2. 📦 Modular PostgreSQL Development with Database Packages Learn to organize PostgreSQL projects with constructive workspaces and reusable database modules.

  3. ✏️ Authoring Database Changes Master the workflow for adding, organizing, and managing database changes with constructive.

  4. 🧪 End-to-End PostgreSQL Testing with TypeScript Master end-to-end PostgreSQL testing with ephemeral databases, RLS testing, and CI/CD automation.

  5. Supabase Testing TypeScript-native testing for Supabase with modern workflows.

  6. 🔧 Troubleshooting Common issues and solutions for constructive, PostgreSQL, and testing.

🧪 Testing

  • launchql/pgsql-test: 📊 Isolated testing environments with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
  • launchql/supabase-test: 🧪 Supabase-native test harness preconfigured for the local Supabase stack—per-test rollbacks, JWT/role context helpers, and CI/GitHub Actions ready.
  • launchql/graphile-test: 🔐 Authentication mocking for Graphile-focused test helpers and emulating row-level security contexts.
  • launchql/pg-query-context: 🔒 Session context injection to add session-local context (e.g., SET LOCAL) into queries—ideal for setting role, jwt.claims, and other session settings.

🧠 Parsing & AST

  • launchql/pgsql-parser: 🔄 SQL conversion engine that interprets and converts PostgreSQL syntax.
  • launchql/libpg-query-node: 🌉 Node.js bindings for libpg_query, converting SQL into parse trees.
  • launchql/pg-proto-parser: 📦 Protobuf parser for parsing PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
  • @pgsql/enums: 🏷️ TypeScript enums for PostgreSQL AST for safe and ergonomic parsing logic.
  • @pgsql/types: 📝 Type definitions for PostgreSQL AST nodes in TypeScript.
  • @pgsql/utils: 🛠️ AST utilities for constructing and transforming PostgreSQL syntax trees.
  • launchql/pg-ast: 🔍 Low-level AST tools and transformations for Postgres query structures.

🚀 API & Dev Tools

  • launchql/server: ⚡ Express-based API server powered by PostGraphile to expose a secure, scalable GraphQL API over your Postgres database.
  • launchql/explorer: 🔎 Visual API explorer with GraphiQL for browsing across all databases and schemas—useful for debugging, documentation, and API prototyping.

🔁 Streaming & Uploads

  • launchql/s3-streamer: 📤 Direct S3 streaming for large files with support for metadata injection and content validation.
  • launchql/etag-hash: 🏷️ S3-compatible ETags created by streaming and hashing file uploads in chunks.
  • launchql/etag-stream: 🔄 ETag computation via Node stream transformer during upload or transfer.
  • launchql/uuid-hash: 🆔 Deterministic UUIDs generated from hashed content, great for deduplication and asset referencing.
  • launchql/uuid-stream: 🌊 Streaming UUID generation based on piped file content—ideal for upload pipelines.
  • launchql/upload-names: 📂 Collision-resistant filenames utility for structured and unique file names for uploads.

🧰 CLI & Codegen

  • constructive: 🖥️ Backend platform for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
  • @launchql/cli: 🖥️ Command-line toolkit for managing LaunchQL projects—supports database scaffolding, migrations, seeding, code generation, and automation.
  • launchql/launchql-gen: ✨ Auto-generated GraphQL mutations and queries dynamically built from introspected schema data.
  • @launchql/query-builder: 🏗️ SQL constructor providing a robust TypeScript-based query builder for dynamic generation of SELECT, INSERT, UPDATE, DELETE, and stored procedure calls—supports advanced SQL features like JOIN, GROUP BY, and schema-qualified queries.
  • @launchql/query: 🧩 Fluent GraphQL builder for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.

Credits

🛠 Built by LaunchQL — if you like our tools, please checkout and contribute to our github ⚛️

Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.