---
title: "Self-hosting Serql"
description: "Run the open-source Serql core with Postgres, Clerk, and a Google Cloud OAuth client, locally or with Docker Compose."
canonical: https://www.serql.io/docs/self-hosting
markdown: https://www.serql.io/docs/self-hosting.md
last-updated: 2026-09-14
section: docs
site: "Serql"
llms: https://www.serql.io/llms.txt
---

# Self-hosting Serql

The application in https://github.com/snowopsdev/serql is licensed AGPL-3.0-only. Self-hosted deployments have no seat or property limits.

## Prerequisites

- Node.js 22.22.2, 24.15.0, or 26.0.0 or newer (see `.nvmrc`) — or Docker.
- Postgres (Neon or any Postgres). Redis (Upstash-compatible REST) is optional and only adds caching.
- A free [Clerk](https://clerk.com) application for sign-in (also acts as the OAuth authorization server for agents).
- A Google Cloud OAuth client with the **Search Console API** enabled.

## Quick start

```bash
git clone https://github.com/snowopsdev/serql.git
cd serql
npm install
cp .env.example .env.local
# Fill in DATABASE_URL, NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY, CLERK_SECRET_KEY,
# GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, TOKEN_ENCRYPTION_KEY (openssl rand -hex 32)
docker compose up -d postgres
npm run db:migrate
npm run db:seed      # Google core-update dates
npm run dev
```

Add `http://localhost:3000/api/integrations/google/callback` as an authorized redirect URI in Google Cloud, open http://localhost:3000, sign in, and connect a Google account.

## Docker

```bash
cp .env.docker.example .env.docker
docker compose --env-file .env.docker --profile app up --build
```

`--profile redis` adds a Redis instance behind a REST proxy for caching.

## Configuration highlights

- `NEXT_PUBLIC_APP_URL` — the origin the app is served from (single-domain mode).
- `NEXT_PUBLIC_MARKETING_URL` — optional separate marketing origin (split-domain mode).
- `NEXT_PUBLIC_APP_NAME` / `NEXT_PUBLIC_SUPPORT_EMAIL` — branding used everywhere, including the agent-facing files.
- `STRIPE_SECRET_KEY` unset → the "unlimited" access provider (no billing).

Every agent-facing file (`/llms.txt`, `/openapi.json`, `/.well-known/*`, the MCP servers) is generated from this configuration, so a self-hosted instance is just as discoverable as the hosted one.

## Enabling OAuth for agents

Agents authenticate through Clerk's OAuth server. In the Clerk dashboard enable OAuth applications and, for public MCP clients, Client ID Metadata Documents (or Dynamic Client Registration). See https://www.serql.io/auth.md.
