Developer Tools & Productivity Guide

Webspresso ships with three integrated developer tools designed to speed up debugging, database management, and deployment:

  1. Webspresso DB Studio: A zero-dependency visual database browser, row editor, and SQL console in your browser (Prisma/Drizzle Studio-inspired).
  2. Interactive REPL Console: An interactive terminal environment with preloaded models, services, queues, and database connections (Rails Console / Laravel Tinker-inspired).
  3. Static Site Exporter (SSG): Prerenders your server-rendered pages and dynamic models into high-performance static HTML for zero-cost hosting.

1. Webspresso DB Studio #

Launch an interactive GUI to inspect, filter, edit, and query your database directly from your browser:

BASH
# Launch Studio on default port 4567 and automatically open browser
npx webspresso studio

# Or using the full command
npx webspresso db:studio --port 8080 --env staging

Key Features #

  • Visual Table Browser: Inspect all database tables, foreign keys, indexes, and column types.
  • Interactive Data Grid: Paginate, search, sort, insert, inline-edit, and delete records with full transactional safety.
  • Live SQL Query Runner: Execute raw SQL queries against your database with query execution metrics and tabular results.
  • Dialect Agnostic: Seamlessly supports SQLite, PostgreSQL, and MySQL.

CLI Options #

FlagDescriptionDefault
-p, --port <port>Port to listen on4567
-H, --host <host>Host to bind to127.0.0.1
-e, --env <env>Database environment from configdevelopment
-c, --config <path>Custom path to database configurationauto
--no-openStart server without auto-opening the browserfalse

2. Interactive REPL Console (webspresso console) #

Start a full-featured Node.js REPL pre-loaded with your entire application context:

BASH
# Start interactive console
npx webspresso console

# Shorthand alias
npx webspresso c

Pre-loaded Global Environment #

When the console boots, it automatically injects:

  • db: Active Knex database instance with connection pooling.
  • Models: All defined ORM models (e.g. User, Post, Order) bound to their repositories.
  • service: Framework ServiceRegistry for invoking domain business logic.
  • queue: Background queue manager.
  • flags: Feature flag manager.

Interactive Usage Examples #

JAVASCRIPT
// Querying models
const users = await User.find({ status: 'active' });
console.log(users);

// Creating test records
const newPost = await Post.create({
  title: 'Hello from Console',
  author_id: 1,
});

// Invoking a domain service
const result = await service('order.calculate-tax', { amount: 150 });

// Running raw SQL queries
const raw = await db.raw('SELECT count(*) as total FROM users');

One-Shot Script Evaluation (--eval) #

Execute JavaScript statements in your application context without opening an interactive session (ideal for CI/CD, migration verification, and cron scripts):

BASH
npx webspresso console -e "await User.query().where('active', false).delete()"

3. Static Site Export (webspresso export) #

Prerender your SSR pages into static HTML files for zero-cost hosting on Cloudflare Pages, GitHub Pages, Vercel, Netlify, or Amazon S3:

BASH
# Prerender all pages to dist/
npx webspresso export

# Export with custom domain for sitemap.xml generation
npx webspresso export --out build --base-url https://example.com --sitemap

How It Works #

  1. Scans pages/ for all static and companion-loaded SSR routes (.njk and .js).
  2. Evaluates loaders and renders HTML responses into dist/[route]/index.html.
  3. Recursively copies static assets from public/ (CSS, JS, images, fonts) into the output directory.
  4. Generates a production sitemap.xml including all prerendered pages.

CLI Options #

FlagDescriptionDefault
-o, --out <dir>Output directory for static filesdist
-b, --base-url <url>Base URL used for canonical links & sitemap.xmlundefined
--clean / --no-cleanClean output directory before buildtrue
--no-clean-urlsGenerate path.html instead of path/index.htmlfalse
--sitemapGenerate sitemap.xml for all prerendered routesfalse
--concurrency <n>Concurrent rendering workers5
--no-assetsSkip copying public/ static assetsfalse
Updated