Quick Start Guide
Get started with ChameleonDB in 5 minutes.Prerequisites
Before you begin, ensure you have:- Go 1.21+ installed
- PostgreSQL 14+ running
- Terminal access (bash, zsh, or PowerShell)
Installation
See the Installation Guide for detailed instructions on Linux, macOS, and Windows. Quick install:Your First ChameleonDB Project
1
Initialize Project
Create a new directory and initialize ChameleonDB:What happens:
- Creates
.chameleon/directory - Initializes Schema Vault
- Creates default
schema.cham - Sets mode to
readonly
2
Define Your Schema
Edit Validate your schema:Output:
schema.cham to define your data model:schema.cham
3
Configure Database Connection
Set your PostgreSQL connection string:
Replace
user, password, and mydb with your actual PostgreSQL credentials.4
Run Migration
Apply your schema to the database:Output:
5
Use in Your Application
Initialize a Go module and add ChameleonDB:Create Run your application:Output:
main.go:main.go
Query with Relations
ChameleonDB makes it easy to query related data:Using
Include() prevents N+1 query problems by eagerly loading related data. ChameleonDBβs IdentityMap automatically deduplicates objects in memory.Debug Mode
See the generated SQL for any query:Schema Vault Commands
ChameleonDB tracks every schema change in the Schema Vault:Example: View Version History
Integrity Modes
ChameleonDB uses integrity modes to control who can modify schemas:Common Issues
vault not initialized
vault not initialized
Solution: Run
chameleon init in your project directory.readonly mode: blocked
readonly mode: blocked
Solution: Upgrade to standard mode.
integrity violation
integrity violation
Solution: Check what changed and view the audit log.
DATABASE_URL not set
DATABASE_URL not set
Solution: Set the environment variable.
Next Steps
Installation Guide
Detailed installation for Linux, macOS, and Windows
CLI Reference
Complete guide to all CLI commands
Query API
Type-safe query and mutation reference
Examples
Real-world example applications
What Youβve Learned
- β How to initialize ChameleonDB projects
- β
How to define schemas in
.chamfiles - β How to run migrations with the Schema Vault
- β How to query data with the Go SDK
- β How to use Debug mode to see SQL
- β How to manage integrity modes
Getting Help
- Documentation: https://chameleondb.dev/docs
- GitHub Issues: https://github.com/chameleon-db/chameleondb/issues
- Discord: https://chameleondb.dev/discord