Suitcase
Database- and storage-agnostic user-generated content for TypeScript.
Suitcase is a standalone, database- and storage-agnostic solution for user-generated content. It gives an application one definition of what it stores, one upload flow, and one authorization model, while leaving the UI, the database, and the storage provider to you.
The architecture comes from stratforge.gg, where it served thousands of users monthly.
Get started Install the packages and run one upload end to end.
Core concepts Definitions, resources, assets, owners, claims, and reads.
Guides Define kinds, uploads, reads, storage, and persistence.
Examples Two Next.js apps using SQLite, Drizzle, and S3.
// Example only. These declarations live inside withResources().const companyOwner = owner({ schema: z.object({ companyId: z.string() }), authorize: async ({ execution, owner }) => { return isMemberOfCompany(execution.userId, owner.companyId); },});
const companyInvoice = resource("companyInvoice", { bucket: "invoices", owner: companyOwner, read: read({ claim: z.object({ companyId: z.string() }), verify: async ({ claim, execution }) => { if (!(await isMemberOfCompany(execution.userId, claim.companyId))) { throw ServiceError.forbidden("Not your company"); } return claim; }, expose: ({ requested, scope }) => requested.filter(({ owner }) => owner.companyId === scope.companyId), }), upload: companyOwner.upload({ mimeTypes: ["application/pdf"], maxSize: "10 MB", intent: z.object({ companyId: z.string(), folderId: z.string() }), ownedBy: ({ claims }) => ({ companyId: claims.intent.companyId }), }),});// One typed call: limits, hashing, transfer, and finalize are handled for you.await client.upload.start({ kind: "companyInvoice", file, intent: { companyId: "c_1", folderId: "2026/q3" },});// That's it! Literally.Design principles
Section titled “Design principles”- Resources are not assets. A resource is the logical row a user owns. An asset is the physical object. Several resources can share one asset, and the bytes are stored once.
- Bytes skip your API. Uploads go straight to a presigned target. The operation endpoints carry only small JSON documents, never file bodies.
- Authorization is part of the definition. Owners decide mutations and usage. Reads decide what a caller may be handed.
- The edges are replaceable. Repositories, buckets, and job queues are ports. Use Drizzle and S3 today, or write your own adapter without touching the services.
How a request flows
Section titled “How a request flows”- The client reads the kind’s limits with
uploads.constraints. - It claims the file with
uploads.initializeand receives a presigned target. - The bytes go straight to storage. No file passes through your API.
uploads.finalizeverifies the claims, reuses or promotes the asset, and creates the resource.resources.resolveturns ids into signed download URLs.
The client never sends an owner. The server derives it from the execution context, records it on the upload session, and checks the same owner authorizer for uploads, updates, deletes, and usage.
What Suitcase does not do
Section titled “What Suitcase does not do”- It does not render a file picker, a grid, or an upload button.
@softzweig/suitcase-reactprovides hooks, not components. - It has no list operation. Query your own resource tables, then resolve the ids you found.
- It does not authenticate users.
forExecutionreceives the context your app already trusts. - It does not enforce quotas. Usage is reported, and
upload.acceptis where a policy belongs. - It does not retry uploads or store jobs durably by default. The bundled queues are deliberately simple.