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 spry.ts and 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
# 0. Initialize a new Spry project (if starting from scratch)
curl -fsSL https://sprymd.org/init.sh | sh
# 1. Generate environment variables
./spry.ts task prepare-env
# 2. Generate development environment
./spry.ts task prepare-sqlpage-dev
# 3. Start SQLPage server
sqlpage
# 4. Deploy to production
./spry.ts task deployBefore you begin, ensure you have the following installed:
spry.ts)If you're starting from scratch, use the Spry initialization script to generate the complete project structure:
curl -fsSL https://sprymd.org/init.sh | shThis command will:
spry.ts CLISpryfile.md with examples and task definitionssqlpage/ directory)What gets created:
spry.ts - The Spry CLI executableSpryfile.md - Main configuration file with sample taskssqlpage/ - Directory for SQLPage configuration.
├── Spryfile.md # Main configuration and code file
├── spry.ts # Spry CLI entry point
├── 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:
curl -fsSL https://sprymd.org/init.sh | shThis 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.ts 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.ts 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 documentation./spry.ts task prepare-sqlpage-dev to regenerate files
For automatic regeneration when you edit Spryfile.md:
./spry.ts 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.ts 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.ts 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.ts --help # Show all commands
./spry.ts --version # Show version
./spry.ts doctor # Check dependencies# Initialize a new Spry project from scratch
curl -fsSL https://sprymd.org/init.sh | sh# Generate environment variables (.envrc)
./spry.ts task prepare-env
# Generate SQLPage development environment
./spry.ts task prepare-sqlpage-dev
# Deploy to production (package into database)
./spry.ts task deploy
# Clean generated files
./spry.ts task clean
# Execute a specific task
./spry.ts task <taskId>
# Execute all tasks in order
./spry.ts runbook# Generate files to filesystem
./spry.ts spc --fs <directory> --conf <config>
# Package to database
./spry.ts spc --package --dialect sqlite
# Watch mode
./spry.ts spc --fs <directory> --watch
# List generated files
./spry.ts spc ls
# Show file contents
./spry.ts 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.ts task clean./spry.ts task prepare-sqlpage-dev./spry.ts doctor
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