Docs/Deployments/Configuration

Configuration (nexlayer.yaml)

The nexlayer.yaml file describes your entire deployment in a clean, readable format. Your AI assistant will generate this for you — but understanding it helps you customize and debug your deployments.

Designed to be Simple

Nexlayer's YAML format is intentionally minimal. No boilerplate, no repetition, no 500-line config files. Just describe your app and its services — Nexlayer handles the rest. This simplicity is core to how Nexlayer works with AI assistants.

Anatomy of a nexlayer.yaml

Every YAML has three main parts — think of them as building blocks:

Application Name

Your app's unique identifier. Add a url field for production deployments.

Pods (Services)

Your app's containers — frontend, API, database, etc. Each pod runs independently and can communicate with others.

Configuration

Ports, environment variables, persistent storage, and URL paths for each service.

Basic Structure
application:
  name: my-app           # Your app's unique name
  url: www.mysite.com    # Optional: for production deployment

pods:
  - name: web            # Service name
    image: nginx:latest  # Docker image to run
    path: /              # URL path (/ = homepage)
    servicePorts: [80]   # Port(s) your app listens on

Key Concepts

Pods

Think of pods as individual services. A typical app might have a frontend pod, an API pod, and a database pod. Pods communicate using internal DNS:podname.pod

Images

Docker images from Docker Hub (public) or GitHub Container Registry (private with auth). Your AI assistant can help you build and push images.

Paths

URL routes for each service. path: / handles the homepage, path: /api handles API endpoints.

Volumes

Persistent storage that survives restarts. Essential for databases and file uploads. Specify size and mount path.

Example Configurations

Simple Website

A static website or simple web app — the simplest possible deployment.

application:
  name: my-website
  url: www.mysite.com  # Remove for preview deployment

pods:
  - name: web
    image: nginx:latest
    path: /
    servicePorts: [80]

PERN Stack

PostgreSQL + Express + React + Node.js — a full-stack app with database, API, and frontend.

application:
  name: pern-app

pods:
  # Database
  - name: postgres
    image: postgres:15
    servicePorts: [5432]
    vars:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: secretpassword
      POSTGRES_DB: myapp
    volumes:
      - name: pg-data
        size: 2Gi
        mountPath: /var/lib/postgresql/data

  # API
  - name: express
    image: myuser/express-api:latest
    path: /api
    servicePorts: [3000]
    vars:
      DATABASE_URL: postgresql://postgres:secretpassword@postgres.pod:5432/myapp

  # Frontend
  - name: react
    image: myuser/react-app:latest
    path: /
    servicePorts: [80]
    vars:
      API_URL: http://express.pod:3000

Notice how services reference each other using postgres.pod and express.pod.

Next.js Full-Stack

Next.js with PostgreSQL and Drizzle ORM — modern full-stack with persistent data.

application:
  name: nextjs-app

pods:
  # Next.js Frontend + API
  - name: nextjs
    image: myuser/nextjs-app:latest
    path: /
    servicePorts: [3000]
    vars:
      DATABASE_URL: postgresql://postgres:password@postgres.pod:5432/mydb

  # PostgreSQL Database
  - name: postgres
    image: postgres:15
    servicePorts: [5432]
    vars:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
      POSTGRES_DB: mydb
    volumes:
      - name: postgres-data
        size: 1Gi
        mountPath: /var/lib/postgresql/data

Service Discovery

Pods can communicate with each other using internal DNS. The format is simple:

# Format: <pod-name>.pod:<port>

# Examples:
DATABASE_URL: postgresql://user:pass@postgres.pod:5432/db
API_URL: http://express.pod:3000
REDIS_URL: redis://redis.pod:6379

Let Your AI Assistant Handle It

You don't need to memorize this. Just tell your AI assistant what you want to deploy:

"Deploy this Next.js app with a PostgreSQL database. I need the data to persist."

Your assistant will generate the YAML, help you build the Docker images, and deploy everything to Nexlayer.

Next Steps