# DS2API Deployment Methods: 7 Supported Ways to Run Your API Server

> Discover 7 DS2API deployment methods including standalone binaries Docker containers serverless options like Vercel and Zeabur plus systemd services. Easily run your API server.

- Repository: [CJACK./ds2api](https://github.com/CJackHwang/ds2api)
- Tags: how-to-guide
- Published: 2026-04-26

---

**DS2API supports seven distinct deployment methods ranging from standalone binaries and Docker containers to serverless platforms like Vercel and Zeabur, plus traditional Linux systemd services.**

The open-source project [CJackHwang/ds2api](https://github.com/CJackHwang/ds2api) provides multiple deployment strategies to accommodate different infrastructure requirements. Whether you need a single executable for a VPS, a containerized solution for Kubernetes, or a serverless deployment for zero-ops scaling, the repository includes configuration files and documentation for each approach in [`docs/DEPLOY.en.md`](https://github.com/CJackHwang/ds2api/blob/main/docs/DEPLOY.en.md).

## Download and Run Release Binaries

The simplest deployment method uses pre-compiled binaries available from the GitHub releases page. These multi-platform archives contain the `ds2api` executable and pre-built WebUI assets (`static/admin/`), requiring no external runtime.

According to the source code in [`cmd/ds2api/main.go`](https://github.com/CJackHwang/ds2api/blob/main/cmd/ds2api/main.go), the binary embeds the Go backend and serves static assets directly. Download the appropriate archive for your platform:

```bash

# Download latest Linux/amd64 release (replace v4.0.0 with current tag)

curl -LO https://github.com/CJackHwang/ds2api/releases/download/v4.0.0/ds2api_v4.0.0_linux_amd64.tar.gz
tar -xzf ds2api_v4.0.0_linux_amd64.tar.gz
cd ds2api_v4.0.0_linux_amd64

# Configure and run

cp config.example.json config.json

# Edit config.json with your settings

./ds2api

```

This method works on bare-metal servers, VMs, or any environment where you want minimal dependencies.

## Docker and GHCR Container Deployment

For container-first infrastructure, DS2API publishes images to GitHub Container Registry (`ghcr.io/cjackhwang/ds2api`). The multi-stage `Dockerfile` first compiles the WebUI using Node.js 24, then builds the Go binary with Go 1.26, and copies artifacts into a minimal `debian:bookworm-slim` runtime.

The repository includes a [`docker-compose.yml`](https://github.com/CJackHwang/ds2api/blob/main/docker-compose.yml) that maps host port 6011 to container port 5001 and mounts configuration files:

```bash

# Pull the latest image

docker pull ghcr.io/cjackhwang/ds2api:latest

# Prepare configuration

cp .env.example .env
cp config.example.json config.json

# Edit .env to set DS2API_ADMIN_KEY and optional DS2API_HOST_PORT

# Start services

docker-compose up -d
docker-compose logs -f

```

This approach suits Kubernetes deployments, CI/CD pipelines, and Docker Compose environments.

## Vercel Serverless Deployment

Vercel deployment uses a hybrid architecture where the Go runtime ([`api/index.go`](https://github.com/CJackHwang/ds2api/blob/main/api/index.go)) handles admin functions while a Node.js serverless function ([`api/chat-stream.js`](https://github.com/CJackHwang/ds2api/blob/main/api/chat-stream.js)) manages real-time SSE streaming. The [`vercel.json`](https://github.com/CJackHwang/ds2api/blob/main/vercel.json) file configures build commands, routing rules, and output directories.

Key configuration requirements:

- Set `DS2API_ADMIN_KEY` as an environment variable
- Optionally provide `DS2API_CONFIG_JSON` as raw JSON or Base64-encoded string

Deploy by forking the repository and importing it to Vercel:

```bash

# 1. Fork CJackHwang/ds2api on GitHub

# 2. Import project in Vercel dashboard

# 3. Set environment variables:

#    DS2API_ADMIN_KEY=your-secret-key

#    DS2API_CONFIG_JSON=$(base64 < config.json | tr -d '\n')

# 4. Deploy (Vercel runs npm ci and build automatically)

```

The build process executes `npm ci --prefix webui && npm run build --prefix webui` to generate static assets served from the `static` directory.

## Local Development from Source

Running from source supports development, debugging, and custom builds. The entry point at [`cmd/ds2api/main.go`](https://github.com/CJackHwang/ds2api/blob/main/cmd/ds2api/main.go) loads configuration from files or the `DS2API_CONFIG_JSON` environment variable, starts the HTTP server, and auto-builds the WebUI if `static/admin/` is missing.

Clone and run directly:

```bash
git clone https://github.com/CJackHwang/ds2api.git
cd ds2api
cp config.example.json config.json

# Edit configuration

# Run with auto-build

go run ./cmd/ds2api

```

Or build a binary first:

```bash
go build -o ds2api ./cmd/ds2api
./ds2api

```

## Nginx Reverse Proxy Configuration

When running DS2API behind Nginx, disable buffering to support SSE streaming endpoints. The [`docs/DEPLOY.en.md`](https://github.com/CJackHwang/ds2api/blob/main/docs/DEPLOY.en.md) file provides a production-ready configuration snippet:

```nginx
location / {
    proxy_pass http://127.0.0.1:5001;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_buffering off;
    proxy_cache off;
    chunked_transfer_encoding on;
    tcp_nodelay on;
}

```

Add SSL termination and rate-limiting as needed for SaaS-style deployments.

## Linux systemd Service Setup

For production servers requiring automatic restarts and proper process management, DS2API includes a systemd unit template. This method ensures the service starts on boot and recovers from crashes.

Installation steps:

```bash

# Copy binary and assets

sudo mkdir -p /opt/ds2api
sudo cp ds2api config.json /opt/ds2api/
sudo cp -r static/admin /opt/ds2api/static/

# Install systemd unit (from docs/DEPLOY.en.md template)

sudo cp ds2api.service /etc/systemd/system/ds2api.service

# Enable and start service

sudo systemctl daemon-reload
sudo systemctl enable ds2api
sudo systemctl start ds2api
sudo systemctl status ds2api

```

## Zeabur One-Click Deployment

Zeabur provides a one-click deployment template via [`zeabur.yaml`](https://github.com/CJackHwang/ds2api/blob/main/zeabur.yaml). This configuration pulls the repository, builds the Docker image, exposes port 5001, and mounts a persistent volume at `/data` for [`config.json`](https://github.com/CJackHwang/ds2api/blob/main/config.json).

To deploy, click the **Deploy on Zeabur** button in the [`zeabur.yaml`](https://github.com/CJackHwang/ds2api/blob/main/zeabur.yaml) file and follow the wizard. The application becomes available at `<your-app>.zeabur.app/admin`.

## Summary

- **Pre-compiled binaries** offer the fastest deployment for standalone servers without build dependencies.
- **Docker/GHCR images** provide containerized consistency for orchestrated environments.
- **Vercel serverless** enables zero-ops scaling with hybrid Go/Node.js runtime.
- **Local source builds** support development workflows and custom modifications.
- **Nginx reverse proxy** adds TLS termination and streaming support for production web-facing deployments.
- **systemd services** ensure reliable long-running operation on Linux distributions.
- **Zeabur** delivers platform-specific one-click deployment for PaaS users.

## Frequently Asked Questions

### What is the easiest way to deploy DS2API for a quick test?

Downloading the pre-compiled binary is the fastest method. Download the release archive for your platform, extract it, copy [`config.example.json`](https://github.com/CJackHwang/ds2api/blob/main/config.example.json) to [`config.json`](https://github.com/CJackHwang/ds2api/blob/main/config.json), and run the executable. No Docker, Node.js, or Go toolchain required.

### Can I deploy DS2API without using Docker?

Yes. You can deploy using pre-compiled binaries, run from source with `go run`, or use platform-specific options like Vercel or Zeabur. The binary deployment requires only the executable and the `static/admin` directory containing WebUI assets.

### How do I configure DS2API when deploying to Vercel?

Set the `DS2API_ADMIN_KEY` environment variable in the Vercel dashboard. Optionally provide `DS2API_CONFIG_JSON` containing your configuration as a Base64-encoded string. The build process automatically compiles the WebUI using npm commands defined in [`vercel.json`](https://github.com/CJackHwang/ds2api/blob/main/vercel.json).

### Which files are required for a manual binary deployment?

You need the `ds2api` executable, a [`config.json`](https://github.com/CJackHwang/ds2api/blob/main/config.json) file (copied from [`config.example.json`](https://github.com/CJackHwang/ds2api/blob/main/config.example.json)), and the `static/admin` directory containing pre-built WebUI assets. These are included in the release archives from the GitHub releases page.