Webspresso Fullstack Example

A feature-complete blog built the Webspresso way. It doubles as the benchmark target: everything under benchmarks/ boots this app and measures it end to end.

What it covers #

AreaWhere
SSR pages + companion loaders, dynamic [slug] params, layouts, partials, custom 404pages/*.njk, pages/*.js, views/
File-based JSON API with Zod query / params / body schemaspages/api/**
ORM models (zdb), belongsTo / hasMany, eager loading, timestamps, soft deletes, hidden fields, query cachemodels/
Knex migrations + deterministic repository-based seedingmigrations/, db/seed.js
Services: validation, ACID transaction: true, memoization (cache), timeouts, compositionservices/
Native JWT auth (quickAuth), middleware: ['jwt'] guardsapp.js, pages/api/auth/login.post.js, pages/api/me.get.js
Rate limiting (rateLimit)lib/limiters.js
Background jobs (queue) and domain events (listeners)jobs/, listeners/
Compression, payload limits, Early Hints, health probes (/healthz, /readyz), Prometheus /metricsapp.js
Plugins: corsPlugin, redirectPlugin (/blog → /posts)app.js

Run it #

BASH
node examples/fullstack-app/server.js
# → http://localhost:7332  (SQLite file: examples/fullstack-app/data.sqlite)

Demo account: admin@example.com / secret-password

BASH
TOKEN=$(curl -s localhost:7332/api/auth/login \
  -H 'content-type: application/json' \
  -d '{"email":"admin@example.com","password":"secret-password"}' | jq -r .accessToken)

curl -s localhost:7332/api/posts -H "Authorization: Bearer $TOKEN" \
  -H 'content-type: application/json' \
  -d '{"title":"Hello","body":"From curl","categoryId":1}'

Routes #

MethodPathNotes
GET/Stats + latest posts + categories (3 services in parallel)
GET/aboutStatic template (no loader)
GET/posts?page=&category=Paginated listing
GET/posts/:slugDetail with author, category, comments
GET/api/posts, /api/posts/:slug, /api/categories, /api/statsJSON API
POST/api/auth/loginReturns access + refresh tokens (rate limited)
GET/api/meJWT protected
POST/api/postsJWT + rate limit + Zod + transactional service
GET/healthz, /readyz, /metricsPlatform endpoints

Benchmarks #

BASH
npm run bench          # all suites against this app
npm run bench:ci:local # record baseline + compare

[!NOTE] lib/webspresso.js points at the local framework source. In your own project use require('webspresso'), require('webspresso/plugins') and require('webspresso/core/auth').

Updated