A Railway-ready deployment package for Zvec - Alibaba's lightweight, lightning-fast in-process vector database.
This package wraps Zvec as a REST API service with a beautiful web UI, making it easy to deploy and use as a standalone vector database service.
zvec-railway/
├── docker-compose.yml # 🎯 Drag this into Railway canvas
├── railway.toml # Config as Code
├── README.md # This file
│
├── api/ # Backend API Service
│ ├── Dockerfile # Multi-stage Docker build
│ ├── app.py # FastAPI REST API
│ └── requirements.txt # Python dependencies
│
└── ui/ # Frontend UI Service
├── Dockerfile # Next.js optimized build
├── src/ # Source code
├── public/ # Static assets
└── package.json # Node dependencies
- Go to Railway and create a new project
- Drag the
docker-compose.ymlfile directly into the Railway canvas - Railway automatically deploys both services:
- zvec-api - Vector database API (port 8000)
- zvec-ui - Web interface (port 3000)
- Get your public URLs from the service settings
- Push this folder to a GitHub repository
- In Railway, click New Project → Deploy from GitHub repo
- Select your repository
- Railway auto-detects Docker Compose and deploys
# Install Railway CLI
npm install -g @railway/cli
# Login and deploy
railway login
railway init
railway upThe web interface includes:
| Tab | Features |
|---|---|
| Insert | Add documents with vectors and metadata, generate random vectors |
| Search | Vector similarity search with top-k results, score display |
| Documents | Quick actions, API endpoint reference |
- Clean gray background (
#f5f5f5) - Black outlined buttons
- Simple, minimal interface
- Responsive layout
API Service (zvec-api):
| Variable | Default | Description |
|---|---|---|
ZVEC_DATA_PATH |
/app/zvec_data |
Path for data storage |
ZVEC_DIMENSION |
128 |
Vector dimension |
PORT |
8000 |
Server port |
UI Service (zvec-ui):
| Variable | Default | Description |
|---|---|---|
NEXT_PUBLIC_API_URL |
http://zvec-api:8000 |
Backend API URL |
PORT |
3000 |
UI server port |
To persist data across deployments:
- Go to zvec-api service → Volumes tab
- Click New Volume
- Mount at
/app/zvec_data
Once deployed, your Zvec API provides:
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | API info |
/health |
GET | Health check |
/docs |
GET | Interactive API docs (Swagger) |
/collection/info |
GET | Collection statistics |
/documents |
POST | Insert single document |
/documents/batch |
POST | Insert multiple documents |
/search |
POST | Vector similarity search |
/documents/{id} |
DELETE | Delete document by ID |
/collection |
DELETE | Clear all documents |
# Insert a document
curl -X POST https://your-api.railway.app/documents \
-H "Content-Type: application/json" \
-d '{
"vector": [0.1, 0.2, 0.3, ...],
"metadata": {"title": "Example"}
}'
# Search for similar vectors
curl -X POST https://your-api.railway.app/search \
-H "Content-Type: application/json" \
-d '{
"vector": [0.1, 0.2, 0.3, ...],
"top_k": 10
}'After deploying, consider these Railway best practices:
Without a volume, data is ephemeral and lost on each deployment:
zvec-api → Volumes → New Volume → Mount at /app/zvec_data
The UI connects to API via Railway's private network:
http://zvec-api:8000 # Private network (secure, fast)
zvec-ui → Settings → Custom Domain → Add your domain
zvec-api → Settings → Custom Domain → Add api.yourdomain.com
For production workloads:
Settings → Scaling → Enable Autoscaling
Railway provides built-in metrics:
Service → Metrics → View CPU/Memory usage
- Attach a persistent volume to
zvec-api - Set appropriate resource limits
- Configure custom domain (optional)
- Enable Railway's built-in logging
- Set up monitoring alerts
- Review environment variables security
- Set
ZVEC_DIMENSIONcorrectly before first use
┌─────────────────┐ ┌─────────────────┐
│ │ │ │
│ zvec-ui │────▶│ zvec-api │
│ (Next.js) │ │ (FastAPI) │
│ Port: 3000 │ │ Port: 8000 │
│ │ │ │
└─────────────────┘ └────────┬────────┘
│
▼
┌─────────────────┐
│ Volume │
│ (persistent) │
│ /zvec_data │
└─────────────────┘
This deployment wrapper is provided as-is. Zvec is licensed under Apache 2.0.