- This is a Go HTTP API backed by PostgreSQL. Source lives under
src/. - Build:
cd src && go build ./... - Test:
cd src && go test ./... - Always run tests after making code changes to verify nothing is broken.
Keep README.md up to date whenever you:
- Add, remove, or rename a route.
- Change a route's query parameters, request body, or response shape.
- Add or remove environment variables.
- Change build or run instructions.
The API routes table and each route's section must reflect the live code in
src/main.go and src/handlers/.
- Schema source of truth:
https://github.com/markmnl/fmsgd/blob/main/dd.sql - Ensure all SQL in Go source files aligns with that schema.
- When adding recipients via the
add-toroute, updatemsg.add_to_fromin the same transaction as themsg_add_toinserts. - The WebSocket hub (
/fmsg/ws) LISTENs on thenew_msgLISTEN/NOTIFY channel for push delivery.new_msgfires once per recipient (payload<msg id>,<addr>) whenever a message becomes sent/arrived. Do not rename or remove that trigger without updating the hub. Thenew_msg_tochannel is the sender daemon's outbound delivery queue and is not used by this service. - For each
new_msgnotification the hub also dispatches a Web Push (when VAPID is configured) to the recipient'spush_subscriptionrows, so delivery does not depend on a live WebSocket.