You can build a Next.js app without a database when its data is generated at deployment, served as public files, or kept separately in each visitor’s browser. Those approaches are not interchangeable: if users or server instances need to share runtime changes, or data must survive replacement of an ephemeral instance, you need storage with explicit persistence and coordination guarantees.
Choose based on when data changes and who needs to read it
Before choosing a storage pattern, answer four questions: does the data change only during deployment or while the app is running; is it public or private; does one visitor use it or do many visitors share it; and what persistence does the deployment host guarantee?
- Deployment-time, shared content: keep it in source files and generate pages or data during the build.
- Public files: publish them as assets that visitors can request by URL.
- One visitor’s state: use browser storage when it is acceptable for the value to stay local to that browser.
- Shared runtime writes or durable server data: these options alone are insufficient; use a deployment-supported durable service or self-hosted storage with clear persistence and coordination guarantees.
Use imported data for content that changes with deployments
For a small, version-controlled dataset that changes alongside the application, keep the source data in the project and use it to generate pages or props during the build. In the Pages Router, getStaticProps runs at build time for prerendering; Next.js also creates a JSON file from the returned props for client-side navigation. This suits read-mostly material such as a catalogue, documentation, or a fixed list of locations.
Because the output is generated ahead of requests, changing the source data generally means regenerating and redeploying the output unless another runtime feature provides updates. Keep private source data out of generated pages, assets, and client-side bundles. An import does not by itself guarantee that data remains private: what matters is whether it is included in output sent to the browser.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11#1 Best Overall
Use a static export when the site needs no Next.js server at runtime
A static export produces HTML and assets that a static web server can serve. It fits a site whose pages and data can be prepared during the build and whose request handling does not require a running Next.js server.
Export mode has no Next.js runtime. Features that depend on that runtime—including API routes and Incremental Static Regeneration (ISR)—are unsupported, and the exported site cannot compute request-dependent behavior when a visitor arrives. Do not put credentials or private datasets in files the export publishes.
Rank #2
Use the public directory only for intentionally public files
Place images, downloads, and other files meant to be publicly reachable in Next.js’s public/ directory or publish them through static hosting. These are assets served by URL, not a private datastore. Anyone who can reach the asset path may request the file.
Next.js documents the default cache header for public/ assets as public, max-age=0. Its reason is that it cannot safely cache these files because they may change. If you manage caching elsewhere, set behavior appropriate to how often each asset is updated.
Use browser storage for state that belongs to one visitor
localStorage and related browser APIs can hold visitor-specific state, such as a preference, when the app does not need that value to be shared with other users. They are browser-side facilities, not storage available to server-rendered code.
In Next.js, window and localStorage are unavailable during server rendering. Access them only in browser-side code, for example after a component mounts, rather than while rendering on the server. The Next.js static-export documentation illustrates this server-versus-browser distinction. The relevant storage limits and durability depend on the browser and are not established by that framework guidance, so avoid assuming a particular capacity or treating browser storage as a shared or server-side record.
Rank #4
- HP ProLiant DL360 G7 8B Server
- 2x X5650 2.66GHz 12-Cores Total
- 32GB RAM / 8x 146GB 10K 2.5in SAS Hard Drives
- P410 w/ 512MB
Treat local disk and the Next.js cache as host-dependent
On a self-hosted deployment, Next.js uses local disk for its default cache. That does not make the cache a general-purpose application datastore: it may be temporary, and separate instances have separate default caches unless they are coordinated. Ephemeral compute may have non-persistent or unavailable disk, so files written by one instance may not be available after replacement or to another instance.
Use local files for temporary work only when the host provides the needed filesystem behavior. For application data that must outlast an ephemeral instance or be visible across instances, choose storage whose persistence and sharing guarantees are explicit. The self-hosting guide describes these cache and deployment considerations.
Recommended Free Tools
Runtime route handlers do not guarantee shared durable storage
When an app needs runtime server logic, Next.js route handlers can run on a supported deployment runtime. But a route handler is not itself a datastore. Some hosts deploy handlers as lambdas that cannot share data between requests and may not support filesystem writes, as the Backend for Frontend guide notes. Check the adapter and host behavior before relying on files or in-memory state between requests.
Keep secrets out of browser-visible output
Next.js loads .env* files into process.env; environment variables are server-only by default. Prefixing a variable with NEXT_PUBLIC_ makes Next.js inline its value into the browser JavaScript bundle at build time. Never use that prefix for a secret. The environment variables guide also advises keeping secrets out of version control; `.env` files are generally added to `.gitignore`.
Quick Recap
Make the decision
- Data changes only with code or content releases: keep it in version-controlled source files, generate pages or props during the build, and deploy the result.
- Visitors need a public file by URL: use
public/or static hosting, and choose cache behavior for the file’s update pattern. - The value is personal to one browser: use browser-side storage and avoid accessing it during server rendering.
- Visitors need shared runtime writes, or data must survive instance replacement: use a durable storage service supported by the deployment, or self-host on storage with explicit persistence and coordination.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




