Mobile app best practices
Learn about the best practices for building performant mobile apps.
As your Retool apps become more complex and interact with an increasing number of data sources, it's important to monitor performance and make improvements where needed. Performance issues can happen for any number of reasons and can be difficult to replicate, especially when they involve external factors.
Follow these practices to identify, resolve, and prevent performance degradation and keep your apps operating as efficiently as possible.
Refer to the best practices guide for queries to learn more about writing performant queries for your data.
Investigate external factors
Apps are a collection of components that query data from third-party services. Users interact with apps over the internet using a web browser. It's often useful to first rule out user issues (internet connectivity, outdated browser, etc.), followed by potential service disruption with any connected API or database.
Utilize built in performance tooling
The Retool debug tools have app specific suggestions for improving performance. For example, the linting tab highlights which queries or components could be degrading performance. The performance tab compiles useful statistics for measuring how effective optimization and refactoring work is.
Break up large apps
The more components and queries an app contains, the more work you need to do to maintain them. Break up larger apps that perform several distinct but separate functions into multiple apps that can focus on specific needs.
You can link to other apps using components like Navigation or Button so that users can access other apps when needed. You can also use modules to create larger apps that combine separately developed apps together, streamlining maintenance.
You can also share data between apps using URL query strings or localStorage
.
Minimize long dependency chains
You can reference other queries and components almost anywhere using JavaScript. To enable this, Retool builds and maintains a dependency graph for each app. The more complex the dependency graph becomes, the longer it can take to troubleshoot and update apps. Avoid deep references to other components that result in long dependency chains.
Reuse Retool tabs
Avoid repeatedly closing and reopening tabs. Each app must initialize when first opened, especially those that perform actions or run queries on load. This can add unnecessary delays to the user experience.
Consider self-hosting Retool for your organization
You can self-host Retool on your own infrastructure. You can run Retool in your own virtual private cloud (VPC) or behind your virtual private network (VPN). This can allow the Retool backend to be located much closer to your data sources.