Deployment

Production Deployment

Deploy UDL alongside your application

Overview

While hosting UDL as a separate server is possible (see Standalone Deployment), the most common setup is running it alongside your website. This keeps your deployment simple - one process, one deploy.

With Next.js Adapter

The simplest approach for Next.js apps:

Terminal
npm install @universal-data-layer/adapter-nextjs
package.json
{
  "scripts": {
    "dev": "udl-next dev",
    "build": "udl-next build",
    "start": "udl-next start"
  }
}

Deploy to any platform. It just works.

Without the Adapter

Run UDL and your app together:

package.json
{
  "scripts": {
    "dev": "universal-data-layer & next dev",
    "build": "universal-data-layer --codegen && next build",
    "start": "universal-data-layer & next start"
  }
}

Works with any framework - just run universal-data-layer alongside your server.

Configuration

UDL automatically loads environment variables from .env files. Here's an example configuration using the Contentful source plugin:

udl.config.ts
import { defineConfig } from 'universal-data-layer';

export const config = defineConfig({
  plugins: [
    {
      name: '@universal-data-layer/plugin-source-contentful',
      options: {
        spaceId: process.env.CONTENTFUL_SPACE_ID,
        accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
      },
    },
  ],
});

Endpoints

Once running, UDL exposes these endpoints:

EndpointMethodDescription
/graphqlPOSTGraphQL API
/graphiqlGETInteractive GraphQL IDE
/healthGETHealth check (returns 200 if running)
/readyGETReadiness check (returns 200 when ready)
/_webhooks/:plugin/:pathPOSTWebhook receiver
/_syncGETSync API for partial updates

Health Check Response

{
  "status": "ok",
  "timestamp": "2025-01-15T10:30:00.000Z"
}

Sync API

Get changes since a timestamp:

curl "http://localhost:4000/_sync?since=2025-01-15T10:00:00Z"

Next Steps