网页 综合 更新时间 2026-11-10 14:00:00

Netlify Server: long-running backends with WebSockets

自动蜘蛛 www.netlify.com 正文约 5999 字
Netlify Server: long-running backends with WebSockets
Netlify goes full stack: Netlify Server is here. Run long-running backends with WebSockets, now in Early Access.
Your app, live instantly. From AI tools or Git to global deployment in seconds. Everything included.
Don’t see your solution? We can help. Chat with a Netlify expert
Build in Netlify with Claude, Codex, or Gemini.Try Agent Runners
Over a decade ago, Netlify set out to change how developers build for the web. We replaced provisioning servers and shared staging environments with a workflow where every change got its own isolated preview environment, every deploy went live atomically on a global edge network, and a bad deploy could be rolled back instantly.
Teams loved shipping their frontends on Netlify, but most backends still lived somewhere else, and deploying them was a very different experience. It meant wrestling with Dockerfiles and Kubernetes, applying security patches, provisioning servers and scaling them up and down. We kept getting the same question from our customers: how can the simplicity and velocity of Netlify apply to the whole stack?
Then, AI changed the world. We’ve welcomed millions of new builders to our platform, who want to ship ambitious, dynamic software at a pace that was unimaginable just a couple of years ago, such as real-time collaborative canvases, multiplayer apps, live chat, and agent workflows that run for long periods of time. Their complex backends kept running into the limits of what our platform could host.
Telling them to host part of their project somewhere else goes against our mission of empowering builders of any technical background to bring their ideas to life. So we started imagining what it would look like to bring the simplicity of the Netlify workflow and the power of our platform primitives to the rest of the stack.
Today we’re introducing Netlify Server, a long-running server for your application’s backend. It gives your application everything a server can do, from WebSockets to in-memory state, with none of the work of running one. You build, preview and deploy it exactly like the rest of your Netlify project, and we handle the rest.
Netlify Server is available in Early Access today.
We launched Netlify Functions back in 2018 with a simple idea: you drop a JavaScript file in your project and get a backend endpoint that is built, previewed and deployed alongside your frontend, without a server to manage. We’ve kept building on these foundations, with Edge Functions that run snappy operations close to your visitors, Background Functions for asynchronous work that can take several minutes, and Scheduled Functions for recurring jobs. Today, our platform handles hundreds of millions of function requests a day, powering everything from hobby projects to the websites of some of the largest companies in the world.
So why build a server? Because functions are built around the idea that each invocation handles one request. A function is a bit like a vending machine, where each person gets served on their own, one at a time.
That’s often exactly what you want, and it’s a big part of what makes functions so easy to scale and reason about. But it starts getting in the way once your backend grows past a collection of endpoints and starts to look like an application of its own:
Serverless was designed around short, independent invocations, and these needs challenge that paradigm. And yes, we could have stretched functions to cover them, but we would end up with a confusing primitive that sits somewhere between serverless and a server without being good at either.
We’d rather keep functions for what they’re excellent at, and introduce a new primitive that was built from the ground up for these kinds of workloads.
With Netlify Server, we went back to first principles. Backends have had these needs for as long as the web has existed, and for decades they’ve been handled by the same thing: a server. Rather than inventing something new, we took that model and built it with everything Netlify is known and loved for. It has the same workflow, the same zero-config experience and the same platform primitives you already use for the rest of your project.
You write a server, and Netlify provisions it, deploys your code to it, scales it with demand and monitors it. When nothing is using it, it scales down to zero.
Under the hood, an instance of your server is a long-lived Node.js process that handles many requests at the same time. While one request waits on a database or an AI model, the event loop serves the others, so a single instance absorbs a burst of traffic that would have meant dozens of cold starts with functions.
Because the process stays alive between requests, anything you set up once stays set up for as long as the instance runs. Connection pools, caches, warm SDK clients and open WebSocket connections can live in memory and be reused, instead of being recreated on every request.
To go back to the analogy, a server is more like a shop with staff behind the counter. It stays open, serves many people at once, and keeps things ready for the next customer.
A server is a single file at netlify/server/index.ts. You can write it as a request handler, with the same signature as a Netlify function:
Or you can bring a Node.js server built with Express, Hono, or Fastify, as it is, with no wrappers or adapters:
You don’t have to configure ports, add health check endpoints or install adapters. Netlify works out how to run your server and handles the rest.
The same is true of all the platform primitives: Netlify Database, Netlify Blobs, the AI Gateway, the Cache API and others work out of the box.
Because it’s part of your project, it’s built and deployed with everything else. Every branch deploy and every Deploy Preview runs its own version of your backend, with its own branch of your database, so a pull request that changes your API, your schema and your UI at the same time can be reviewed in one place, on one URL.
Rather than hiding server instances
访问原文 返回搜索 https://www.netlify.com/blog/introducing-netlify-server/
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。