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.