Client-Side Storage
Web data persisted across multiple sessions is traditionally stored on the back-end of the application, but a new wave of client-side storage technologies is about to change the way web apps are built.
Cookies aren’t the only way to store data within the browser. There is the Web Storage API to store user preferences, but also IndexedDB for structured data and service workers to cache entire pages.
Combined, these technologies allow better performance (fast loading speed, smaller response payloads) and better security (offline support: if the network goes out, the data is still available locally to sync). It’s an incredible manna for web apps to drastically improve their user experience.
Let’s take Cowriters, for example. The new app is coming soon and relies heavily on such browser technologies.
Each user’s posts are downloaded locally in the background, in a dedicated IndexedDB. It allows users to browse and search their posts almost instantly from their dashboards.
When a post is being modified, service workers are used to save the text editor’s state and sync it with the back-end MySQL database. Even if the electricity goes out, the changes aren’t lost and will be sent automatically.
Dark mode and menu states are memorized by the application using localStorage variables.
The Cache API can be used to bookmark articles and read them offline without needing an Internet connection.
A full-stack developer, combining the power of both worlds, can make state-of-the-art apps that are fast and energy-efficient. This is the future, and it lies in-between each realm.