Package Exports
- @launchql/cli
- @launchql/cli/esm/index.js
- @launchql/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 (@launchql/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
LaunchQL CLI
Build secure, role-aware GraphQL backends powered by PostgreSQL with database-first development
LaunchQL CLI is a comprehensive command-line tool that transforms your PostgreSQL database into a powerful GraphQL API. With automated schema generation, sophisticated migration management, and robust deployment capabilities, you can focus on building great applications instead of boilerplate code.
โจ Features
- ๐ Database-First Development - Design your database, get your GraphQL API automatically
- ๐ Built-in Security - Role-based access control and security policies
- ๐ฆ Module System - Reusable database modules with dependency management
- ๐ Smart Migrations - Automated migration generation and deployment
- ๐ ๏ธ Developer Experience - Hot-reload development server with GraphiQL explorer
- ๐๏ธ Production Ready - Deployment plans, versioning, and rollback support
๐ Quick Start
Installation
npm install -g @launchql/cliCreate Your First Project
# Initialize a new workspace
lql init --workspace
cd my-project
# Create your first module
lql init
# Deploy to your database
lql deploy --createdb
# Start the development server
lql serverVisit http://localhost:5555 to explore your GraphQL API!
๐ Core Concepts
Workspaces and Modules
- Workspace: A collection of related database modules
- Module: A self-contained database package with migrations, functions, and types
- Dependencies: Modules can depend on other modules, creating reusable building blocks
Database-First Workflow
- Design your database schema using SQL migrations
- Deploy changes with
lql deploy - Develop against the auto-generated GraphQL API
- Version and package your modules for distribution
๐ ๏ธ Commands
Getting Started
lql init
Initialize a new LaunchQL workspace or module.
# Create a new workspace
lql init --workspace
# Create a new module (run inside workspace)
lql init
# Use templates from GitHub repository
lql init --workspace --repo owner/repo
lql init --repo owner/repo --from-branch develop
# Use templates from local path
lql init --workspace --template-path ./custom-templates
lql init --template-path ./custom-templates/moduleOptions:
--workspace- Initialize workspace instead of module--repo <repo>- Use templates from GitHub repository (e.g.,owner/repo)--template-path <path>- Use templates from local path--from-branch <branch>- Specify branch when using--repo(default:main)
Development
lql server
Start the GraphQL development server with hot-reload.
# Start with defaults (port 5555)
lql server
# Custom port and options
lql server --port 8080 --no-postgislql explorer
Launch GraphiQL explorer for your API.
# Launch explorer
lql explorer
# With custom CORS origin
lql explorer --origin http://localhost:3000Database Operations
lql deploy
Deploy your database changes and migrations.
# Deploy to selected database
lql deploy
# Create database if it doesn't exist
lql deploy --createdb
# Deploy specific package to a tag
lql deploy --package mypackage --to @v1.0.0
# Fast deployment without transactions
lql deploy --fast --no-txlql verify
Verify your database state matches expected migrations.
# Verify current state
lql verify
# Verify specific package
lql verify --package mypackagelql revert
Safely revert database changes.
# Revert latest changes
lql revert
# Revert to specific tag
lql revert --to @v1.0.0Migration Management
lql migrate
Comprehensive migration management.
# Initialize migration tracking
lql migrate init
# Check migration status
lql migrate status
# List all changes
lql migrate list
# Show change dependencies
lql migrate depsModule Management
lql install
Install LaunchQL modules as dependencies.
# Install single package
lql install @launchql/auth
# Install multiple packages
lql install @launchql/auth @launchql/utilslql extension
Interactively manage module dependencies.
lql extensionlql tag
Version your changes with tags.
# Tag latest change
lql tag v1.0.0
# Tag with comment
lql tag v1.0.0 --comment "Initial release"
# Tag specific change
lql tag v1.1.0 --package mypackage --changeName my-changePackaging and Distribution
lql plan
Generate deployment plans for your modules.
lql planlql package
Package your module for distribution.
# Package with defaults
lql package
# Package without deployment plan
lql package --no-planUtilities
lql export
Export migrations from existing databases.
lql exportlql kill
Clean up database connections and optionally drop databases.
# Kill connections and drop databases
lql kill
# Only kill connections
lql kill --no-drop๐ก Common Workflows
Starting a New Project
# 1. Create workspace
mkdir my-app && cd my-app
lql init --workspace
# 2. Create your first module
lql init
# 3. Add some SQL migrations to sql/ directory
# 4. Deploy to database
lql deploy --createdb
# 5. Start developing
lql serverUsing Custom Templates
You can use custom templates from GitHub repositories or local paths:
# Initialize workspace with templates from GitHub
lql init --workspace --repo owner/repo
# Initialize workspace with templates from local path
lql init --workspace --template-path ./my-custom-templates
# Initialize module with custom templates
lql init --template-path ./my-custom-templates
# Use specific branch from GitHub repository
lql init --workspace --repo owner/repo --from-branch developTemplate Structure: Custom templates should follow the same structure as the default templates:
- For workspace:
boilerplates/workspace/directory - For module:
boilerplates/module/directory - Or provide direct path to
workspace/ormodule/directory
Working with Existing Projects
# 1. Clone and enter project
git clone <repo> && cd <project>
# 2. Install dependencies
lql install
# 3. Deploy to local database
lql deploy --createdb
# 4. Start development server
lql serverProduction Deployment
# 1. Create deployment plan
lql plan
# 2. Package module
lql package
# 3. Deploy to production
lql deploy --package myapp --to @production
# 4. Verify deployment
lql verify --package myappโ๏ธ Configuration
Environment Variables
LaunchQL respects standard PostgreSQL environment variables:
export PGHOST=localhost
export PGPORT=5432
export PGDATABASE=myapp
export PGUSER=postgres
export PGPASSWORD=password๐ Getting Help
Command Help
# Global help
lql --help
# Command-specific help
lql deploy --help
lql server -hCommon Options
Most commands support these global options:
--help, -h- Show help information--version, -v- Show version information--cwd <dir>- Set working directory
Related LaunchQL Tooling
๐งช 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 settingrole,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
- @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 likeJOIN,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.
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.