Sticky Notes
Sticky-notes REST API where titles and previews are computed columns, served with FastAPI
One app.py with 1 table, 2 computed columns, 5 HTTP routes. Needs pixeltable[serve]>=0.7.14. Updated 2026-09-21.
app.py
"""Sticky Notes API built with Pixeltable.pxt schema update app.py notespxt service run app.py notes"""import pixeltable as pxtimport pixeltable.functions as pxtffrom pixeltable.serving import FastAPIRouterfrom udfs import blurb# ---- tables ----TableModel = pxt.model_base()class Notes(TableModel, name='notes'):id = pxt.Column(value=pxtf.uuid.uuid7(), primary_key=True)title: pxt.Stringbody: pxt.Stringtag: pxt.String | Nonetitle_upper = pxtf.string.upper(title) # built-in string functionblurb = blurb(body) # our UDF from udfs.py# ---- queries ----@pxt.querydef notes_by_tag(tag: str):"""Notes with a given tag, newest first (UUIDv7 ids sort by creation time)."""return Notes.where(Notes.tag == tag).select(Notes.id, Notes.title, Notes.blurb).order_by(Notes.id, asc=False)# ---- routes ----notes_api = FastAPIRouter(name='notes_api')notes_api.add_insert_route(Notes, path='/notes', inputs=[Notes.title, Notes.body, Notes.tag],outputs=[Notes.id, Notes.title_upper, Notes.blurb])notes_api.add_update_route(Notes, path='/notes/update', inputs=[Notes.title], outputs=[Notes.id, Notes.title_upper])notes_api.add_delete_route(Notes, path='/notes/delete')notes_api.add_compute_route(Notes, path='/titles', inputs=[Notes.title], outputs=[Notes.title_upper])notes_api.add_query_route(path='/notes/by-tag', query=notes_by_tag, method='get')
What app.py declares
Each row links to its line.
- runs on insert
- stored
- index
- route
serves notes_api
Run it
Needs uv. The routes then answer on port 8000.
terminal
git clone https://github.com/pierrebrunelle/pixeltable-sticky-notescd pixeltable-sticky-notesuv syncuv run pxt schema update app.py notesuv run python seed.py notesuv run pxt service run app.py notes --port 8000
Related apps
- Forge Heat CyclesForge heat-cycle registry API: B-tree indexes, chained risk UDFs, and parallel shop-floor writersShares: UDFs
- Climbing Route ToposClimbing-route topo registry API: photo uploads with thumbnails, grayscale copies, grade bands and index-backed crag lookupsShares: UDFs
- Warehouse Pick ListsWarehouse pick-list REST API: units, pick zones, waves and tote labels as incremental computed columns over Json order linesShares: UDFs