Scaffold complete SQLPage applications from Markdown.
Live reload during development, package into SQLite or PostgreSQL for production.
Spry for SQLPage lets you build complete database-driven websites using only Markdown and SQL.
Write your SQL queries in fenced code blocks, and Spry automatically packages them into a SQLPage application.
Initialize a complete project structure with Spryfile.md in seconds
Use --watch mode to see changes instantly during development
Package into SQLite for single-file apps or PostgreSQL for production scale
Install the unified spry binary via Homebrew.
# 0.Initialize a new Spry project (if starting from scratch)
spry sp init
# 1. Generate environment variables
spry rb task prepare-env
# 2. Generate development environment
spry rb task prepare-sqlpage-dev
# 3. Start SQLPage server
sqlpage
# 4. Deploy to production
spry rb task deployBefore you begin, ensure you have the following installed:
If you're starting from scratch, use the Spry initialization script to generate the complete project structure:
spry sp initThis command will:
What gets created:
Spryfile.md - Main configuration file with sample tasks.
├── Spryfile.md # Main configuration and code file
├── sqlpage/
│ └── sqlpage.json # SQLPage configuration
├── dev-src.auto/ # Generated files (development mode)
└── sqlpage.db # SQLite databaseIf you're starting a new Spry project from scratch:
spry sp initThis creates the complete project structure. Skip to Step 1 if you already have a Spry project.
Generate the .envrc file using the Spry task:
spry rb task prepare-env
This will create a .envrc file with the necessary environment variables and add it to .gitignore.
If using direnv, allow the environment file:
direnv allow
The Spryfile.md is the heart of the Spry project (automatically created by the init script). It contains:
Example Spryfile.md structure:
---
sqlpage-conf:
allow_exec: true
port: '${env.PORT}'
database_url: '${env.SPRY_DB}'
web_root: "./dev-src.auto"
---
# My Spry Application
## Home Page
```sql index.sql
select 'card' as component,
'Welcome' as title;
select 'Hello from Spry!' as description;
```Use the Spry task to generate the development environment:
spry rb task prepare-sqlpage-devThis command:
dev-src.auto directorysqlpage/sqlpage.json configurationIn a separate terminal window:
sqlpageSQLPage will:
sqlpage/sqlpage.jsondev-src.auto/
Visit http://localhost:9227 in the browser to see the application.
Spryfile.md - Add or modify SQL queries, bash scripts, or documentationspry rb task prepare-sqlpage-dev to regenerate files
For automatic regeneration when you edit Spryfile.md:
spry sp spc --fs dev-src.auto --destroy-first --conf sqlpage/sqlpage.json --watch
This watches the Markdown files and regenerates the dev-src.auto directory on every change.
To automatically restart SQLPage after each rebuild:
spry sp spc --fs dev-src.auto --destroy-first --conf sqlpage/sqlpage.json --watch --with-sqlpageNote: Restarting SQLPage is usually not necessary. You can run SQLPage in a separate terminal and it will pick up changes automatically.
Add a new SQL code block to Spryfile.md:
## About Page
```sql about.sql
select 'card' as component,
'About Us' as title;
select 'This is a Spry-powered application' as description;
```
The file about.sql will be generated in dev-src.auto/ and accessible at http://localhost:9227/about.sql.
When ready for production, switch from file-based mode to single-database mode.
Use the Spry deploy task to package everything into the database:
spry rb task deployThis command:
dev-src.auto directorysqlpage_files table in the SQLite database
Modify sqlpage/sqlpage.json to remove or comment out web_root:
{
"allow_exec": true,
"port": "9227",
"database_url": "sqlite://sqlpage.db?mode=rwc"
}sqlpageSQLPage now serves files from the database instead of the filesystem.
spry --help # Show all commands
spry --version # Show version
# Initialize a new Spry project from scratch
spry sp init# Generate environment variables (.envrc)
spry rb task prepare-env
# Generate SQLPage development environment
spry rb task prepare-sqlpage-dev
# Deploy to production (package into database)
spry rb task deploy
# Clean generated files
spry rb task clean
# Execute a specific task
spry rb task <taskId>
# Execute all tasks in order
spry rb run# Generate files to filesystem
spry sp spc --fs <directory> --conf <config>
# Package to database
spry sp spc --package --dialect sqlite
# Watch mode
spry sp spc --fs <directory> --watch
# List generated files
spry sp spc ls
# Show file contents
spry sp spc cat <filename>```sql filename.sql
SELECT 'text' as component;
SELECT 'Hello World' as contents;
```Add route information for navigation:
```sql index.sql { route: { caption: "Home" } }
SELECT 'card' as component;
``````bash clean --descr "Clean up the project directory's generated artifacts"
rm -rf dev-src.auto
```
Or use the clean task if defined in the Spryfile.md:
spry rb task cleanspry rb task prepare-sqlpage-dev
Change the port in .envrc or sqlpage/sqlpage.json:
export PORT=9227
Ensure web_root in sqlpage/sqlpage.json points to the correct directory:
{
"web_root": "./dev-src.auto"
}Spryfile.mdBuild interactive dashboards that query your database directly
Create admin panels and internal applications with SQL
Document your SQL logic alongside execution in the same file
Go from idea to working application in minutes