Serverless applications and servers #

View this page as Markdown

On this page

An application's kind is either serverless or server, chosen when you create it. Serverless applications serve static files; servers run your code.

Choose the kind #

For a site of static files alone, your AI tool chooses serverless and tells you why in one line. A serverless application is charged only for what it serves. A server costs for the time it is awake, so your AI tool asks you before choosing one. The pricing page gives the rates.

Creation must name either a size, which makes a server, or the serverless kind with no size. The platform assigns no default: a request naming neither is refused with both choices.

Choose a server when your application needs to run code on the platform, use a database, run schedules, make outbound calls or accept WebSocket connections. A WebSocket upgrade on a serverless application's hostname is refused.

A functions/ folder in a serverless application's deploy is refused 403 serverless_static_only. A server has its own container.

A serverless application cannot move to a server. set_app_size refuses a request for a size or sleep setting with 403 serverless_static_only. Create a new server application for work that needs one.

What a static site serves #

A static site is a serverless application with no function. The platform serves the files of the version its environment serves, with no container of the application's own.

The site's files sit under client/, beside the manifest in the deploy folder. It needs no start script or health path. A root package.json or lib/ folder is stored and unused: nothing is installed, built or run.

A path names a file or a folder’s index.html; a folder named without its closing slash redirects to the path with it. A GET or HEAD for a missing path receives your client/404.html with status 404, if that file stands. Otherwise, a page path with no dot in its last part receives the root index.html, where one stands. Other missing paths receive 404 not_found as JSON.

Include client/404.html for your own not-found page. Leave it out when a single-page application needs the root page to handle its own paths after a reload. Publish a static site gives the folder layout, full path rules, bounds and deploy steps.

Who can read a static site #

A static site may be public or admit only people you invite. For an invited audience, the manifest declares the accounts service and the platform checks the visitor's session before reading any file.

A signed-in visitor you invited receives the site's files by the same path rules. Where a session is required, a page request (GET or HEAD accepting HTML) without one receives a 302 redirect to the platform's sign-in page; other requests without one are refused 401 authentication_required. A visitor outside the invited audience reads no file. The site runs no code of its own.

Versions and operation #

A deploy publishes the files and finishes, without building an image, starting a process or running a health check. Promote and rollback make production serve a version already published.

Nothing sleeps, idles or needs to wake. Restart serves the same version again. Halt stops serving files until resume, and deleting the application removes every version's files.

A custom domain, where available, serves the production version by the same file rules (Attach your own domain).

Applications and environments explains production, development and version history. Manage versions and environments gives the operations.