---
title: "Deploy Self-Hosted Search"
description: "self-hosted instant search engine"
category: "Analytics"
url: https://railway.com/deploy/self-hosted-search
---

# Deploy Self-Hosted Search

self-hosted instant search engine

**[Deploy Self-Hosted Search on Railway](https://railway.com/template/self-hosted-search)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/self-hosted-search/manifest.json

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

## Template content

### typesense-railway

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

## Documentation

# Deploy and Host self hosted Self-Hosted Search (Open-Source Instant Search) on Railway

Under the hood this is Typesense pinned to typesense/typesense:30.2 — the official Docker image, never "latest." It listens on 8108, keeps its index on a volume at /data, and expects one secret: TYPESENSE_API_KEY. Size RAM to your dataset and you have an in-memory, typo-tolerant search engine a browser can hit directly, CORS enabled.

## About Hosting Self-Hosted Search open-source software on Railway (self hosted Typesense template)

Typesense is the GPL-3.0 open-source search engine behind a lot of "I typed three letters and it just knew" moments. This template runs the official image with the flags that matter: --data-dir /data so the index lands on a persistent volume, --api-key=$TYPESENSE_API_KEY so the node refuses anonymous writes, and --enable-cors so InstantSearch in the browser can reach it without a proxy shim. That last flag trips up plenty of first deployments — CORS errors in the console while the server is actually healthy on 8108.

The tradeoff: Typesense is in-memory. Every document lives in RAM, with snapshots written to /data on the volume. Queries feel instant, but RAM is your real budget, not disk. A 1 GB index wants roughly 1 GB of RAM plus headroom. On Railway you can start small and scale vertically as the catalog grows.

## Why Deploy Self-Hosted Search, the Algolia alternative on Railway (Railway Free Trial)

Algolia is the default answer to instant search, and it's genuinely good. But it's SaaS-only — you cannot self-host Algolia, full stop. Search volume is metered and the per-request bill climbs with usage. Self-Hosted Search flips that: same typo-tolerant, as-you-type experience, but the binary runs where you choose and costs what your RAM costs, not what your traffic costs.

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 Self-Hosted Search 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 Self-Hosted Search self hosting

DigitalOcean gives you a droplet; you write the Docker run command, the reverse proxy, the backup cron, and the monitoring. AWS gives you ECS, IAM policies, security groups, and a bill that needs its own spreadsheet. Hetzner gives you cheap raw compute, but the entire ops burden is yours. Railway sits in a different lane: a managed platform where the Dockerfile is the spec, the volume attaches in one click, and the $5 GitHub trial covers your first deployment. For a single-node Typesense setup, Railway removes the ops overhead without hiding the important knobs.

| Provider | Setup style | Good at | Watch out for |
|---|---|---|---|
| DigitalOcean | Manual Docker on a droplet | Straightforward pricing, familiar VPS feel | You own updates, backups, proxy config |
| AWS | ECS/Fargate or EC2 | Extreme flexibility, enterprise IAM | Steep learning curve, cost surprises |
| Hetzner | Bare VPS or cloud | Cheap compute, good network | Everything is on you; no managed Docker layer |

## Common Use Cases for hosted Self-Hosted Search

Product catalogs with faceted filtering are the classic fit. A shopper types "waterproof jack" and gets "waterproof jacket" anyway, while facets narrow by size, color, and brand in the sidebar — Typesense does that natively with facet counts per query. Documentation search is another strong one: as-you-type behavior shines on docs sites. Internal tooling benefits from the simple HTTP API — no JVM, no cluster, just one container your backend, frontend, and scripts hit on 8108. Geospatial search is built in too, with radius and polygon filtering for "restaurants near me" queries.

## Dependencies for Self-Hosted Search Docker hosted on Railway

This template runs official typesense/typesense:30.2, a volume at /data, TYPESENSE_API_KEY, and --enable-cors on port 8108. No extra database or Redis.

### Deployment Dependencies for Managed Self-Hosted Search Service (Instant Search)

The template needs three things from you. First, TYPESENSE_API_KEY — a long random string, because it's both the admin key and the search key unless you generate scoped API keys. Lose it and you lose access; there's no password reset. Second, a Railway volume mounted at /data, sized to hold snapshots. Third, enough RAM on the service to hold your dataset plus query overhead. No separate database, no Redis, no message queue — Typesense is self-contained.

### Implementation Details for Self-Hosted Search (Using Typesense official docker image)

The official image is typesense/typesense:30.2, pinned deliberately — never "latest." The entrypoint expects --data-dir, --api-key, and --enable-cors at minimum. In Railway terms that's the Docker image field, the environment variable, and the volume mount. Health checks hit /health on port 8108, the same port the API listens on, so a green health check means your search endpoint is live. Snapshots land periodically in /data and survive redeploys thanks to the volume.

## How does Self-Hosted Search compare against other Self-Hosted Search Engines platforms

These tools are not interchangeable. Typesense is the "Algolia-like" one: built for instant, typo-tolerant, faceted search, open source and single-binary. That focus is its strength and its limit — it's not a general-purpose analytics engine.

### Self-Hosted Search vs Algolia (Algolia Alternative)

Algolia wins on managed polish: dashboard, edge network, and client libraries are best-in-class. But pricing charges per search request and per stored record, making costs unpredictable at scale. Self-Hosted Search is GPL-3.0 and runs on your hardware; a Typesense Cloud 0.5 GB burst node runs about $21.60/month with no per-search fee. With steady traffic and engineering time, self-hosting wins on cost. With zero ops capacity, Algolia is still more comfortable.

### Self-Hosted Search vs Elasticsearch (Elasticsearch Alternative)

Elasticsearch is the Swiss Army knife: full-text, analytics, log search, ML, the whole ELK stack. It's also a JVM application that wants significant memory and tuning to feel fast. Typesense is a single C++ binary that starts in seconds. For "search-as-you-type on a product catalog," Typesense is dramatically simpler. For log aggregation at terabyte scale, Elasticsearch remains the tool — Typesense doesn't play there.

### Self-Hosted Search vs Meilisearch (Meilisearch Alternative)

The closest head-to-head. Both are single-binary, typo-tolerant, instant-search engines. Meilisearch has a friendlier first-run experience and an MIT license, which matters if GPL is a blocker. Typesense has stronger facet performance at scale, built-in geospatial search, and a more mature clustered mode. For small datasets, try both and pick the API that feels better. For larger catalogs with heavy faceting, Typesense tends to hold up better.

### Self-Hosted Search vs Solr (Solr Alternative)

Solr has been around forever and powers a lot of legacy search. It's proven, flexible, and deeply configurable  and that configurability is the problem. Standing up Solr means learning schema.xml, solrconfig.xml, JVM tuning, and Zookeeper for clustering. Typesense is a single container with sensible defaults. Migrating off Solr means removing operational complexity, not gaining exotic features.

## How to use Self-Hosted Search (the OSS Instant Search)?

Three steps: create a collection (schema), index documents, then query. A collection defines fields and types — string, int, float, bool — and which fields are facetable. Documents are POSTed as JSON arrays, and typo tolerance is automatic. Querying is a simple HTTP call to /collections/{name}/documents/search with q for the query, filter_by for facets, sort_by for ordering, and per_page for pagination. For browser clients, generate a scoped search-only API key rather than shipping your admin key to the frontend.

## How to self host Self-Hosted Search on other VPS Services (Self-Hosted Search self hosting guide)

Railway is the easy path, but the underlying steps are the same on any VPS. Here's the manual route so you understand what the template is doing.

### Clone the Repository

Typesense doesn't ship a git repo you need to clone for basic use — the Docker image is the distribution. To build from source, the repo is at typesense/typesense on GitHub under GPL-3.0. Pulling the pinned Docker image is the canonical "clone."

### Install Dependencies

The only dependency is Docker itself. Install Docker Engine on your VPS, pull typesense/typesense:30.2, and you're ready. No runtime to install, no package manager dance, no systemd unit to write unless you want one.

### Configure Environment Variables

Set TYPESENSE_API_KEY to a long random string  at least 32 characters, generated by your password manager or openssl rand -hex 32. The --enable-cors flag is a command-line argument, not an env var, so it goes in the Docker run command.

### Start the Self-Hosted Search Application

docker run -d \
  -p 8108:8108 \
  -v /path/to/data:/data \
  typesense/typesense:30.2 \
  --data-dir /data \
  --api-key=$TYPESENSE_API_KEY \
  --enable-cors

Health-check http://your-server:8108/health and you're serving search. On Railway, all of this is expressed in the service config, but the flags are identical.

## Official Pricing of Self-Hosted Search (Self-Hosted Search pricing)

The open-source Typesense binary is free, GPL-3.0 licensed. You pay for the hardware it runs on. Typesense Cloud is the official managed offering: a 0.5 GB burst node runs about $21.60/month, and a 2 GB burst node lands around $43$51/month, billed hourly for dedicated RAM and vCPU plus bandwidth. No per-search fee

## Similar templates

- [Typesense vs Meilisearch](https://railway.com/deploy/typesense-vs-meilisearch) — self-hosted Typesense vs Meilisearch
- [Betterlytics](https://railway.com/deploy/betterlytics) — Betterlytics is a cookieless analytics platform GDPR-compliant.
- [Finance Tracker](https://railway.com/deploy/finance-tracker-1) — Private multi-user household finance ledger with budgets and CSV import.

Open this page in a browser: https://railway.com/deploy/self-hosted-search
