The video uses a specific AI coding tool to demonstrate the setup, but the configuration works 1:1 with Cursor, Claude Code, or any other tool. Despia is web framework and tooling agnostic, so the only thing that matters is the SDK call.
despia.uuid returns a stable identifier for the device (Apple’s IDFV on iOS, Android’s installation ID on Android). It is available synchronously, so you can read it without awaiting anything, and it stays constant for the lifetime of the install.
Installation
- Bundle
- CDN
How it works
Readdespia.uuid directly. The value is injected by the native runtime before your JavaScript executes, so it is available on first render with no loading state.
null fallback in the browser keeps your code from throwing during web preview. Always handle the null case downstream rather than assuming the value exists.
When to use UUID vs Storage Vault
These two features sound similar but solve different problems. Pick based on what happens when the user reinstalls or switches devices.| Need | Use | Survives reinstall | Survives device switch |
|---|---|---|---|
| Track active sessions, link a logged-in user to their current device, basic analytics | despia.uuid | No | No |
| Persist subscription state, paid unlocks, account recovery hooks, anti-abuse | Storage Vault | Yes | Yes (same Apple ID / Google account) |
| Anonymous device fingerprinting for fraud detection | despia.uuid plus a hashed Storage Vault entry | Yes (Vault half) | Yes (Vault half) |
despia.uuid when “the device the user is currently on” is the question. Reach for Storage Vault when “the same person, regardless of which device they are on” needs to remain identifiable, since Vault values sync via iCloud Key Value Store and Android Key/Value Backup automatically.
Read and sync with your backend
Read the UUID once on app start, then send it to your backend alongside the authenticated user ID so you can build a device-to-user mapping.useEffect once the user is authenticated, so it does not fire on every render.
Backend storage
Store the device-to-user mapping with the device ID as the primary key, not the user ID. One user can have multiple devices, but each device should map to one current user. Usemerge: true (or your database equivalent) so subsequent syncs update the timestamp without overwriting other fields.
userId and look at how many distinct deviceId values appear in a rolling window. For paid feature unlocks tied to the device, query by deviceId and confirm the linked userId matches the request’s authenticated user.
Resources
NPM Package
despia-native