{
  "id": "saas-starter",
  "title": "SaaS app starter: sign-in, payments, email and uploads",
  "summary": "The I/O a new web app needs first, each behind one interface with a real provider and a development stand-in: OAuth/OIDC sign-in with sessions, Stripe checkout and webhooks, transactional email, and signed upload URLs.",
  "synonyms": [
    "saas",
    "saas starter",
    "saas boilerplate",
    "starter kit",
    "web app starter",
    "next.js starter",
    "sign in with google",
    "login with github",
    "stripe checkout",
    "stripe payments",
    "stripe webhooks",
    "send email",
    "transactional email",
    "resend",
    "smtp",
    "file upload",
    "s3 upload",
    "presigned url",
    "signed url",
    "integrations"
  ],
  "apps": [
    "SaaS product",
    "web app with accounts and payments",
    "Next.js app",
    "startup MVP",
    "membership site with paid plans",
    "app with file uploads"
  ],
  "language": "python",
  "includes": [],
  "includedBy": [],
  "caveats": [
    "These are integrations: they do I/O and read secrets from the environment. Set the variables `fune secrets` lists (never commit their values), and send one real request through each provider from a staging environment before going live."
  ],
  "sections": [
    {
      "key": "sign-in",
      "title": "Sign-in",
      "purpose": "Sign people in with an identity provider and keep them signed in.",
      "from": "saas-starter",
      "members": [
        {
          "id": "auth.oauth-sign-in",
          "tier": "core",
          "why": "OAuth 2.0 / OpenID Connect with PKCE (Google, Microsoft, Auth0, any OIDC issuer, or GitHub), and a signed session cookie.",
          "section": "sign-in",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Sign users in with OpenID Connect or GitHub (authorisation code + PKCE), and keep them in a signed session cookie.",
          "status": "stable",
          "license": "MIT",
          "languages": [
            "typescript"
          ],
          "available": false,
          "kind": "integration",
          "integration": {
            "providers": [
              "oidc",
              "github"
            ],
            "select": "AUTH_PROVIDER",
            "secrets": [
              "SESSION_SECRET",
              "OIDC_CLIENT_SECRET (oidc)",
              "GITHUB_CLIENT_SECRET (github)"
            ],
            "config": [
              "AUTH_PROVIDER",
              "OIDC_ISSUER (oidc)",
              "OIDC_CLIENT_ID (oidc)",
              "OIDC_SCOPES (oidc)",
              "GITHUB_CLIENT_ID (github)"
            ]
          },
          "group": true,
          "functions": [
            "beginSignIn",
            "completeSignIn",
            "createSession",
            "readSession",
            "sessionCookie"
          ],
          "signatures": [],
          "reference": null,
          "url": "http://www.functionalweave.com/functions/auth.oauth-sign-in"
        },
        {
          "id": "auth.normalise-email",
          "tier": "optional",
          "why": "Normalises the email a provider returns, so one address is one account.",
          "section": "sign-in",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Trim an email address and lower-case its domain for storage and lookup, or null if it is not a plausible address.",
          "status": "stable",
          "license": "Apache-2.0",
          "languages": [
            "typescript",
            "python",
            "rust"
          ],
          "available": true,
          "group": false,
          "functions": [
            "normaliseEmail"
          ],
          "signatures": [
            "def normalise_email(value: str) -> Optional[str]"
          ],
          "reference": "from fune.auth.normalise_email import normalise_email  # auth.normalise-email@^1",
          "url": "http://www.functionalweave.com/functions/auth.normalise-email"
        },
        {
          "id": "auth.account-link",
          "tier": "optional",
          "why": "Decides whether a provider sign-in signs in, links to an existing account by verified email, or creates one.",
          "section": "sign-in",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Decide whether an OAuth sign-in signs in, links to an existing account by verified email, creates one, or is refused.",
          "status": "stable",
          "license": "Apache-2.0",
          "languages": [
            "typescript",
            "python",
            "rust"
          ],
          "available": true,
          "group": false,
          "functions": [
            "decideAccountLink"
          ],
          "signatures": [
            "def decide_account_link(identity: OAuthIdentity, accounts: Sequence[LinkAccount], links: Sequence[IdentityLink]) -> LinkDecision"
          ],
          "reference": "from fune.auth.account_link import decide_account_link  # auth.account-link@^1",
          "url": "http://www.functionalweave.com/functions/auth.account-link"
        },
        {
          "id": "auth.email-token",
          "tier": "optional",
          "why": "Hashed single-use tokens for email verification and magic-link sign-in.",
          "section": "sign-in",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Hashed single-use tokens for email verification, password reset and magic links, with expiry, as pure steps.",
          "status": "stable",
          "license": "Apache-2.0",
          "languages": [
            "typescript",
            "python",
            "rust"
          ],
          "available": true,
          "group": true,
          "functions": [
            "generateEmailToken",
            "hashEmailToken",
            "checkEmailToken",
            "consumeEmailToken"
          ],
          "signatures": [
            "def generate_email_token(random_bytes: Sequence[int], purpose: str, subject: str, now: int, ttl_seconds: int) -> IssuedEmailToken",
            "def hash_email_token(token: str, purpose: str) -> str",
            "def check_email_token(records: Sequence[EmailTokenRecord], token: str, purpose: str, now: int) -> EmailTokenCheck",
            "def consume_email_token(records: Sequence[EmailTokenRecord], token: str, purpose: str, now: int) -> EmailTokenResult"
          ],
          "reference": "from fune.auth.email_token import generate_email_token, hash_email_token, check_email_token, consume_email_token  # auth.email-token@^1",
          "url": "http://www.functionalweave.com/functions/auth.email-token"
        },
        {
          "id": "auth.rbac",
          "tier": "optional",
          "why": "Roles with inheritance, wildcard permissions and ownership checks, with generated access tests.",
          "section": "sign-in",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Roles with inheritance, permission checks with wildcards and ownership, and a generated per-role access-test matrix.",
          "status": "stable",
          "license": "Apache-2.0",
          "languages": [
            "typescript",
            "python",
            "rust"
          ],
          "available": true,
          "group": true,
          "functions": [
            "resolveRoles",
            "hasPermission",
            "checkAccess",
            "accessMatrix"
          ],
          "signatures": [
            "def resolve_roles(policy: RbacPolicy, roles: Sequence[str]) -> ResolvedRoles",
            "def has_permission(policy: RbacPolicy, roles: Sequence[str], permission: str) -> bool",
            "def check_access(policy: RbacPolicy, subject: AccessSubject, action: str, resource: AccessResource) -> AccessDecision",
            "def access_matrix(policy: RbacPolicy) -> List[AccessTestCase]"
          ],
          "reference": "from fune.auth.rbac import resolve_roles, has_permission, check_access, access_matrix  # auth.rbac@^1",
          "url": "http://www.functionalweave.com/functions/auth.rbac"
        }
      ],
      "gaps": [
        {
          "key": "users-table",
          "text": "The users table and the table of linked provider identities are yours.",
          "section": "sign-in",
          "from": "saas-starter"
        }
      ]
    },
    {
      "key": "payments",
      "title": "Payments",
      "purpose": "Take a payment or start a subscription, and learn reliably that it succeeded.",
      "from": "saas-starter",
      "members": [
        {
          "id": "payments.stripe-checkout",
          "tier": "core",
          "why": "Creates a Stripe Checkout session and verifies Stripe's webhook signatures; a local provider stands in during development.",
          "section": "payments",
          "from": "saas-starter",
          "version": "1.1.0",
          "summary": "Start a Stripe Checkout session and verify Stripe's signed webhooks, with a local stand-in for development.",
          "status": "stable",
          "license": "MIT",
          "languages": [
            "typescript"
          ],
          "available": false,
          "kind": "integration",
          "integration": {
            "providers": [
              "stripe",
              "local"
            ],
            "select": "PAYMENTS_PROVIDER",
            "secrets": [
              "STRIPE_SECRET_KEY (stripe)",
              "STRIPE_WEBHOOK_SECRET (stripe)",
              "LOCAL_WEBHOOK_SECRET (local)"
            ],
            "config": [
              "PAYMENTS_PROVIDER",
              "LOCAL_CHECKOUT_URL (local)"
            ]
          },
          "group": true,
          "functions": [
            "createCheckoutSession",
            "verifyWebhook",
            "signWebhook"
          ],
          "signatures": [],
          "reference": null,
          "url": "http://www.functionalweave.com/functions/payments.stripe-checkout"
        },
        {
          "id": "payments.stripe-portal",
          "tier": "optional",
          "why": "Sends a customer to Stripe's portal to change plan, update a card or cancel; a local provider stands in during development.",
          "section": "payments",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Open Stripe's customer portal so a customer manages plan, card and invoices, with a local stand-in.",
          "status": "stable",
          "license": "MIT",
          "languages": [
            "typescript"
          ],
          "available": false,
          "kind": "integration",
          "integration": {
            "providers": [
              "stripe",
              "local"
            ],
            "select": "PAYMENTS_PROVIDER",
            "secrets": [
              "STRIPE_SECRET_KEY (stripe)"
            ],
            "config": [
              "PAYMENTS_PROVIDER",
              "LOCAL_PORTAL_URL (local)"
            ]
          },
          "group": false,
          "functions": [
            "createPortalSession"
          ],
          "signatures": [],
          "reference": null,
          "url": "http://www.functionalweave.com/functions/payments.stripe-portal"
        },
        {
          "id": "subscriptions.stripe-state",
          "tier": "optional",
          "why": "Folds Stripe's subscription and invoice webhooks into one subscription state, idempotently and in order.",
          "section": "payments",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Folds Stripe's subscription and invoice webhook events into one normalised subscription state, in any order.",
          "status": "stable",
          "license": "Apache-2.0",
          "languages": [
            "typescript",
            "python",
            "rust"
          ],
          "available": true,
          "group": false,
          "functions": [
            "applyStripeEvent"
          ],
          "signatures": [
            "def apply_stripe_event(state: Optional[SubscriptionState], event: Any) -> Optional[SubscriptionState]"
          ],
          "reference": "from fune.subscriptions.stripe_state import apply_stripe_event  # subscriptions.stripe-state@^1",
          "url": "http://www.functionalweave.com/functions/subscriptions.stripe-state"
        },
        {
          "id": "subscriptions.proration",
          "tier": "optional",
          "why": "Prorates a mid-cycle plan change, when you price upgrades yourself.",
          "section": "payments",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Mid-cycle plan change: credit for unused time on the old plan and charge for the rest of the period on the new one.",
          "status": "stable",
          "license": "Apache-2.0",
          "languages": [
            "typescript",
            "python",
            "rust"
          ],
          "available": true,
          "group": false,
          "functions": [
            "prorateChange"
          ],
          "signatures": [
            "def prorate_change(old_price: Money, new_price: Money, period_start: str, period_end: str, change_date: str, mode: RoundingMode) -> PlanChangeProration"
          ],
          "reference": "from fune.subscriptions.proration import prorate_change  # subscriptions.proration@^1",
          "url": "http://www.functionalweave.com/functions/subscriptions.proration"
        }
      ],
      "gaps": [
        {
          "key": "fulfilment",
          "text": "Storing the state per customer and fulfilling one-off orders from the webhook event are yours.",
          "section": "payments",
          "from": "saas-starter"
        }
      ]
    },
    {
      "key": "email",
      "title": "Email",
      "purpose": "Send transactional email: welcome, verification, reset, receipts.",
      "from": "saas-starter",
      "members": [
        {
          "id": "email.send",
          "tier": "core",
          "why": "Sends one email through Resend, any SMTP server, or the log in development.",
          "section": "email",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Send a transactional email through Resend, any SMTP server or the log, behind one call.",
          "status": "stable",
          "license": "MIT",
          "languages": [
            "typescript"
          ],
          "available": false,
          "kind": "integration",
          "integration": {
            "providers": [
              "resend",
              "smtp",
              "log"
            ],
            "select": "EMAIL_PROVIDER",
            "secrets": [
              "RESEND_API_KEY (resend)",
              "SMTP_URL (smtp)"
            ],
            "config": [
              "EMAIL_PROVIDER",
              "EMAIL_FROM"
            ]
          },
          "group": false,
          "functions": [
            "sendEmail"
          ],
          "signatures": [],
          "reference": null,
          "url": "http://www.functionalweave.com/functions/email.send"
        },
        {
          "id": "validation.email",
          "tier": "optional",
          "why": "Checks an address's syntax before you send to it.",
          "section": "email",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Is this a plausible email address? A documented, pragmatic subset of RFC 5322, not the full grammar.",
          "status": "stable",
          "license": "Apache-2.0",
          "languages": [
            "typescript",
            "python",
            "rust"
          ],
          "available": true,
          "group": false,
          "functions": [
            "isEmail"
          ],
          "signatures": [
            "def is_email(value: str) -> bool"
          ],
          "reference": "from fune.validation.email import is_email  # validation.email@^1",
          "url": "http://www.functionalweave.com/functions/validation.email"
        }
      ],
      "gaps": [
        {
          "key": "email-templates",
          "text": "The emails' wording, HTML templates and their translations.",
          "section": "email",
          "from": "saas-starter"
        }
      ]
    },
    {
      "key": "uploads",
      "title": "File uploads",
      "purpose": "Let browsers upload and download files straight to object storage.",
      "from": "saas-starter",
      "members": [
        {
          "id": "storage.signed-url",
          "tier": "core",
          "why": "Signed PUT and GET URLs for S3 (or R2, MinIO) and Google Cloud Storage, so files never pass through your server.",
          "section": "uploads",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Signed URLs for a browser to upload a file straight to S3 or Google Cloud Storage, and to download it.",
          "status": "stable",
          "license": "MIT",
          "languages": [
            "typescript"
          ],
          "available": false,
          "kind": "integration",
          "integration": {
            "providers": [
              "s3",
              "gcs"
            ],
            "select": "STORAGE_PROVIDER",
            "secrets": [
              "S3_SECRET_ACCESS_KEY (s3)",
              "GCS_HMAC_SECRET (gcs)"
            ],
            "config": [
              "STORAGE_PROVIDER",
              "S3_BUCKET (s3)",
              "S3_REGION (s3)",
              "S3_ACCESS_KEY_ID (s3)",
              "S3_ENDPOINT (s3)",
              "GCS_BUCKET (gcs)",
              "GCS_HMAC_ACCESS_ID (gcs)"
            ]
          },
          "group": true,
          "functions": [
            "signUpload",
            "signDownload"
          ],
          "signatures": [],
          "reference": null,
          "url": "http://www.functionalweave.com/functions/storage.signed-url"
        },
        {
          "id": "form.file-check",
          "tier": "optional",
          "why": "Checks a file's type and size in the browser and again before signing its upload URL.",
          "section": "uploads",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "Check files chosen in an upload field: accept types, size, empty files and how many, with GOV.UK messages.",
          "status": "stable",
          "license": "Apache-2.0",
          "languages": [
            "typescript",
            "python",
            "rust"
          ],
          "available": true,
          "group": true,
          "functions": [
            "validateFiles",
            "acceptsFile",
            "formatFileSize"
          ],
          "signatures": [
            "def validate_files(files: Sequence[FileInfo], rules: FileRules) -> FileCheck",
            "def accepts_file(accept: str, file: FileInfo) -> bool",
            "def format_file_size(bytes: int) -> str"
          ],
          "reference": "from fune.form.file_check import validate_files, accepts_file, format_file_size  # form.file-check@^1",
          "url": "http://www.functionalweave.com/functions/form.file-check"
        },
        {
          "id": "react.form.file-upload",
          "tier": "optional",
          "why": "The accessible file upload field that hands its files to the signed URL (React).",
          "section": "uploads",
          "from": "saas-starter",
          "version": "1.0.0",
          "summary": "A labelled file upload field: accept, size and how-many checked by form.file-check, the chosen files listed with errors.",
          "status": "stable",
          "license": "Apache-2.0",
          "languages": [
            "typescript"
          ],
          "available": false,
          "framework": {
            "name": "react",
            "range": "^19"
          },
          "group": false,
          "functions": [
            "FileUpload"
          ],
          "signatures": [],
          "reference": null,
          "url": "http://www.functionalweave.com/functions/react.form.file-upload"
        }
      ],
      "gaps": [
        {
          "key": "upload-scanning",
          "text": "Virus scanning, image resizing and checking what was uploaded are yours.",
          "section": "uploads",
          "from": "saas-starter"
        }
      ]
    }
  ],
  "gaps": [
    {
      "key": "users-table",
      "text": "The users table and the table of linked provider identities are yours.",
      "section": "sign-in",
      "from": "saas-starter"
    },
    {
      "key": "fulfilment",
      "text": "Storing the state per customer and fulfilling one-off orders from the webhook event are yours.",
      "section": "payments",
      "from": "saas-starter"
    },
    {
      "key": "email-templates",
      "text": "The emails' wording, HTML templates and their translations.",
      "section": "email",
      "from": "saas-starter"
    },
    {
      "key": "upload-scanning",
      "text": "Virus scanning, image resizing and checking what was uploaded are yours.",
      "section": "uploads",
      "from": "saas-starter"
    },
    {
      "key": "background-jobs",
      "text": "Retries and queues for slow I/O (sending email after the response, webhook processing) are your platform's.",
      "section": null,
      "from": "saas-starter"
    },
    {
      "key": "rate-limiting",
      "text": "Rate limiting sign-in and checkout endpoints by IP across instances needs a shared store.",
      "section": null,
      "from": "saas-starter"
    }
  ],
  "counts": {
    "members": 14,
    "core": 4,
    "optional": 10,
    "unreviewed": 0,
    "deprecated": [],
    "unavailable": [
      "auth.oauth-sign-in",
      "payments.stripe-checkout",
      "payments.stripe-portal",
      "email.send",
      "storage.signed-url",
      "react.form.file-upload"
    ],
    "missing": [],
    "gaps": 6
  },
  "coverage": {
    "method": "fune-coverage/1",
    "numerator": 4,
    "denominator": 10,
    "ratio": 0.4,
    "percent": 40,
    "needs": {
      "core": 4,
      "gaps": 6,
      "weighted": false
    },
    "met": [
      "auth.oauth-sign-in",
      "payments.stripe-checkout",
      "email.send",
      "storage.signed-url"
    ],
    "unmet": [
      {
        "key": "users-table",
        "kind": "gap",
        "weight": 1,
        "reason": "gap"
      },
      {
        "key": "fulfilment",
        "kind": "gap",
        "weight": 1,
        "reason": "gap"
      },
      {
        "key": "email-templates",
        "kind": "gap",
        "weight": 1,
        "reason": "gap"
      },
      {
        "key": "upload-scanning",
        "kind": "gap",
        "weight": 1,
        "reason": "gap"
      },
      {
        "key": "background-jobs",
        "kind": "gap",
        "weight": 1,
        "reason": "gap"
      },
      {
        "key": "rate-limiting",
        "kind": "gap",
        "weight": 1,
        "reason": "gap"
      }
    ],
    "deprecated": [],
    "unreviewed": [],
    "baseline": {
      "numerator": 0,
      "denominator": 10,
      "ratio": 0,
      "percent": 0,
      "what": "a typical hand-written app with no suite: none of the same needs is met by a verified capability, so 0 of the same denominator"
    },
    "computedAt": "2026-11-22T20:48:38.028Z",
    "language": {
      "language": "python",
      "numerator": 0,
      "ratio": 0,
      "percent": 0,
      "notIn": [
        "auth.oauth-sign-in",
        "payments.stripe-checkout",
        "email.send",
        "storage.signed-url"
      ]
    }
  },
  "warnings": [
    "not written in python: auth.oauth-sign-in, payments.stripe-checkout, payments.stripe-portal, email.send, storage.signed-url, react.form.file-upload",
    "These are integrations: they do I/O and read secrets from the environment. Set the variables `fune secrets` lists (never commit their values), and send one real request through each provider from a staging environment before going live."
  ],
  "url": "http://www.functionalweave.com/suites/saas-starter",
  "owner": null
}
