Setting Up Your Data Model
Start with your database schema before building any endpoints. Xano's visual table builder supports all PostgreSQL data types: text, integer, boolean, JSON, timestamps, and file references.
Key conventions we use: every table gets a created_at and updated_at timestamp (Xano adds these automatically), use integer IDs for performance, and use JSON fields sparingly, normalize when possible.
For multi-tenant SaaS, every table should have a user_id or workspace_id foreign key. This makes your access control logic clean and consistent.
Structuring Your API Endpoints
Xano auto-generates CRUD endpoints for every table. But for production apps, you'll want custom endpoints that handle business logic.
Our naming convention: GET /api/[resource] (list), GET /api/[resource]/:id (detail), POST /api/[resource] (create), PATCH /api/[resource]/:id (update), DELETE /api/[resource]/:id (delete). Keep it RESTful. Avoid RPC-style endpoints unless the action truly doesn't map to a resource.
Authentication & Authorization
Xano's built-in auth is JWT-based and production-ready. Enable the auth add-on, and you get signup, login, and token refresh out of the box.
For authorization (what a logged-in user can do), use the "Precondition" step in your function stacks. A typical pattern: get the current user from the JWT, then verify they own the record they're trying to modify.
For admin roles, store a role field on the user table and check it in preconditions. For multi-tenant, store workspace membership in a separate table and join on every request.
Business Logic with Function Stacks
Xano's function stack is where the magic happens. Each step in the stack maps to an operation: query a database, call an external API, run a conditional, transform data, send an email.
For complex logic, use Xano's "Custom Function" feature to create reusable building blocks. We build these for: calculating prices, validating complex inputs, sending notifications, and syncing data with third parties.
Avoid deeply nested conditionals, if your stack has more than 3 levels of nesting, refactor into separate functions.
Third-Party Integrations
Xano's External API request step connects to any REST API. We've integrated Stripe, Twilio, SendGrid, HubSpot, Airtable, and dozens of others.
Best practice: create one "utility" function per external service (e.g., "Send Stripe Charge") that handles the API call, error handling, and response parsing. Then call this utility from your business logic stacks, it keeps your logic clean and makes the integration easy to update.
Performance & Scaling
Xano scales automatically, no infrastructure management required. For performance optimization: use indexes on fields you query frequently (user_id, created_at, status), paginate all list endpoints (use Xano's built-in offset/limit or cursor pagination), and use Xano's caching for data that doesn't change often.
For high-traffic endpoints, Xano's paid plans offer increased concurrency. We've run apps with 50K daily active users on Xano without performance issues.
Xano Middleware: Request Preprocessing and Global Logic
Xano supports middleware via its "Pre-run" and "Post-run" hooks, functions that execute before or after every endpoint in an API group. This is the right place for cross-cutting concerns: logging every request, validating API keys for public endpoints, rate limiting by IP or user, and injecting common context like the current workspace from the JWT.
We use a standard middleware pattern on all production projects: the pre-run hook validates the JWT, loads the current user and workspace into context, and sets a global error format. This means every business logic endpoint starts with a clean, authenticated context, no repetition across 50 endpoints.
Post-run hooks are less commonly needed but useful for audit logging. For regulated industries (fintech, healthtech), every data mutation should write an audit record. Building this in post-run middleware means you can't accidentally forget it on a new endpoint.
Background Tasks and Async Processing
Not everything belongs in a synchronous request-response cycle. Sending emails, generating PDFs, processing uploaded files, and syncing with third-party CRMs should all be async. Xano's Background Tasks feature lets you trigger functions that run outside the HTTP request cycle, the API responds immediately and the heavy work happens in the background.
In our projects, we use background tasks for: webhook processing (Stripe events take time to parse and update), bulk data imports (CSV uploads with thousands of rows), and scheduled jobs like daily summary emails or subscription renewal checks. Xano's task queue is reliable and observable, you can see running and failed tasks in the dashboard and re-run them manually if needed.
For truly complex scheduling (run this function every day at 9am in the user's timezone), Xano integrates cleanly with Make.com or n8n as a scheduler that triggers your Xano endpoints on cron.
Environment Variables and Configuration Management
Xano supports environment variables at the instance and API group level. Store all sensitive configuration, OpenAI API keys, Stripe secret keys, SendGrid API keys, Twilio auth tokens, as environment variables, never in your function stacks directly. This is a security baseline that every production Xano project should follow.
Xano also supports multiple environments via its "Workspace Branch" feature (on paid plans). This lets you maintain separate development, staging, and production environments with different database instances and environment variables. In our workflow, all new features are built on a dev branch, tested on staging, and merged to production, the same git-like discipline as traditional development.
A practical tip: prefix your environment variable names with the service name (STRIPE_SECRET_KEY, OPENAI_API_KEY, SENDGRID_API_KEY). When you have 20+ variables, naming conventions save significant debugging time.
Xano vs Supabase Edge Functions: When to Use Each
Both Xano and Supabase Edge Functions can run backend logic. The right choice depends on what you're building. Xano is better for: full REST API management, complex multi-step business logic, apps where non-developers need to read or modify the logic, and anything requiring Xano's visual debugger. Supabase Edge Functions are better for: database triggers that run automatically on data changes, lightweight utility functions that live close to the database, and free-tier projects where Xano's cost isn't justified.
In most App Studio projects, we use both: Xano as the primary API layer (where frontend clients connect) and Supabase Edge Functions for database-triggered automation. For example, when a new subscription record is created in Supabase, an Edge Function immediately sends a welcome email, no polling or external trigger needed.
The key distinction is audience: Xano is visual and built for teams where business logic needs to be readable by non-engineers. Supabase Edge Functions are TypeScript/Deno and require developer context. For pure developer teams, either works. For teams with non-technical founders who want to understand and modify the logic, Xano wins clearly.
Xano Pricing Tiers: What You Actually Need
Xano has three main tiers: Free, Launch ($99/month), and Scale ($249/month). The Free tier is useful for prototyping but has no custom domain support for your API and limited execution time, don't use it for production. Launch is the right tier for most early-stage SaaS products: custom domain, background tasks, branching environments, and adequate concurrency for up to roughly 5,000 MAU.
The Scale tier adds higher concurrency, dedicated resources, and priority support. We upgrade clients to Scale when they consistently hit concurrency limits (usually around 10,000–15,000 MAU with peak usage patterns) or when their SLA requires dedicated infrastructure.
One cost note: Xano charges per instance, not per seat. A single Xano Launch instance hosts an unlimited number of APIs and endpoints. For agencies building multiple client apps, this is extremely cost-effective. We run multiple client projects per Xano instance during MVP phases, migrating each to a dedicated instance when they reach production scale.