Skip to Content
Potik Docs

Build a field notes feature

A survey team needs somewhere to record observations. Add a Notes resource and give its list a name that makes sense to that team. Start inside the generated fieldwork directory from the quick start.

Generate the resource

Install the Go toolchain specified in your generated go.mod, Node.js 24 with npm, and Docker. Install the web dependencies and generate the files:

npm --prefix apps/web ci
./tools/starter-add feature note --plural notes
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/src" -w /src sqlc/sqlc:1.30.0 generate -f backend/sqlc.yaml
go tool gqlgen generate
npm --prefix apps/web run codegen

The generator adds a migration, SQL queries, a Go service, GraphQL operations, and React Router list and detail routes. Code generation connects the handwritten SQL and schema to their typed callers.

Make it yours

Open apps/web/app/routes/notes.tsx, find the list heading, and change its displayed text from Notes to Field notes. Keep the route path and GraphQL operation names as generated. Once you customize a generated file, continue editing it directly. Rerunning the generator on a conflicting edit will report which file differs.

go test ./...
npm --prefix apps/web run check
docker compose up --build -d --wait

Open Field notes. Check the heading, create Northern ridge, open the record, and rename it Northern ridge survey. Reload the page and check the new name. Changes appear in the same PostgreSQL database as your other application data.

Change the behavior

ChangeFirst file or directory to inspect
Field label or form validation messageapps/web/app/routes/notes.tsx and apps/web/app/features/notes/
A rule that must apply to every clientbackend/internal/modules/notes/
Who can access a rowAuthorization scope in the Go service and predicates in backend/queries/notes.sql
A new persisted fieldAdd a Goose migration, extend the SQL and GraphQL schema, then regenerate bindings.

Use two signed-in users when testing changes to access rules. A local demo record exercises persistence, while separate user sessions exercise ownership. See the request walkthrough and generator reference.

On this page