Spinning Up a Modular Database in 2 Minutes
Experience the power of modular databases in under 2 minutes. Install a pre-built database module from npm and deploy it to PostgreSQL—no SQL writing required.
What You'll Build
By the end of this lesson, you'll have a working PostgreSQL database with UUID generation capabilities, deployed using constructive's module system. This demonstrates how constructive modules work like npm packages—install, deploy, done.
Create a Workspace
Create a directory for your project:
constructive init --workspaceconstructive prompts for a workspace name:
? Enter the workspace name: quickstart-demoThis creates a complete workspace structure with everything you need.
Create Your First Module
Change directory to your workspace:
cd quickstart-demoInitialize a module inside your workspace:
constructive initAnswer the prompts:
? Enter the module name: demo? Which extensions? (Press space to select, enter to continue)Just press Enter to skip extensions for now. constructive scaffolds a complete module structure:
packages/demo/ ├── demo.control ├── constructive.plan ├── deploy/ ├── revert/ └── verify/
Install a Database Module
Navigate to your module and install a pre-built database module:
cd packages/democonstructive install @constructive/fakerconstructive downloads the module from npm and installs it into your workspace's extensions/ directory.
Your module's package.json is automatically updated with the dependency.
Deploy to PostgreSQL
Deploy to a new database (constructive will create it for you):
constructive deploy --database quickstart_dev --createdb --yesNote: Make sure Docker Desktop is running before deploying.
constructive deploys the UUID module to your database. You'll see output like:
[cli] INFO: Selected package: demo [deploy] SUCCESS: 🚀 Starting deployment to database quickstart_dev... [deploy] INFO: 📥 Installing external extension: citext [deploy] INFO: 📥 Installing external extension: pgcrypto [deploy] INFO: 📥 Installing external extension: plpgsql [deploy] INFO: 📥 Installing external extension: uuid-ossp [deploy] INFO: 📂 Deploying local module: launchql-verify [deploy] INFO: 📂 Deploying local module: launchql-types [deploy] INFO: 📂 Deploying local module: launchql-faker [deploy] INFO: 📂 Deploying local module: demo [migrate] INFO: Checking LaunchQL migration schema... [migrate] SUCCESS: Migration schema found and ready [deploy] SUCCESS: ✅ Deployment complete for demo. [cli] SUCCESS: Deployment complete. [pg-cache] SUCCESS: pg.Pool quickstart_dev ended.
Verify It Works
Test the deployed faker schema and its tables and functions:
Query the faker.cities table to see sample city data:
psql -d quickstart_dev -c "SELECT * from faker.cities LIMIT 1"You should see a row:
id | city | state | zips | lat | lng
--------------------------------------+----------+-------+---------------------------+---------+----------
e36c5cc7-eb79-42be-8a11-5bcd535c8147 | New York | NY | {11226,11225,11224,11222} | 40.6943 | -73.9249
(1 row)Test the faker.business() function to generate a random business name:
psql -d quickstart_dev -c "SELECT faker.business()"business ------------ Brand Fund (1 row)
What Just Happened?
In under 2 minutes, you:
- ✓Created a workspace — A modular project structure for database packages
- ✓Initialized a module — Your database package
- ✓Installed a dependency — A pre-built database module from npm
- ✓Deployed to PostgreSQL — With automatic dependency resolution
- ✓Verified functionality — UUID generation working instantly
This workflow demonstrates the core philosophy of modular databases: database development should be as modular and productive as frontend development. You didn't write SQL, configure migrations, or manually track dependencies. constructive handled the infrastructure.
Understanding the Module System
The @constructive/faker module you installed is a real npm package containing:
- →SQL migration scripts
- →Dependency declarations
- →Version information
When you ran constructive install, constructive:
- 1.Downloaded the package from npm
- 2.Extracted the database module
- 3.Placed it in extensions/@constructive/faker
- 4.Updated your module's dependencies
When you ran constructive deploy, constructive:
- 1.Resolved the dependency graph
- 2.Deployed dependencies first
- 3.Deployed your module
- 4.Tracked everything in the database
Database modules are npm packages
Install database code like frontend dependencies
Automatic dependency resolution
constructive deploys in the correct order
Migration tracking built-in
Every deployment is tracked and reversible
Zero configuration
No build tools, no manual migration management
Fast feedback loops
From install to deployed database in seconds
Production-ready
The same workflow scales from simple utilities to complex applications
Exploring What Was Deployed
Check the migration tracking:
constructive migrate status --database quickstart_devYou'll see all deployed modules and changes.
Rolling Back (Optional)
If you want to revert everything:
constructive revert --database quickstart_devconstructive runs the revert scripts in reverse order, cleanly removing all changes.
Ready to Build Your Own Modules?
The workflow you just experienced—from zero to deployed database in 2 minutes—demonstrates the power of modular databases. This same pattern scales from simple utilities to complex multi-module applications.
Ready to learn about workspaces and building your own modules?
Stay in the loop
Follow our journey. Watch us build. Be the first to know.
Building in public. Open source from day one.