---
title: "Deploy Follow The Thread"
description: "AI Powered Multi Threaded Research Agent"
category: "AI/ML"
url: https://railway.com/deploy/follow-the-thread
---

# Deploy Follow The Thread

AI Powered Multi Threaded Research Agent

**[Deploy Follow The Thread on Railway](https://railway.com/template/follow-the-thread)**

- **Creator:** Agentfield
- **Category:** AI/ML
- **Total deploys:** 3

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** pgvector/pgvector:pg17

### follow-the-thread

- **Source:** https://github.com/Agent-Field/follow-the-thread
- **Public domain:** Yes

### FTT-DB https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### control-plane

- **Image:** agentfield/control-plane:latest
- **Public domain:** Yes

### deepresearch-agent

- **Source:** https://github.com/Agent-Field/follow-the-thread
- **Health check:** /health

## Documentation

# Deploy and Host follow-the-thread on Railway

Follow The Thread is an open-source AI deep-research platform. You give it a
research question or a reusable "brief"; AI agents run multi-step web research
— parallel search, full-page source reading, synthesis — and produce
structured, cited research documents you can explore, share publicly, and
refresh on a schedule. Bring an OpenRouter API key for LLMs and a Jina AI key
for web search — both have free/low-cost tiers.

## About Hosting follow-the-thread

The template deploys the full five-service stack, wired together over
Railway's private network: a Next.js application (UI, API, and Postgres-backed
research state), the AgentField control plane that orchestrates agent
execution and stores RAG vectors, a Go deep-research agent that performs the
actual searching and synthesis, and two PostgreSQL databases — a standard one
for the app and a pgvector-enabled one required by the control plane's vector
store. Database schemas migrate automatically on first boot, all internal
secrets are auto-generated, and authentication defaults to Better Auth
(self-hosted email/password on your own Postgres — no third-party auth
account needed). You supply exactly two values at deploy time: an OpenRouter
API key and a Jina AI API key.

## Common Use Cases

- Self-hosted research assistant that turns a question into a cited,
  structured research document — company and market research, due diligence,
  technical literature scans — with your data on your own infrastructure
- Recurring research briefs from the built-in marketplace (e.g. signals
  radar, bear/bull analysis, thesis stress-testing) that refresh on a
  schedule and notify you of changes
- Research over your own knowledge: upload documents or connect data sources
  (Snowflake, Databricks) and let the agent combine them with live web
  research via RAG

## Dependencies for follow-the-thread Hosting

- An [OpenRouter](https://openrouter.ai/keys) API key — LLM inference and
  embeddings (required)
- A [Jina AI](https://jina.ai/) API key — web search and full-page content
  reading during research (required; free tier available)
- Optional: an additional search provider key (Exa, Tavily, Firecrawl, or
  Serper) to extend the search chain

### Implementation Details

The five services and how they connect:

| Service | Source | Role |
|---|---|---|
| `follow-the-thread` | This repo, `Dockerfile.prod` | Next.js app; public domain; runs migrations on boot |
| `deep-research-agent` | This repo, `/agents/general-deep-research-go` | Go research agent; private-network only |
| `control-plane` | `agentfield/control-plane` image | Agent orchestration + vector store |
| `FTT-DB` | Railway PostgreSQL | Application database |
| `Postgres` | `pgvector/pgvector:pg17` | Control-plane storage (pgvector required) |

Worth knowing after you deploy:

- `NEXT_PUBLIC_*` variables are baked in at build time. If you attach a
  custom domain later, update `NEXT_PUBLIC_APP_URL` and **redeploy** (rebuild)
  the app service.
- The agent registers with the control plane once at boot. If you redeploy
  the control plane, redeploy the agent afterwards so it re-registers.
- To use Clerk instead of the default Better Auth, set
  `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` on the app
  service and remove the `AUTH_PROVIDER` / `NEXT_PUBLIC_AUTH_PROVIDER` /
  `BETTER_AUTH_SECRET` variables, then redeploy. Google/GitHub social sign-in
  for Better Auth lights up when you add each provider's OAuth client id and
  secret.
- Search quality scales with keys: Jina (required) covers search plus
  full-page reading; adding Exa, Tavily, Firecrawl, or Serper extends the
  provider chain, and a per-provider circuit breaker skips any that fail.
- A fresh deploy typically converges within a few minutes: databases first,
  then the control plane migrates its schema, the agent waits for it before
  registering, and the app applies its migrations after its server starts.

Full per-service configuration reference: `RAILWAY.md` in the repository.

## Why Deploy follow-the-thread 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 follow-the-thread 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.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/follow-the-thread
