Best Practices

Some tips to help you think through designing your database architecture

Designing a database to conform to every best practice the first try is not a simple task, so we hope these items will provide some clarity on the best practices to follow when thinking about the architecture of your Xano database.

  • Use a consistent naming convention for tables and database fields

    • This will help you quickly locate data you are searching for in the database view, as well as when constructing database actions in the Xano function stack.

  • Use data types appropriately and define constraints

    • For example, if you are storing a user's email in your database, you can use the email field type which comes predefined with constraints so that the data matches the defined data type.

    • You also have the ability to apply your own filters to each database field, which will let you enforce certain constraints at the table level.

  • Don't repeat yourself

    • Using features like relational data will ensure that you are able to populate and query your database in the most efficient manner possible.

  • Index columns that are frequently used in custom queries on larger tables

    • Indexes should be used on larger tables (>10,000 records) to ensure your database queries are as performant as possible. Indexing is an advanced topic, and should be approached with care. See our indexing documentation here for more information.

  • Implement proper security measures to protect sensitive data

    • In Xano, this means using features like the API Access on your database fields to ensure full control over what can be accessed and returned by your APIs.

    • Data security is further handled at an API level. See this video for the various methods on how to secure your Xano API endpoints.

  • Back up the database as needed

    • Xano does maintain a 3 day rolling backup of your entire instance for any paid plans. If you need a whole-instance backup restored, please reach out to support and we can accommodate this for you. You also have the option to export a table via CSV through the function stack.

  • Monitor and optimize database performance

    • Xano provides a usage graph to monitor your database compute usage. See this section of our documentation for more details, as well as steps to take if you are seeing high database compute usage.

  • Keep the database design simple and avoid unnecessary complexity.

Designing a database is usually something that can require multiple attempts before getting it exactly right, but following the points listed on this page will put you on the right path to avoiding making major architecture changes later in the development cycle.

Last updated