Skip to content

Development Setup

Nantian Gateway’s control plane is written in Go, the data plane in Rust, and the admin console in Next.js. This page walks you through setting up a local development environment from scratch, covering build, run, and debug workflows.

ToolVersionPurpose
Go≥ 1.26Control plane compilation
Rust≥ 1.85Data plane compilation
Docker≥ 24.0Local cluster and containerized execution
kubectl≥ 1.28Kubernetes cluster operations
Helm≥ 3.12Chart packaging and deployment
protoc≥ 3.21Protobuf compilation
Node.js≥ 18Admin console and documentation site
ToolPurpose
KindLocal Kubernetes cluster
justCommand runner (useful for CI and task automation)
golangci-lintGo code linting
cargo-watchRust hot-reload development
Terminal window
# Verify Go
go version
# Expected: go version go1.26.x ...
# Verify Rust
rustc --version
# Expected: rustc 1.88.x ...
# Verify Docker
docker version
# Verify kubectl
kubectl version --client
# Verify Helm
helm version
# Verify protoc
protoc --version
# Verify Node.js
node --version
Terminal window
# Fork the main repo, then clone your fork
git clone https://github.com/<your-username>/gateway.git
cd gateway
# Add the main repo as upstream
git remote add upstream https://github.com/nantian-gw/gateway.git

For development, we recommend using Kind to create a local cluster:

Terminal window
# Create a Kind cluster
kind create cluster --name nantian-dev
# Verify cluster status
kubectl cluster-info
kubectl get nodes
Terminal window
# Install Gateway API v1.5.1 CRDs
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.5.1/standard-install.yaml

The control plane is written in Go, with its entry point at gateway/cmd/manager/main.go.

Terminal window
# Enter the control plane directory
cd gateway
# Install dependencies
go mod download
# Build the control plane
go build -o bin/manager ./cmd/manager
# Run the control plane locally (install Nantian Gateway CRDs first)
kubectl apply -f deploy/crds/
./bin/manager \
--metrics-bind-address=:8080 \
--health-probe-bind-address=:8081 \
--xds-bind-address=:9090 \
--leader-elect=false
FlagDefaultDescription
--metrics-bind-address:8080Prometheus metrics port
--health-probe-bind-address:8081Health check and admin API port
--xds-bind-address:9090gRPC xDS server port
--leader-electtrueEnable leader election
--leader-elect-namespaceCurrent namespaceNamespace for leader election
--gateway-class-namenantian-gwGatewayClass name to claim

The data plane is written in Rust, located in the dataplane/ directory.

Terminal window
# Enter the data plane directory
cd dataplane
# Build the data plane (debug mode)
cargo build
# Build the data plane (release mode, optimized)
cargo build --release
# Run the data plane
cargo run -- \
--node-id dataplane-dev-0 \
--controlplane-addr http://localhost:9090 \
--cluster kind \
--admin-bind-address 0.0.0.0:8082 \
--metrics-bind-address 0.0.0.0:9091
FlagDefaultDescription
--node-idAuto-generatedNode identifier
--controlplane-addrhttp://localhost:9090Control plane gRPC address
--clusterkindCluster name
--admin-bind-address0.0.0.0:8082Admin API address
--metrics-bind-address0.0.0.0:9091Prometheus metrics port

After modifying .proto files in the proto/ directory, regenerate the Go and Rust code:

Terminal window
# Generate Go code
cd proto
buf generate
# Generate Rust code (from the dataplane directory)
cd ../dataplane
# Code generation is integrated into the dataplane's build.rs
cargo build

The admin console is a Next.js web application:

Terminal window
cd dashboard
# Install dependencies
npm install
# Run in development mode
npm run dev
# Open http://localhost:3000 in your browser

The documentation site uses Astro + Starlight:

Terminal window
cd website
# Install dependencies
npm install
# Run in development mode
npm run dev
# Open http://localhost:4321 in your browser

The project provides a docker-compose.yml for quickly launching a complete development environment:

Terminal window
docker compose up -d

This starts:

  • A control plane instance
  • A data plane instance
  • The admin console

Use Delve to debug Go code:

Terminal window
# Install Delve
go install github.com/go-delve/delve/cmd/dlv@latest
# Run the control plane in debug mode
dlv debug ./cmd/manager -- \
--leader-elect=false \
--xds-bind-address=:9090

VS Code users can install the Go extension and configure debug targets in .vscode/launch.json.

The Rust data plane supports the RUST_LOG environment variable to control log levels:

Terminal window
# Enable verbose logging
RUST_LOG=debug cargo run -- --node-id dataplane-dev-0
# View logs for a specific module only
RUST_LOG=nantian_dataplane::proxy=trace cargo run -- --node-id dataplane-dev-0

Common log levels: error, warn, info, debug, trace.

During development, you can inspect the xDS communication between the control plane and data plane to verify that configuration is being transmitted correctly:

Terminal window
# View xDS client status from the control plane Admin API
curl http://localhost:8081/api/v1/clients | jq
# View xDS connection status from the data plane Admin API
curl http://localhost:8082/api/v1/xds/status | jq