Notes from the build

Practical articles on building the backend of a mobile app, from subscriptions and push notifications to Postgres security and working with AI coding agents.

Topics

More articles

RSS feed

8 min read

Backend context that keeps AI coding agents safe

Agents make safer backend changes with declarative config, schemas as contracts, MCP tools, dry runs, reviewed migrations and least-privilege credentials.

  • ai
  • agents
  • architecture
  • security

6 min read

Backend for an Expo app: auth, subscriptions and push

What an Expo app needs from a backend: verified sign-in tokens, server-side subscription checks, stored push tokens, and secrets kept out of the bundle.

  • expo
  • react-native
  • authentication
  • subscriptions
  • push-notifications

7 min read

Mobile background jobs: reminders, retries, queues

Run mobile reminders and background work using a Postgres queue, SKIP LOCKED, idempotency keys, backoff retries, time zone handling and metrics.

  • background-jobs
  • postgres
  • push-notifications
  • architecture

9 min read

Mobile API versioning and migrations for old apps

Old app versions stay installed for years. Use expand and contract migrations, additive API changes, minimum versions and feature flags to change safely.

  • migrations
  • architecture
  • database
  • testing

8 min read

Per-plan AI quotas without shipping your API key

Give free and paid users different AI limits by routing model calls through your own gateway, metering usage in Postgres, and never embedding a key in the app.

  • ai
  • architecture
  • postgres
  • subscriptions

9 min read

Postgres row-level security for mobile app backends

Row-level security lets Postgres enforce that each user sees only their own rows. Covers policy design, common mistakes, performance, and testing policies.

  • postgres
  • security
  • database
  • authentication

9 min read

Push notification architecture for APNs and FCM

Model users, devices, tokens, and preferences as separate records, handle token invalidation and quiet hours, and send idempotently across APNs and FCM.

  • push-notifications
  • architecture
  • ios
  • android

9 min read

Why subscription entitlements belong on the server

A mobile app should not decide on the device what a user paid for. Verify purchases on a server and keep entitlements in a table fed by store notifications.

  • subscriptions
  • payments
  • architecture
  • ios

8 min read

Testing subscription states before a real purchase

Test trials, renewals, billing retry, expiry and refunds with StoreKit files, sandbox accounts and seeded backend state before any real money moves.

  • subscriptions
  • testing
  • ios
  • android