Skip to main content
A shop has two items on its shelves. Coffee is below its reorder point. Tea is above it. At 06:00 UTC a Go job saves the number of items to reorder in Postgres. The API serves the latest count even after the process restarts. On floo, the HTTP service and the scheduled job run the same image and receive the same DATABASE_URL within an environment. The job exits after writing one row. Its UTC date is the primary key, so running it twice on the same day updates that row. Open the daily reorder report. To deploy your own copy with a coding agent, paste this from an empty project directory:

Build the report

In an empty directory, save these two files. Run go mod tidy with Go 1.26 to create go.sum.
go.mod
main.go

Deploy the API and schedule

Dockerfile
floo.app.toml
Choose an available app name starting with go-reorder- in floo.app.toml. The migration creates both tables and seeds the two example items before the new image receives traffic. The sample endpoint is public and contains only fixture data. For real stock levels, restrict the app to invited staff. Install the floo CLI, sign in, and run these commands from the example directory:

Run the first report

Open the dev URL printed by the deploy. Before the first job runs, it shows No report yet. Run the job from the same directory:
Refresh the URL after the job finishes. The UTC date appears followed by SKUs to reorder: 1. Run the job again. The count stays at one. Change the reorder condition or the fixture quantities to test a different stock policy. For an existing Go service, see the Go deployment guide. Cron jobs covers retries, timeouts, and running a job in prod.