Prax CLI
The official command-line interface for the Prax ORM.
Installation
Or build from source:
Usage
Initialize a New Project
# Initialize with interactive prompts
# Initialize with defaults (no prompts)
Generate Client Code
# Generate from default schema location
# Generate from specific schema file
# Generate with output directory
Validate Schema
# Validate the schema
# Validate a specific schema file
Format Schema
# Format and display the schema
# Format and write back to file
Database Migrations
# Development workflow (create and apply migrations)
# Apply pending migrations
# Show migration status
# Reset database (WARNING: destructive)
Direct Database Operations
# Push schema to database (creates tables without migrations)
# Pull schema from existing database
# Seed database
Version Information
Project Structure
Prax uses a dedicated prax/ directory for schema and migrations:
my-project/
├── prax.toml # Configuration (project root)
├── prax/ # Prax directory
│ ├── schema.prax # Database schema definition
│ └── migrations/ # Migration files
│ └── .gitkeep
├── src/
│ └── generated/ # Generated Rust code
└── .env # Environment variables
Configuration
The CLI uses a prax.toml configuration file in your project root:
[]
= "postgresql"
= "${DATABASE_URL}"
[]
# Schema file location (default: prax/schema.prax)
= "prax/schema.prax"
[]
# Generated code output directory
= "./src/generated"
[]
# Migrations directory (default: prax/migrations)
= "./prax/migrations"
# Enabled plugins for code generation
= ["serde", "graphql"]
Environment Variables
DATABASE_URL: Database connection URL (overrides config file)PRAX_SCHEMA: Path to schema file (overrides config file)PRAX_OUTPUT: Output directory for generated code
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error |
| 3 | Schema validation error |
| 4 | Database connection error |
| 5 | Migration error |
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.