---
title: "Deploy Typesense DocSearch"
description: "DocSearch-style docs UI on Typesense"
category: "Analytics"
url: https://railway.com/deploy/typesense-docsearch
---

# Deploy Typesense DocSearch

DocSearch-style docs UI on Typesense

**[Deploy Typesense DocSearch on Railway](https://railway.com/template/typesense-docsearch)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/typesense-docsearch/manifest.json

- **Creator:** onepush
- **Category:** Analytics

## Template content

### typesense-railway

- **Source:** Shinyduo/typesense-railway
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted Typesense DocSearch (Open-Source Instant Search) on Railway

Typesense DocSearch clones the Algolia DocSearch modal UX on a GPL-3.0 Typesense node you control: `typesense/typesense:30.2` on port 8108, `/data` volume, `TYPESENSE_API_KEY`, and `--enable-cors`.

## About Hosting Typesense DocSearch open-source software on Railway (self hosted Typesense template)

The `/` key opening a modal with ranked results is Algolia DocSearch's pattern. Typesense DocSearch clones the UX but the index lives on a node you control. On Railway, that's a container with a persistent volume at `/data` and an API key in env vars. The browser UI calls port 8108 with CORS enabled.

It's two parts: a Typesense instance holding your docs corpus and a static frontend rendering the modal. Railway removes the host setup: you attach a volume, set `TYPESENSE_API_KEY`, expose 8108, and the modal doesn't care where the index lives, as long as latency is low and CORS headers are correct. The volume survives redeploys; snapshots write to `/data` so restart recovery is automatic.

## Why Deploy Typesense DocSearch, the Algolia alternative on Railway (Railway Free Trial)

Algolia's DocSearch works for qualifying open-source projects, but Algolia is SaaS-only. No supported self-host path. Typesense is GPL-3.0 and runs anywhere. Cost shape differs too: Algolia Grow bills per search request and records stored, so a HN spike can surprise you. Typesense Cloud bills dedicated RAM/vCPU hours plus bandwidth, no per-search fee. Self-hosted on Railway means compute plus volume, typically single-digit to low-teens USD a month, and 50,000 weekend searches don't move the bill.

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 Typesense DocSearch 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.

### Railway vs Other Hosting Providers and VPS for Typesense DocSearch self hosting

| Provider | Typesense DocSearch experience | Volume/persistence | Operational overhead |
|----------|-------------------------------|--------------------|-----------------------|
| DigitalOcean | Droplet with manual Docker install; you manage firewall, updates, disk resize | Block storage, you script the mount | Medium-high |
| AWS | EC2 or ECS; IAM, security groups, EBS lifecycle on you | EBS with manual snapshots | High |
| Hetzner | Cheap compute but bare metal/cloud means you're the sysadmin | Local NVMe or volume attachment | Medium |

Railway pre-wires volume, health check, and env vars into deploy flow. You skip Docker Compose and disk-survival worries. Tradeoff: less kernel/filesystem control — if you need `mlock` tuning for large in-memory indexes, a bare Hetzner box wins.

## Common Use Cases for hosted Typesense DocSearch

**Versioned product docs.** Hierarchical facets let readers filter by version, language, or area. Typesense handles facets natively in the schema.

**Internal knowledge bases.** Teams keep proprietary docs out of Algolia's cloud but still get the `/` shortcut on a private wiki or Gatsby site.

**Multi-product portals.** One collection with a `product` facet spans several docs domains; the modal shows filters and links back to correct URLs.

**Developer tools with offline docs.** A local or small Railway Typesense node lets docs search work without phoning a third party. A Raspberry Pi in the office can serve the same modal.

## Dependencies for Typesense DocSearch Docker hosted on Railway

Two things: the official `typesense/typesense:30.2` image pinned (never `latest`) and a persistent volume at `/data`. Start with `--data-dir /data --api-key=$TYPESENSE_API_KEY --enable-cors`. CORS matters when the DocSearch modal is on a different origin than 8108.

### Deployment Dependencies for Managed Typesense DocSearch Service (Docs Search)

Two things: the official `typesense/typesense:30.2` image pinned (never `latest`) and a persistent volume at `/data`. Start the container with `--data-dir /data --api-key=$TYPESENSE_API_KEY --enable-cors`. The CORS flag is non-negotiable when the modal runs on a different origin than the search endpoint. `TYPESENSE_API_KEY` is required; losing it means reindexing because it encrypts `/data`. Store it as a Railway env var, not in a repo.

### Implementation Details for Typesense DocSearch (Using Typesense official docker image)

The collection schema mirrors Algolia DocSearch: fields like `title`, `text`, `url`, `hierarchy_lvl0` through `hierarchy_lvl3`, `anchor`, `version`, `type`. Mark `hierarchy_lvl0` and `hierarchy_lvl1` as facet fields. The frontend uses Typesense's InstantSearch adapter, so widgets work with minimal changes. The API key is not a dashboard login; there is no admin UI — only the HTTP API.

Typesense is in-memory. The disk volume is for snapshots and restart recovery. Size RAM to dataset plus headroom — a 5 GB corpus needs more than a 2 GB node. Health check on port 8108 `/health` lets Railway restart a crashed node before the modal goes empty.

## How does Typesense DocSearch compare against other Docs Search platforms

DocSearch UX is familiar; the bill and ops model change when Typesense holds the index instead of Algolia.

### Typesense DocSearch vs Algolia (Algolia Alternative)

Algolia wins on managed polish: turnkey crawler, excellent relevance dashboard, CDN reach. Typesense wins on sovereignty and cost. You can't run Algolia on your own hardware and per-request billing scales with traffic. A self-hosted Typesense node on Railway doesn't care how many queries you serve. The tradeoff: you own the crawler, indexing pipeline, and relevance tuning.

### Typesense DocSearch vs Elasticsearch (Elasticsearch Alternative)

Elasticsearch can power docs search, and if you already run ELK, reuse is tempting. But it's a JVM app wanting gigabytes of heap, GC tuning, and often three nodes. A Typesense docs node runs in 1 GB RAM. Query DSL steeper; Typesense API closer to Algolia's model. For docs search, Elasticsearch is a sledgehammer where a finishing nail works.

### Typesense DocSearch vs Meilisearch (Meilisearch Alternative)

Meilisearch is the closest open-source competitor and easier for a first-timer. Differences at scale: Typesense's hierarchical facets map directly to DocSearch UX and typo tolerance handles long technical terms with fewer false positives. Meilisearch's default ranking can stumble on multi-word code snippets. Both are GPL-friendly, but Typesense needs less frontend glue for DocSearch.

### Typesense DocSearch vs Typesense Cloud (Typesense Cloud Alternative)

## How to use Typesense DocSearch (the OSS Docs Search)?
Press `/` on any docs page with the widget. A modal opens. Type a query. Navigate with arrow keys. Press Enter to open the highlighted page. The index is populated by the scraper.

## How to self host Typesense DocSearch on other VPS Services (Typesense DocSearch self hosting guide)
Run the app on any VPS with Node.js and a Typesense server on port 8108. Steps below.

### Clone the Repository
`git clone https://github.com/typesense/typesense-docsearch && cd typesense-docsearch`

### Install Dependencies
`npm install`

### Configure Environment Variables
Copy `.env.example` to `.env`. Set `TYPESENSE_API_KEY`, `TYPESENSE_HOST` (default `localhost`), `TYPESENSE_PORT` (8108), `DOCS_URL`. Set `TYPESENSE_ENABLE_CORS=true` for browser access.

### Start the Typesense DocSearch Application
`npm run build && npm start`. The UI serves on port 3000. Embed the widget in your docs site.

## Official Pricing of Typesense DocSearch (Typesense DocSearch pricing)
The DocSearch UI is free, GPL-3.0. You pay only for the Typesense server. Typesense Cloud: ~$21.60/mo for 0.5GB burst. Self-host on Railway: single-digit to low-teens USD.

## Typesense DocSearch cloud vs self hosted comparison (Pricing, features, costs, and more)
Cloud: managed, backups, no ops. Self-host: full control, lower cost at small scale, you maintain the server. Features identical. Cloud has CORS enabled by default. Self-host needs `--enable-cors` or env var.

### Monthly cost of self hosting Typesense DocSearch on Railway
Minimal container (256MB RAM, shared CPU): single-digit USD. With $5 GitHub trial credit: free for a month. Realistic: $5–$15/mo.

### System Requirements for Hosting Typesense DocSearch on a VPS
1 vCPU, 1GB RAM, 10GB disk. Typesense memory depends on index size: 0.5GB burst handles ~100k docs. DocSearch app adds ~100MB RAM.

## Frequently Asked Questions (FAQs)
### How do I open the search modal?
Press `/` on any page with the widget loaded.

### How does the scraper work?
Crawls your docs site, extracts content, indexes into Typesense. Run manually or on schedule. Configuration defines selectors.

### What if I lose my TYPESENSE_API_KEY?
Generate a new key in Typesense. Update the app environment and restart. No data loss.

### Why do I need CORS enabled?
The browser widget calls Typesense from your docs domain. CORS must allow that origin. Use `--enable-cors` or `TYPESENSE_ENABLE_CORS=true`.

### Can I index multiple versions of docs?
Yes. Create separate collections per version. Configure the widget to switch collection based on a version selector.

Pin `typesense/typesense:30.2` so scraper and modal stay on the same API surface.

Keep `/data` on a Railway volume and store `TYPESENSE_API_KEY` only in project variables.


### Do I need a separate database beside Typesense for DocSearch?

No. Typesense holds the scraped docs documents, facets, and typo-tolerant ranking. Your static site or docs generator stays separate; only the search modal talks to port 8108.

Pin `typesense/typesense:30.2` on redeploy so the DocSearch scraper and modal stay on the same API surface.


## Similar templates

- [Typesense PHP](https://railway.com/deploy/typesense-php) — official PHP client against Railway
- [Typesense vs Meilisearch](https://railway.com/deploy/typesense-vs-meilisearch) — self-hosted Typesense vs Meilisearch
- [Matomo Analytics + MariaDB](https://railway.com/deploy/matomo-analytics-mariadb) — Privacy-friendly analytics with MariaDB and persistent volumes.

Open this page in a browser: https://railway.com/deploy/typesense-docsearch
