Skip to content

Examples

Each example is a complete small App. Copy it into the project from the Quickstart and run it with one command. Its page shows everything the App prints, and the lines behind each thing it does.

  • The App is 100 to 120 lines long, and its page shows all of it.
  • One command, PYN_ENV=local npx tsx run.ts, runs the App on SQLite.
  • The script, run.ts, adds the people it needs, and makes every call to the App as one of them.
  • The clock starts on 1 January 2020 and moves only when the script moves it.

Each recipe answers one question on one page, with a few lines from one of these Apps or from the Tutorial’s App, and what they print.

Recipe What it uses
Do something after a write commits An Event and a Listener
Send a reminder when something sits too long A schedule kept to one state
Let people see only their own items A Role on a Template, and a Grant
Move an item to a new state at a deadline A due time, an hourly schedule, a transition
Roll a number up to a parent A parent Listener
Count things month by month A Metric, read with one query for each month

To build an App from nothing, one step at a time, follow the Tutorial. To keep an App running as a server, read Run it as a server.