Guide

How a pg-web app is put together, topic by topic.

Being written. For now, see docs/APP-DEVELOPER-GUIDE.md and docs/APP-LAYOUT.md.

Planned chapters

ChapterCovers
App layoutDirectory-as-route, filename-as-method
HandlersThe (req json) contract, responses, redirects, cookies
TemplatesTera, shared components, fragments for HTMX
Assets & settingspublic/, pgweb.setting(), environments

A taste of the handler contract

CREATE FUNCTION pgweb.pages__index(req json)
RETURNS json AS $$
  SELECT json_build_object('todos',
    (SELECT coalesce(json_agg(t), '[]'::json) FROM todos t));
$$ LANGUAGE sql;