Deploy SAG

Open-source RAG knowledge base with SAG retrieval and a chat web UI

Deploy SAG

Just deployed

Just deployed

Deploy and Host SAG on Railway

SAG by Zleap AI is an open-source knowledge base built around its own retrieval architecture (SAG). Upload documents, let it extract chunks, entities and events, and chat with your knowledge through a web UI or the API, for humans and agents alike.

About Hosting SAG

This template runs the official SAG stack built from the GitHub repository:

  • api: FastAPI backend (port 8000) with SQLite metadata and an embedded LanceDB vector store
  • web: Next.js web UI (port 3000) that talks to the api over its public domain
  • Volume on the api at /data holding the database, vectors and uploaded files
  • Generated secrets: the JWT signing key and the Fernet key that encrypts API keys saved in the UI
  • Auth: password mode with registration closed; only the first account can be created and it becomes the admin

After deploy:

  1. Open the web service URL right away and create your account. The first account becomes the admin and registration closes after it, so do this before sharing the URL.
  2. Add your LLM and embedding API keys, either in the app's Settings page or as SAG_LLM_API_KEY and SAG_EMBEDDING_API_KEY on the api service. Defaults point to OpenAI (gpt-4.1-mini and text-embedding-3-small); any OpenAI-compatible endpoint works by changing the base URLs and model names.
  3. Create a knowledge base, upload documents, and start chatting.

Common Use Cases

  • Private team knowledge base over internal documents
  • Retrieval backend for AI agents over the API or MCP
  • Evaluating the SAG retrieval method against classic vector RAG
  • Document Q&A with your own OpenAI-compatible model provider

Dependencies for SAG Hosting

  • Source: https://github.com/Zleap-AI/SAG (MIT license), built from apps/api and apps/web Dockerfiles
  • An OpenAI-compatible LLM API key and embedding API key (optional at deploy time, required for indexing and chat)

Deployment Dependencies

Implementation Details

  • NEXT_PUBLIC_API_BASE is baked into the web bundle at build time and references the api service's public domain. If you change the api domain, redeploy the web service.
  • The embedding vector size (SAG_EMBEDDING_SCHEMA_DIMENSIONS, 1536 for text-embedding-3-small) is fixed once documents are indexed; pick your embedding model before uploading.
  • Document parsing uses local MarkItDown, so no external parsing service is needed.
  • Plan for about 1 GB of RAM across both services.

Why Deploy SAG on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying SAG on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
117
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

bento
1