Store data that must outlive a serverless container in an external backing service. Use object storage for uploads and a shared datastore for server-side sessions or application records. Keep local work disposable.
For example, Vercel's container Functions use backing services for durable state, and Vercel Blob provides object storage.
The first design question is what a user would lose if you replaced an instance now. An uploaded invoice and an intermediate image-processing file may both be files, but they need different storage guarantees.
Copy link to headingWhat does stateless mean for a container?
Stateless application instances can handle requests without depending on data left in a particular instance by an earlier request. The application can still have durable records and logged-in users. Those records live somewhere that survives replacement of the application process.
Docker’s storage documentation explains that deleting a container also deletes changes made in its writable layer. Store data that must survive replacement outside that layer. Treat local files and process memory as temporary working space; a successful local test doesn't establish that another instance can retrieve the same data.
For a hypothetical customer portal, imagine that one instance accepts an invoice upload and another handles the download. The second instance needs enough information to find the document without consulting the first instance's filesystem. An object key stored with the invoice record gives it that information.
Copy link to headingWhich storage fits each kind of data?
Start with how the application reads and updates the data. The following table is a design recommendation, not a list of interchangeable products.
The distinction between a cache and an authoritative record matters.
If losing a cache entry changes a customer's balance, the application has treated the cache as its database. Decide which system owns the record before choosing how to speed up reads.
Temporary data also needs a recovery plan. If a process downloads an invoice, extracts a thumbnail, and stops halfway through, restarting the operation should not require the abandoned temporary file. Keep the source document available until the operation no longer needs it.
Copy link to headingHow should an upload become a durable application record?
Give each upload an identity that the application can store and retrieve. Record who owns it and which operation created it. An original filename can remain useful display metadata, but two customers uploading invoice.pdf should not accidentally address the same object.
For a Vercel application, Vercel Blob is an object storage option for uploaded and generated files. Choose public or private storage according to who should read the contents. A public asset and a customer's financial document require different access decisions, even if both arrive through the same upload form.
The application also needs to handle a partially completed upload flow. Suppose the file upload succeeds but saving the associated invoice record fails. Decide whether to retry the record write or remove the orphaned object later. Conversely, do not mark a document as ready before the file operation has succeeded.
These are application-level consistency decisions. Using object storage doesn't combine a database write and a file upload into one transaction. Make the incomplete state visible enough that your recovery process can identify it.
Copy link to headingHow do server-side sessions work across instances?
With a shared session store, the application can look up the same session record regardless of which instance receives a request. Select a session implementation supported by your authentication framework, and configure expiration deliberately.
A practical check uses two test instances connected to the same test datastore. Sign in through one instance, then send the next authenticated request through the other. Test logout and expiration as well. The application should enforce those outcomes without depending on the process that handled sign-in.
This article discusses server-side session records. Other authentication designs have different storage requirements; choose the session model with your authentication framework's guidance. Moving a session to shared storage does not itself implement authentication or authorization.
Copy link to headingWhat changes when the backend deploys to Vercel?
The container image can carry application code and dependencies, while storage remains a separate resource. Keeping those lifecycles separate lets an application deployment replace its compute without treating user data as part of the image.
For private files, Vercel Private Blob requires authenticated access. Your application still decides which user may read each document. A valid credential for the storage service is different from an end user's permission to read a particular invoice.
Keep preview data separate where writes could affect production. Vercel supports environment-specific configuration, but you must connect each deployment to the intended backing resources. A different preview URL alone does not establish a different database or object store.
Copy link to headingWhat doesn't external storage solve?
Object storage does not give an application a mounted filesystem with the same semantics as a local directory. If your application requires a database file or a particular filesystem operation, evaluate that requirement directly. You may need a storage adapter or a host with a suitable volume contract.
Docker's volumes persist beyond an individual container's lifetime, but a local volume is not a portable declaration of production storage. Verify how the destination attaches and protects data before depending on it.
External storage also leaves application recovery work to you. Try replacing the test instance after an upload, then confirm that a fresh instance can retrieve the file and its ownership record. Run the test again with a failed metadata write.
Copy link to headingFrequently asked questions
Copy link to headingDoes stateless mean my application cannot save user data?
No. It means a particular application instance does not own the only durable copy. Vercel container Functions can use backing services for records and files that need to survive compute replacement.
Copy link to headingCan I keep login sessions only in container memory?
Sessions held only in container memory depend on later requests reaching the same instance and on that instance staying available. For server-side sessions that must work across replaceable instances, use a shared datastore supported by your authentication framework.
Copy link to headingIs object storage a replacement for a mounted volume?
Object storage stores and retrieves objects through its API, which differs from a mounted filesystem's operations. Vercel Blob fits file uploads and downloads; an application that requires filesystem semantics needs a separate compatibility review.
Copy link to headingAre private files protected because their URLs are hard to guess?
No. Restricted files need enforced access control. Vercel Private Blob supports authenticated access, and your application must still determine whether the requesting user may read each object.