app.nzapp
AppsProjectsReposPullsChatIntegrationsGatewayModelsEvalsToolsDatasetsMCPDeploysPricingBlogDocsAssistantsCharactersArtMusic
Sign inStart building
Agent stack
Cloud coding agentAgents SDKIntegrationsBrowser agentMonitors & auto-agentsSchedulersAgent skillsMCP serversDeep research
Models & API
AI GatewayModel catalogModel evalsModel spacesPlaygroundText to imageImage to 3DText to 3DMusic & SFXAudio editorMedia optimizerAI art & libraryChatAPI referenceSchemaBecome a provider
Compute & hosting
DeploysAddonsPostgres hostinggobed vector searchSite hostingAnalyticsCog GPU hostingRL trainingBuilds & CIWorkersTask queuesDomainsGit hosting
Tools
AI toolsDrawDiffusion canvasLive DrawWriteSheetsArtifactsVideo studioNotebooksDatasets
Learn
DocsBlogEval guidesPrompt libraryCLIAlternativesPapersAI charactersArt gallerySecurityConsulting
Company
PricingEnterpriseSettingsBillingStatusInvestorsCreate accountTerms of ServicePrivacy Policy
app.nzapp.nz

AI agent cloud for coding, deploys, model routing, and research. Built for teams shipping software.

Built in New Zealand by App AI NZ.

Social
X / TwitterGitHubYouTube
The app.nz network
GpuBrainPapersReading TimemojojojoNetwrckText-Generator.ioCodex InfinityOpenPathsCuteDSLAI Art GeneratorAIArt-Generator.artSiteSimSimplexGenDictatorFlowWebFiddleRing.nzChatGibidyBitBankExperimentFlowEvangelerHires.nzHow.nzV5 GamesAddicting Word GamesBig Multiplayer ChessWord SmashingreWord GameMultiplication Master
© 2026 App AI NZ Ltd. All rights reserved.All systems normalTermsPrivacy
Blog
July 7, 2026·6 min read·app.nz

Serving static sites from R2 and a database

The fast path behind app.nz static deploys: upload changed files, prune removed paths, index them in the database, and serve bytes directly from R2 or local storage.

Listen to this article

On-device voice

Uses the voice built into your browser; no article text leaves this page.

Audio narration is not supported by this browser.

The fastest app.nz deploy path is static hosting. There is no builder, no scheduler, and no container boot. The CLI uploads a directory, the control plane records the file index, and the request path serves bytes through the Go server.

That sounds plain, but it is where a lot of "deploy speed" comes from. A deploy that does not need compute should not allocate compute.

The data model

A hosted site is a row plus a set of files. The row owns the slug, title, user, and timestamps. The files table owns path, content type, size, hash, and storage key. When R2 is configured, the bytes live in the appnz-sites bucket. In local development and tests, the database path still works without a cloud object store.

That split gives the deploy path two jobs:

  • write changed bytes to storage,
  • make the database index match the directory the user wanted live.

The file index is the important part. Serving a request should not list a bucket, guess content types, or scan a directory. It should resolve one row and fetch one object.

Diff, upload, prune

Static deploys are stateful. If the local directory no longer contains old.js, old.js should stop being public. That is why the deploy command sends the desired file set and the server prunes files that are no longer present unless the user explicitly asks for a partial deploy.

The happy path is:

walk local directory skip hidden files and ignored substrings upload changed files upsert hosted_site_files rows delete rows for removed paths serve the new index immediately

This is why static deploys can feel instant. The platform is not rebuilding the bundle. The bundle already exists.

Two URL shapes

app.nz serves a site in two ways:

  • path form: /sites/<slug>/
  • origin form: <slug>.app.nz

The origin form is the production shape because it gives the site its own browser origin. The path form is useful for previews and quick sharing, but it lives under the app.nz origin, so it is treated more carefully.

For path-hosted sites the server applies sandbox headers. The goal is to let a generated frontend run without letting it act like the main app.nz application. A static-site host that shares origin with the dashboard has to assume the page content is not fully trusted.

SPA fallback

Most generated frontends are single-page apps. If a request asks for /settings and there is no settings file, the server falls back to index.html when the site has one. Asset requests still behave like asset requests: missing .js, .css, .png, and similar paths return 404 instead of index.html.

That distinction matters for debugging. A missing JavaScript chunk should not render the app shell and hide the real error.

Caching

Static hosting has two caching goals that pull in opposite directions:

  • HTML should update quickly after deploy.
  • fingerprinted assets should be cacheable.

The server can infer content type and set conservative headers by path. The long-term direction is to let the deploy index understand fingerprints and cache policies directly, but the core contract remains the same: request path to indexed file to bytes.

Why this is app infrastructure, not just file upload

Hosted sites are the end of many app.nz workflows. Coding agents produce frontends. Build jobs produce assets. Demos, docs, and generated tools need public URLs. Static hosting is the low-friction landing zone for all of them.

The engineering principle is to keep the path short. Static output should not be forced through the container runtime just because containers exist. If the artifact is a directory, deploy the directory.

Build what you just read

Ship agents, models, and apps on one cloud.

Start with free credits, then use the same platform from the web app, CLI, desktop app, or MCP.

Start building freeRead the docs

Keep reading

Instant static deploys: from directory to URL in one command

app.nz hosts static sites behind a URL instantly — app sites deploy uploads, diffs, and prunes a directory so a deploy is the exact state of your build, scriptable into CI or an agent run.

Deploying Rust in under five seconds

Fast Rust deploys come from separating build time from release time: compile once, push a small runtime image or static bundle, then publish by swapping bytes or image refs.

Durable artifacts for coding agents

Why app.nz stores agent diffs, logs, previews, screenshots, and generated files as artifacts so a run remains auditable after the worker shuts down.