What your app's backend can rely on at runtime: the database role, transactions, timeouts, size limits, the paths an endpoint answers, code that runs before your endpoints and what a publish does to running work, each marked supported, current behavior or not provided.
This page lists what your app's backend endpoints, background tasks and scheduled jobs can rely on: how they connect to the database, what a transaction means, which timeouts exist, the size limits, and what happens to running and queued work when you publish. Anything not on this page is not part of the contract.
- Supported
- You can build on it. Floot keeps it, and a change is announced in the changelog before it ships.
- Current behavior
- True today, but it may change without notice. Fine for performance, but your code should not depend on it to be correct.
- Not provided
- Floot does not offer it. The details say what to do instead.
Database connection
| Item | Status | Details |
|---|
| Connection string | Supported | Your backend reads it from FLOOT_DATABASE_URL. It is a direct connection to Postgres with no connection pooler in between, and the preview and the published app use the same database. With the app login on, Floot Agents code reads the agent's own login from FLOOT_DATABASE_AGENT_URL, and falls back to FLOOT_DATABASE_URL when it isn't set. |
| Database role | Supported | The app connects as the database's owner role (neondb_owner for databases Floot creates), unless you turned on the app login below. That role owns the tables your app creates, so it can read, write and change all of them. Run select current_user to see it. |
| A separate, restricted login for the app | Supported | Database Settings → App login makes the app connect as floot_app_runtime: rows in every table, no schema changes, and row-level security applies. Floot Agents get a second login, floot_app_agent, that can also create tables of its own. The Data tab and your assistant's SQL tools keep the owner. See Your database. |
| Row-level security | Supported | Policies don't apply to a table's owner, which is the role the app uses by default (whether it also has BYPASSRLS depends on when the database was created: select rolbypassrls from pg_roles where rolname = current_user). With the app login on, they apply to the app. Without it, check who may see a row in your endpoint code. ENABLE and FORCE ROW LEVEL SECURITY both work. FORCE makes policies apply to the table's owner too, but a role with BYPASSRLS skips them anyway, so on most databases it changes nothing for the owner, and the owner can't take BYPASSRLS away from itself: use the app login to have policies apply to the app. On a database whose owner lacks BYPASSRLS, FORCE hides rows from the Data tab and your assistant's SQL too, and export and duplicate fail with "query would be affected by row-level security policy" until you turn it off with NO FORCE ROW LEVEL SECURITY. |
| Session state across requests | Not provided | Connections are opened when a request needs them and closed when it ends. A plain SET, a temporary table, a prepared statement or a session-level advisory lock doesn't carry over to the next request. |
| Reconnecting | Current behavior | When the database is waking up or a connection drops, Floot's database client opens a new connection and tries again, up to 4 attempts with a 30-second connect timeout each. A query outside a transaction that failed because the connection was lost can be sent again. Statements inside a transaction are never sent again (see below). |
Transactions
| Item | Status | Details |
|---|
| No outer transaction | Supported | Floot never wraps a request, task or scheduled job in a transaction. Your own BEGIN is the top-level transaction, and a statement outside one commits on its own as soon as it succeeds. |
| A transaction that resolves | Supported | A transaction runs on one connection from start to finish. await db.transaction().execute(fn) resolves only after Postgres has answered your COMMIT. When your callback returns, nothing is committed yet; the promise is what counts. |
| No replay | Supported | Floot doesn't run your transaction callback again or send COMMIT a second time. The only retry is opening the transaction's connection, before your callback has started. Floot never sends an HTTP request to your backend a second time either. |
A connection lost during COMMIT | Not provided | Your code gets an error and Floot can't tell you whether the commit went through. For writes that must happen exactly once, give each one a unique key, so you can check afterwards and a second attempt is refused. |
| Background task retries | Supported | A task, timer or repeating task queued with retries: n (queueTask, queueRecurringTask; n from 0 to 3, default 0) that throws or reaches its time limit runs again up to n times, about 2, 4 and 8 seconds apart, even if it had already written to the database or called another service, so use it only for work that is safe to run twice. Without it, Floot retries by itself only a run that failed before any of its work reached the database or the network: after a database connection failure (up to 3 times) or at its time limit (once). A task runs at most 4 times in all. An onError task named in the same call runs after the last attempt. A run stopped outright (out of memory, a crash, or still busy at the 15-minute limit), or a start dropped after waiting an hour, is never retried, but its onError is still called: at least once, and rarely twice for the same run. Scheduled jobs set up in Services → Schedules take neither option. |
Database timeouts
Floot sets no statement_timeout or lock_timeout on your database, so a query can wait for a lock or run until the request's own time limit. To bound them, set them yourself as the first statements of the transaction:
BEGIN;
SET LOCAL lock_timeout = '1s';
SET LOCAL statement_timeout = '3s';
-- your queries
COMMIT;
- This is supported: Postgres itself enforces both and cancels the statement on the server, and because the connection is direct, they apply to exactly that transaction and end with it.
- With Kysely, run both through Kysely's
sql tag on trx, as the first thing in your db.transaction().execute(async (trx) => …) callback. - A plain
SET (without LOCAL) lasts only until the connection closes at the end of the request, so it isn't a reliable way to set a limit. ALTER ROLE … SET statement_timeout would apply to everything that uses the role, including the Data tab and your assistant's SQL tools, so Floot doesn't recommend it.
Run time, memory and size limits
| Limit | Status | Value |
|---|
| Background task or scheduled job | Supported | Up to 15 minutes. A task is stopped about 30 seconds before that, so it can hand off what's left to a new task. |
| Request from a browser or another service | Supported | It must start answering within 2 minutes and never go quiet for longer than that. Otherwise the caller gets a 504 error, even though your code may keep running for up to 15 minutes. For longer work, queue a background task and answer at once. |
| Memory | Supported | 1 GB by default (2 GB with server-side rendering). Ask your assistant to set anything from 512 MB to 4 GB. |
| Request body | Supported | About 6 MB. For bigger uploads, send the file to storage and pass its key to your endpoint. |
| Response body | Current behavior | Responses are streamed, so they can be larger than the request limit: up to 200 MB. |
| Your backend's own outgoing requests | Current behavior | Floot puts no size or time limit on calls your backend makes, other than the memory and run time above. A download read as a stream (for example for await over response.body) is never held in memory whole, so you can hash it piece by piece. |
| Cancelling an outgoing request | Not provided | AbortController / AbortSignal work as they do in Node.js. Floot adds no signal confirming that the other server stopped. When a request or task ends, connections still open are closed. |
Endpoint addresses
| Item | Status | Details |
|---|
| The endpoint's path | Supported | An endpoint file answers one path: endpoints/orders/list_GET.ts answers GET requests to /_api/orders/list, with any query string. |
| One trailing slash | Supported | /_api/orders/list/ is answered by the same endpoint, with the same method, headers, body and query string. Your code sees the address without the slash. This is for services that add a slash when they forward a request, such as Shopify's App Proxy. A published app answers this way from its first publish after November 17, 2026, and the preview once its backend is next updated, which opening the project or changing an endpoint does. |
| Paths under an endpoint | Not provided | An endpoint doesn't answer the paths below it: /_api/orders/list/123 needs a file of its own (endpoints/orders/list/123_GET.ts), and so does each sub-path a service forwards to. Put a part that changes in the query string or the body instead. Two slashes at the end (/_api/orders/list//) don't reach the endpoint either. |
| A path no endpoint answers | Current behavior | The caller gets a plain-text 404 Not Found before any of your code runs, and your app's logs get a line [floot] No endpoint matches GET /_api/…. The line also says when the path is under an endpoint, or when the endpoint there answers another method. When a service reports a 404, ask your assistant to look for that line in the logs. |
Code that runs before your endpoints
A file named _middleware.ts in your project's endpoints folder runs before and after every endpoint in that folder and the folders below it. It is the place for a check that every endpoint there needs, such as "signed in as an admin": an endpoint added to the folder later is covered by where its file sits, without anyone remembering to add the check. Ask your assistant, for example: "make every endpoint under admin require an admin".
// endpoints/admin/_middleware.ts
export type Context = { user: User };
export const except = ["admin/login"];
export async function before(request: Request): Promise<Context | Response> {
const user = await getSignedInUser(request);
if (!user?.isAdmin) return new Response("Not found", { status: 404 });
return { user };
}
// endpoints/admin/users_GET.ts
import type { Context } from "./_middleware";
export async function handle(request: Request, { user }: Context) {
// runs only for an admin
}
| Item | Status | Details |
|---|
| Order | Supported | endpoints/_middleware.ts runs first, then the file of each folder on the way down, then the endpoint. after runs in the reverse order. |
| Answering early | Supported | When before returns a response, that is the answer and the endpoint does not run. |
| Data for the endpoint | Supported | What before returns reaches the endpoint as the second argument of handle. |
| Leaving an endpoint out | Supported | except lists endpoints this file does not run for: a route (admin/login), one method of it (admin/login_POST) or a folder (admin/public/*). The files above and below it still run. |
| Changing the answer | Supported | after(request, response) can set the response's status and headers, or return another response. |
| Reading the request body | Not provided | Middleware gets the request without its body, so the endpoint can read it. Trying to read it in before fails with an error that says why. |
| Pages and CORS preflights | Not provided | Middleware runs for endpoints only. Floot's own checks, such as the sign-in of an internal app, run before it and it cannot skip them. |
| Work after the answer is sent | Not provided | after runs before the answer is sent. For work that should continue afterwards, queue a background task. |
When you publish
A publish replaces your app's backend in place. Floot doesn't stop, pause or wait for work that is already running, so for a while the previous release and the new one run side by side against the same database. None of this is a guarantee: the rows below describe what happens today, so your code should stay correct whatever order these things happen in.
| Item | Status | Details |
|---|
| New work after a publish | Current behavior | Once the publish completes, every new request to your endpoints, server-rendered page, scheduled job and background task starts on the new release. The backend switches shortly before the publish completes, while the previous pages are still being served, so for that moment the previous pages call the new backend. A server-rendered page cached before the publish can still be served for a short time after it, until the cache has cleared. |
| Work already running | Current behavior | A request, page render, task or job that started on the previous release finishes on the previous release's code, for up to 15 minutes (the longest one run can last). Floot neither stops it nor waits for it before the new release takes over. |
| Queued and delayed tasks | Current behavior | A queued task carries its name and payload, not its code. It runs the code of the release that is live when it starts, not the release that queued it: a task queued with a delay, or handed off by a task still running on the previous release, runs the new code. If the new release no longer has that task, or renamed it, the task fails when it starts, and so does every retry of it. The same goes for a scheduled job the new release removed that fires while the publish is finishing. |
| Pages already open in a browser | Current behavior | A tab opened before the publish keeps the previous release's pages and sends its requests to the new backend. If it then needs a part of the app it hasn't loaded yet and that file is gone, it reloads once onto the new release. Floot doesn't check that a page and the backend it calls come from the same release. |
| Which release is running | Current behavior | The published backend's code reads its own release id as process.env.FLOOT_RELEASE_ID, and every page and endpoint answer from the published app carries the release that produced it in the x-floot-release header: the same id the Publish screen shows. A page kept in the cache keeps the id of the publish it came from. On an app without server-side rendering, a publish that changed no backend code keeps the previous backend running, and one that changed no page code keeps the previous page files, so each names the last publish that changed it rather than the one that is live. With server-side rendering, both always name the live publish. An answer without the header came from code published before the header was added; the next publish that changes that part adds it. To check which publish answered your browser, see My live site does not show my changes. |
| A drain or fence for a publish | Not provided | There is no way to have old work finish or stop before the new release takes over, to hold new work back until it has, or to pin a task to the release that queued it. Make the overlap safe instead: change tables so both releases work with them (add a column before the code needs it, remove one only after no code uses it), keep a task's name and accept the payload the previous release sent for at least one publish, and give writes that must happen once a unique key. To fence work yourself, pass the queueing code's process.env.FLOOT_RELEASE_ID in the task's payload and have the task compare it with its own. |
Not part of the contract
- A lockfile for a publish. Each publish installs your dependencies again from the versions in
package.json. The release id on the Publish screen names the publish and the source it was built from (see Publishing), not the exact dependency versions it installed. - The typecheck environment. The compiler settings and the platform's type declarations are not published. Your assistant's
typecheck tool returns the errors it finds, nothing more. - A per-project hard spending cap. The daily hosting limit pauses published apps and stored files and is based on an estimate, so a day can end slightly above it.