---
title: "Deploy Typesense Firebase"
description: "sync Firestore into Typesense"
category: "Analytics"
url: https://railway.com/deploy/typesense-firebase
---

# Deploy Typesense Firebase

sync Firestore into Typesense

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

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

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

## Template content

### typesense-railway

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

## Documentation

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

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

Typesense Firebase pairs the GPL-3.0 Typesense search engine with Firestore as the source of truth. You run the official `typesense/typesense:30.2` Docker image on Railway, attach a persistent volume at `/data`, and sync Firestore document changes into Typesense via a worker or Cloud Function. The container listens on API port 8108 and requires `TYPESENSE_API_KEY` for all writes and queries. Typesense is in-memory, so RAM holds the active index while the volume stores snapshots for restart persistence. This gives typo-tolerant, faceted, full-text search over Firestore collections with sub-50ms latency, all on infrastructure you control.

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

Algolia is SaaS-only; you cannot self-host it, and its Grow plan bills per search request and per record stored. Typesense Firebase removes that per-keystroke tax: you run the engine yourself, pay for compute and volume, and keep Firestore data and search index inside the same boundary. For Firebase teams, self-hosting Typesense on Railway eliminates vendor lock-in and unpredictable search 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 Typesense Firebase 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 Firebase self hosting

| Provider | Typesense Firebase Deployment Experience | Firestore Sync Considerations | Cost Profile |
|---|---|---|---|
| DigitalOcean | Manual Droplet, Docker install, firewall for 8108, volume snapshots | Sync worker on same Droplet; no native Firestore trigger | Predictable monthly Droplet cost, you own OS patching |
| AWS | EC2/ECS with EBS, IAM, security groups, VPC setup | Cross-cloud networking or polling worker for Firestore | Pay for compute, EBS, transfer; complex billing |
| Hetzner | Cheap VPS, manual Docker and volume | Co-located sync worker; no managed trigger path | Lowest raw compute, highest operational overhead |

Railway avoids all that: push the image, attach a volume, set `TYPESENSE_API_KEY`, and the container is live on 8108. The Firestore sync worker can run as a second Railway service on the same private network.

## Common Use Cases for hosted Typesense Firebase

- **E-commerce catalogs in Firestore**: instant faceted search with typo tolerance for products, prices, categories.
- **Content and documentation sites**: full-text search with highlighted snippets and relevance ranking.
- **User directories and social apps**: search profiles, skills, locations with filters.
- **SaaS dashboards with tenant data**: `tenant_id` filter per collection for isolated search.
- **Realtime collaboration tools**: Firestore listeners push changes to Typesense in milliseconds.
- **Mobile apps with offline-first Firestore**: same index serves iOS, Android, web via InstantSearch.

## Dependencies for Typesense Firebase Docker hosted on Railway
DB

### Deployment Dependencies for Managed Typesense Firebase Service (Instant Search)

The Railway deployment needs the Typesense container, a persistent volume at `/data`, and a sync path from Firestore. Typesense is self-contained; no external database is required. The volume prevents index loss on redeploy. The sync layer can be a Cloud Function triggered by Firestore `onWrite` events that POSTs changes to port 8108, or a Node.js/Python worker as a second Railway service using the internal hostname and `TYPESENSE_API_KEY`.

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

Start the container with:

```
typesense/typesense:30.2 --data-dir /data --api-key=$TYPESENSE_API_KEY --enable-cors
```

`--data-dir /data` writes snapshots and on-disk index. `--api-key=$TYPESENSE_API_KEY` sets the single admin key; losing it forces a full re-import. `--enable-cors` allows browser InstantSearch clients to call the API directly. Health check hits port 8108; `/health` returns `{"ok":true}`.

## How does Typesense Firebase compare against other Instant Search platforms

### Typesense Firebase vs Algolia (Algolia Alternative)

Algolia is hosted-only and bills per search request and record. Typesense Firebase runs on your Railway compute with no per-search fee. Algolia keeps your index in their cloud; Typesense keeps it inside your project. For heavy Firestore search traffic, self-hosting is significantly cheaper and avoids lock-in.

### Typesense Firebase vs Elasticsearch (Elasticsearch Alternative)

Elasticsearch runs on the JVM, needs multiple GB RAM even for small datasets, and requires cluster tuning. Typesense is a single Go binary that starts in seconds, uses a fraction of memory, and is built for instant search. Firestore sync works with both, but Typesense has far lower operational overhead.

### Typesense Firebase vs Meilisearch (Meilisearch Alternative)

Meilisearch is lightweight and open source, but Typesense offers more granular ranking rules, synonyms, curation, and higher write throughput for Firestore's realtime document stream. Both are typo-tolerant, but Typesense's in-memory architecture delivers lower query latency under concurrent load.

### Typesense Firebase vs Typesense Cloud (Typesense Cloud Alternative)

Typesense Cloud is the managed version, billed on dedicated RAM/vCPU per hour plus bandwidth. A 0.5 GB burst node costs about $21.60/month; 2 GB runs $43–$51/month. Self-hosting on Railway costs single-digit to low-teens USD/month for a small node because you pay only Railway compute and volume. The tradeoff is operational: you manage the container, volume, and sync worker.

## How to use Typesense Firebase (the OSS Instant Search)?

Define a Typesense collection schema mirroring the Firestore fields you want to search (e.g., `title`, `description`, filterable `category`, `price`, `tenant_id`). The sync layer listens to Firestore changes: on create/update, transform the document and POST to `https://your-typesense-service:8108/collections/{collection}/documents/{id}`; on delete, send a DELETE to the same endpoint. Batch multiple changes into one import call to reduce HTTP overhead.

On the query side, use the Typesense InstantSearch adapter for React, Vue, Angular, or vanilla JS. Point the client at your Railway service URL on port 8108, pass `TYPESENSE_API_KEY`, and configure search parameters. The UI components handle as-you-type queries, typo tolerance, faceting, and highlighting.

## How to self host Typesense Firebase on other VPS Services (Typesense Firebase self hosting guide)

### Clone the Repository

Clone a Typesense Firebase starter repo containing the Dockerfile, Firestore sync worker, and schema definitions. It typically includes a `docker-compose.yml` with the Typesense service, volume mount, and environment variables, plus a `sync/` directory.

### Install Dependencies

On the VPS, install Docker and Docker Compose. For the sync worker, install Node.js 18+ and the `firebase-admin` and `typesense` npm packages. `firebase-admin` authenticates to Firestore via a service account JSON; `typesense` handles HTTP calls to the engine.

### Configure Environment Variables

Set `TYPESENSE_API_KEY` to a long random string, stored in a secrets manager or env file not committed to version control. Set the Firestore service account path, Typesense host (localhost on a single VPS, or internal Railway hostname in multi-service), and port 8108. Ensure port 8108 is reachable and protected if the sync worker runs on a different host.

### Start the Typesense Firebase Application

Run the container:

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

Then start the sync worker. It performs an initial full import from Firestore, then subscribes to realtime changes. Verify `/health` on 8108 returns `{"ok":true}` and run a test query.

## Official Pricing of Typesense Firebase (Typesense Firebase pricing)

Typesense is open source under GPL-3.0, so the software is free to self-host. You pay only infrastructure: Railway compute and volume for the container, plus any compute for the sync worker. There is no license fee.

Typesense Cloud bills on dedicated RAM/vCPU per hour plus bandwidth, with no per-search fee. A 0.5 GB burst node is about $21.60/month; 2 GB is $43–$51/month. Algolia bills per search request and record stored, which scales unpredictably with user activity. Typesense Firebase on Railway removes the per-request variable entirely.

## Typesense Firebase cloud vs self hosted comparison (Pricing, features, costs, and more)

### Monthly cost of self hosting Typesense Firebase on Railway

A small Typesense node on Railway typically costs single-digit to low-teens USD per month. A 0.5 GB RAM container with a 1 GB volume handles tens of thousands of Firestore documents and costs well under the Typesense Cloud 0.5 GB node at $21.60/month. The Railway $5 GitHub trial credit covers the first month of experimentation. A minimal sync worker as a second Railway service adds a few dollars; using GCP Cloud Functions costs negligible invocation fees for moderate write volumes.

### System Requirements for Hosting Typesense Firebase on a VPS

Typesense is in-memory, so RAM is the primary constraint. Size RAM to hold the entire Firestore dataset plus index overhead, roughly 2–3x the raw JSON size. A 100 MB export needs 256–512 MB RAM. CPU is modest: a single vCPU handles thousands of queries 


## 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/typesense-firebase
