Preferences allow users to customize their experience in your application. You can save settings like theme choice, language selection, or notification preferences. Appwrite provides multiple ways to store these preferences, depending on your needs.
There are four main options for storing user preferences in applications using Appwrite:
Browser localStorage
The browser's localStorage API is a standard web technology that persists data in the user's browser.
Device-specific: Settings are only available on the current device
Simple key-value storage
No server-side processing required
Data persists even after browser sessions end
Limited to 5MB per origin in most browsers
// Store a preference using the browser's built-in localStorage API
localStorage.setItem('darkMode', 'true');
// Retrieve a preference
const darkMode = localStorage.getItem('darkMode');
User preferences
Appwrite provides a built-in user preferences system through the Account API, allowing you to store preferences directly on the user object.
Persists across all user devices
Stored as a JSON object
Limited to 64kB of data
Simple API for updating and retrieving
Learn more about user preferences
Team preferences
Team preferences let you store settings that apply to an entire team of users, well-suited for collaborative features.
Shared across all team members
Useful for team-wide settings like theme, notification preferences, or feature toggles
Stored as a JSON object in the team
Limited to 64kB of data
Learn more about team preferences
Appwrite Databases
For complex preference structures or when storing larger amounts of data, Appwrite Databases offer a flexible solution.
Schema validation for structured data
Support for complex data types and relationships
Unlimited storage capacity (subject to project limits)
Advanced querying capabilities
Fine-grained access control
Learn more about Appwrite Databases