Skip to content

Bigger App Structure

Verified status as of March 28, 2026.

Quick View

  • Complexity: Intermediate
  • Typical time: 25 minutes
  • Outcome: scalable repository layout with clear ownership and background task patterns
functions/
  _shared/
  api/
    users/
    orders/
  jobs/
    render-report/
  webhooks/

Guidelines:

  • isolate shared logic in _shared
  • keep API routes and background jobs separate
  • use explicit names for cross-team ownership
  • if discovery behavior feels ambiguous, review Zero-config routing for the warning rules around depth, reserved prefixes, and handler selection

Background/Scheduled Execution Pattern

Use scheduler/job functions for non-request work:

  • cron trigger receives minimal payload
  • function fetches work unit
  • idempotency key prevents duplicate side effects
curl -sS 'http://127.0.0.1:8080/_fn/health'

Validation

  • API routes and jobs are discoverable without ambiguity.
  • Job functions are idempotent.
  • Ownership boundaries map to folders.

Troubleshooting

  • If route collisions happen, check folder depth and method files.
  • If jobs duplicate execution, add lock/idempotency key.
  • If modules are reused too widely, split by domain to reduce coupling.
Last reviewed: March 28, 2026 · Docs on fastfn.dev