Vercel Logo

How Vercel Runs Your Functions

Your SvelteKit server code runs as serverless functions on Vercel. New projects run on Fluid compute by default, which means Vercel manages the lifecycle of your functions automatically. No cold starts to worry about, no containers to configure. But you do get to control which Node.js version runs, which region your functions deploy to, and whether to try experimental runtimes like Bun.

Outcome

Add a health-check endpoint, configure the Node.js runtime version, and understand region selection for your SvelteKit functions.

Fast Track

  1. Know the default: SvelteKit on Vercel uses Node.js with Fluid compute
  2. Set runtime: 'nodejs24.x' in the adapter config to pin a Node.js version
  3. Use regions to control where your functions run

Fluid Compute

Vercel's Fluid compute is the default for new projects. Instead of the traditional serverless model where each request spins up a new function instance, Fluid keeps your functions warm and reuses them across requests. The practical result: faster response times without any configuration.

Fluid (default)Traditional Serverless
Cold startsMinimal (functions stay warm)Every new instance
ConcurrencyHandles multiple requests per instanceOne request per instance
Max duration60s (Hobby) / up to 800s (Pro, configurable)Same limits, more cold starts
ConfigurationNone neededNone needed

For the ski-alerts app, Fluid handles everything well out of the box. The AI chat endpoint benefits most since streaming responses keep the function alive longer.

Hands-on exercise 1.4

Explore runtime configuration for the ski-alerts app:

Requirements:

  1. Add a health-check endpoint at /api/health
  2. Pin the Node.js version in the adapter config
  3. Verify the runtime settings in the Vercel dashboard after deploying

Implementation hints:

  • Set runtime globally in svelte.config.js via the adapter options
  • Per-route config is available by exporting a config object from +server.ts or +page.server.ts
  • The health-check endpoint is a simple GET that returns JSON. You'll use it again in the observability lesson

Global runtime in adapter config:

svelte.config.js
import adapter from '@sveltejs/adapter-vercel';
 
const config = {
  kit: {
    adapter: adapter({
      runtime: 'nodejs24.x'
    })
  }
};
 
export default config;

Try It

  1. Create the health-check endpoint:

    src/routes/api/health/+server.ts
    import { json } from '@sveltejs/kit';
    import type { RequestHandler } from './$types';
     
    export const GET: RequestHandler = async () => {
      return json({
        status: 'ok',
        timestamp: new Date().toISOString()
      });
    };
  2. Pin the Node.js version:

    Update svelte.config.js to specify the runtime:

    svelte.config.js
    import adapter from '@sveltejs/adapter-vercel';
     
    const config = {
      kit: {
        adapter: adapter({
          runtime: 'nodejs24.x'
        })
      }
    };
     
    export default config;
  3. Deploy and check the dashboard:

    Push your changes and look at the Functions tab in your Vercel dashboard:

    /api/chat      → Node.js (Serverless)
    /api/health    → Node.js (Serverless)
    /api/evaluate  → Node.js (Serverless)
    /              → Node.js (Serverless)
    
  4. Hit the health endpoint:

    $ curl https://ski-alerts-xxxxx.vercel.app/api/health
    {"status":"ok","timestamp":"2026-02-24T12:00:00.000Z"}

Commit

git add -A
git commit -m "feat(runtime): add health endpoint and pin Node.js version"
git push

Done-When

  • /api/health returns a JSON response with status and timestamp
  • svelte.config.js specifies a pinned Node.js runtime version
  • The Vercel Functions tab shows all routes running on Node.js
  • The health endpoint responds on your production URL

Solution

Health check endpoint:

src/routes/api/health/+server.ts
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
 
export const GET: RequestHandler = async () => {
  return json({
    status: 'ok',
    timestamp: new Date().toISOString()
  });
};

Adapter config with pinned runtime:

svelte.config.js
import adapter from '@sveltejs/adapter-vercel';
 
const config = {
  kit: {
    adapter: adapter({
      runtime: 'nodejs24.x'
    })
  }
};
 
export default config;

Every route in the ski-alerts app runs on Node.js. The AI SDK, the Workflow DevKit, and the weather service all need Node.js APIs. Pinning nodejs24.x gives you the latest features like Object.groupBy, native fetch, and improved performance without surprises from version changes between deploys.

Troubleshooting

Build fails after changing the runtime version

Make sure the runtime string matches Vercel's supported versions. As of early 2026, nodejs24.x, nodejs22.x, and nodejs20.x are supported. Check the Vercel docs for the current list.

Functions tab shows a different runtime than expected

Per-route config exports override the global adapter setting. If a specific route exports its own config, that takes precedence. Check the route file for a config export.

Advanced: Region Configuration

By default, your functions deploy to a single region (usually iad1, US East). You can change this:

svelte.config.js
adapter({
  runtime: 'nodejs24.x',
  regions: ['sfo1'] // US West, closer to California ski resorts
})

For the ski-alerts app, choosing a region near your users or the Open-Meteo API servers can shave off latency on weather data fetches.

Advanced: Experimental Bun Runtime

The SvelteKit Vercel adapter also supports Bun as an experimental runtime. Instead of setting a separate flag, you use it as the runtime value:

svelte.config.js
adapter({
  runtime: 'experimental_bun1.x'
})

Bun offers faster startup times and a built-in bundler. It's experimental on Vercel, so don't use it for production workloads yet, but it's worth trying if you're curious about the performance difference. The ski-alerts app sticks with Node.js for stability.