PortModels
Log in

Choosing where to store

Which of the three storage surfaces fits which kind of data.

PortModels gives an app three places to put data. They are not interchangeable.

Key/valueFilesPublic assets
Belongs toA user, in your appA user, in your appYour app
Readable byYour app, with kv.readYour app, with files.readAnyone
Written byYour app, with kv.writeYour app, with files.writeYou, as the developer
Size limit64KB per value10MB direct, more via presignLarge, via presign
Count limit1000 keys per userStorage quota
Good forSettings, state, small cachesDocuments, exports, mediaIcons, screenshots, samples

Quick decisions#

Settings, preferences, session state. Key/value. Small, structured, read on every session.

Something the user produced and wants back. Files. A generated report, an export, a transcript.

Something big. Files, via a presigned upload. Don't try to base64 a 30MB file into a 64KB key/value entry.

Your app's own icon. Public assets. It's the same for every user and it's not private.

A cache of an expensive result. Key/value if it's small and per-user; files if it's large. Either way you're saving the user credits.

A password or an API key of your own. None of these. Keep your own secrets in your own infrastructure — per-user storage is readable by your app, which means anything you put there is only as safe as your app.

What not to assume#

  • Storage is not a database. There are no queries, no indexes, and no transactions across keys. Structure your keys so you can find things by name.
  • Data outlives access. Revoking your app stops your token, but does not delete what you stored. Give users a way to clear their data from inside your app.
  • The user may decline. Scopes are optional at the consent screen. Design for the case where you got models.run and nothing else.