At Tenera, we are committed to prioritising our customers' needs and embracing challenges that come with complex technical requirements. Our focus is on developing highly accessible applications that cater to a wide user base, from Documentation Specialists compiling reports in an office on stable WiFi to Engineers working on a spotty cell network while underground. Our applications are designed to be universally accessible, whether used on a mobile phone, tablet, or computer. We understand that the varying requirements of our users make it vital to create a versatile, one-size-fits-all application. To achieve these goals, Tenera has used the latest technology in web development to build its Inspections App. This blog post will explore AWS Amplify Datastore, a key piece of the Tenera Development Puzzle.
What is Amplify?
Amazon Web Services (AWS) Amplify is a comprehensive set of tools and services designed for developers looking to build scalable, full-stack applications rapidly. It simplifies complex tasks, such as authentication, API creation, and data storage. Amplify has allowed our team to accelerate development cycles and focus on crafting great user experiences rather than getting bogged down writing boilerplate code for cloud infrastructure. By abstracting away much of the backend complexity, AWS Amplify empowers our developers to quickly learn and integrate with many AWS Technologies, bringing those sought-after features directly to our customers. The key feature of Amplify we would like to focus on today, is Amplify Datastore.
What is Amplify Datastore?
Datastore is an important piece of Amplify, and it has laid the foundation for the way we handle data in our applications. It is designed to function as a solution for local data storage, as well as real time synchronisation with the cloud. At its core, Datastore facilitates the management of application data, allowing developers to easily define data models in using GraphQL schemas. Once defined, amplify creates the cloud data storage for them, and APIs for all typical interactions.
This functionality is particularly valuable in scenarios where consistent internet access is not a given – such as underground sites or areas with unstable network conditions. Datastore's ability to store data locally and sync it back to the cloud once online ensures that there is no interruption in the workflow, maintaining data integrity and continuity. Moreover, the real-time data synchronisation feature enables instantaneous updates across all devices when online, ensuring that every team member, whether in the field or the office, has access to the latest information.
The reason this is important was showcased during a recent site visit in an underground parking garage experiencing a leak. An engineer was dispatched on an inspection, which was performed using the Tenera Inspections App on their tablet. Throughout the inspection, a Documentation Specialist was connected in real-time, transforming the engineer’s notes into a detailed report.
When the engineer went deeper into the garage, he encountered a complete loss of internet connectivity. This is a common scenario in such environments, but thanks to DataStore's capabilities integrated within the Tenera Inspections app, the engineer could seamlessly continue his work.
Once the engineer left the garage, the accumulated notes synchronised with the cloud. This instant update meant that the Documentation Specialist, who had been momentarily paused, received all the notes taken offline.
Such real-world applications of Tenera, underpinned by the resilience of Datastore, exemplify our commitment to providing reliable, uninterrupted service, no matter the location or challenge at hand."
How to use Amplify Datastore:
2) Define your data models:
Models in Amplify are managed as GraphQL Schemas. Navigate to the amplify/backend/api/<YourApiName>/schema.graphql file and define your model. For example, an inspection might look as follows:
3) Run `amplify push` from amplify CLI. This will provision all sorts of cloud resources for your model, including DynamoDB tables and AppSync APIs
4) Initialize Datastore in Frontend
Configure your Datastore in the FrontEnd as required for your project. Here you can customise how data is synchronised and under what conditions, and other details like authorisation strategies and conflict handling logic. Once your configuration is defined, you can initialise Datastore to begin synchronising your data.
5) Interface with your data in the Front End:
Datastore will handle all of the logic of propagating data to and from your backend, and as such data operations are as simple as calling DataStore.query!
And there we have it, a simple data model all ready for use offline! As you can see, Amplify's Datastore is a powerful tool for enabling offline interactions in web and mobile applications. However, it's important to note that Datastore alone does not an application make, and it is just one piece of the larger puzzle in creating fully functional offline experiences.
At Tenera, our journey to develop a fully offline-enabled Progressive Web Application (PWA) has been a long one. Datastore provided a robust foundation but integrating it into our broader system required meticulous planning, development, and testing. Only after learning the strengths and shortcomings of Datastore and many other technologies were we able to create the seamless experience we have today.
If you want to learn more about Tenera's journey and continued success stories, make sure to follow us on LinkedIn. If you're interested in difficult tech problems like this one, make sure to visit our careers page to see open roles.