---
title: "Deploy Typesense Collections"
description: "multi-collection Typesense search"
category: "Analytics"
url: https://railway.com/deploy/typesense-collections
---

# Deploy Typesense Collections

multi-collection Typesense search

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

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

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

## Template content

### typesense-railway

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

## Documentation

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

When product records, help docs, and user accounts need different field types and relevance tuning, one flat index gets messy. Typesense Collections solves that with separate collections plus one `/multi_search` endpoint that fans out across them in a single HTTP request. You avoid field-weight gymnastics and get clean schemas per dataset.

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

This template runs one Typesense node from `typesense/typesense:30.2`. You get an attached Railway volume for `/data`, an env var for `TYPESENSE_API_KEY`, and port `8108`. The server keeps everything in RAM, so you size memory to the combined dataset, not one index. Railway handles the container, volume, and network; you define schemas, aliases, and query logic. Snapshots land on the volume automatically, which makes restarts survivable.

## Why Deploy Typesense Collections, the Elasticsearch alternative on Railway (Railway Free Trial)

Elasticsearch does multi-index search well, but it needs JVM tuning, cluster ops, and shard management. For a few collections, that's too much overhead. Typesense is one binary, in-memory, with `/multi_search` and aliases that make index swaps painless. You lose some aggregation depth but gain an operator story that fits a single Railway service. The learning curve drops from weeks to an afternoon.

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 Collections 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's $5 GitHub trial lets you test without a credit card: deploy the image, attach a volume, set the key, and index in minutes.

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

| Provider | Multi-collection setup | Scaling | Ops burden |
|---|---|---|---|
| Railway | Official Docker image, attached volume, env vars | Vertical resize or replicas | Very low |
| DigitalOcean | Droplet/App Platform, manual volumes and networking | Manual resize, snapshots | Medium |
| AWS | ECS/EC2 with EBS, IAM/VPC/LB required | Auto Scaling possible but overkill | High |
| Hetzner | Bare metal/VM with Docker, fully DIY | Vertical only without custom cluster | Medium to high |

Railway wins for speed to production; Hetzner or DigitalOcean may be cheaper per GB at larger sizes, but you lose one-click volume snapshots and integrated restarts.

## Common Use Cases for hosted Typesense Collections

Ecommerce runs product, doc, and customer collections with distinct facets and exact-match rules. Federated search across API refs, tutorials, and changelogs works via one `/multi_search` request with per-collection weights. Admin tools query users, orders, and tickets without lowest-common-denominator schemas. Aliases let you reindex a new collection version and flip over with zero downtime. Another pattern: one collection for public catalog, another for internal inventory with fields like warehouse location and restock date, searched together but kept separate for access control.

## Dependencies for Typesense Collections Docker hosted on Railway

The container won't run without four things: a volume mounted at `/data`, `TYPESENSE_API_KEY` set, the `--enable-cors` flag if browsers call the API, and port `8108` exposed. All are configured in the Railway service settings, not a config file. Health checks should hit `/health` on that port before you send any query traffic.

### Deployment Dependencies for Managed Typesense Collections Service (Multi-Collection Search)

The image needs `--data-dir /data`, the API key env var, and `--enable-cors`. Without the volume, restarts wipe collections. Without the key, the process exits immediately. Without CORS, browser SDKs fail with network errors.

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

Railway service command:

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

Pin to `typesense/typesense:30.2`, never `latest`. A specific minor version prevents surprise schema-breaking changes after an auto-pull.

## How does Typesense Collections compare against other Multi-Index Search platforms

Multi-index means indices in Elasticsearch/Algolia, cores in Solr, indexes in Meilisearch. Typesense uses collections plus `/multi_search` for server-side fan-out with per-collection weights.

### Typesense Collections vs Elasticsearch (Elasticsearch Alternative)

Elasticsearch supports index patterns and `indices_boost`, but you run a JVM, tune heaps, and manage shards.

### Typesense Collections vs Algolia (Algolia Alternative)

Algolia is SaaS-only. Its `multipleQueries` API works, but you pay per search and record stored, which hurts large infrequently queried user collections.

### Typesense Collections vs Meilisearch (Meilisearch Alternative)

Meilisearch is open source Rust, supports multiple indexes and federated search. Its dashboard is prettier.

### Typesense Collections vs Solr (Solr Alternative)

Solr cores can isolate schemas, yet ops cost more than a single Typesense container. For product+docs+users split without a JVM cluster, Collections on Railway is the lighter path.

## How to use Typesense Collections (the OSS Multi-Collection Search)?

Typesense Collections is the open-source Typesense server (GPL-3.0) running as a single container.

1. Create a collection with a defined schema (fields, types, facets).
2. Index JSON documents via the `/collections/{name}/documents` endpoint or a client library.
3.

The server stores all data in the `/data` directory inside the container. Mount a persistent volume there to survive restarts.

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

Self-hosting Typesense on any Linux VPS requires Docker (or a build-from-source toolchain) and a few configuration steps.

### Clone the Repository

You do not need to clone a repository to run Typesense. The server is distributed as a prebuilt Docker image.

### Install Dependencies

Install Docker and Docker Compose on your VPS. On Ubuntu, run:
Ensure the Docker daemon is running: `sudo systemctl start docker`.

### Configure Environment Variables

Create a `.env` file or pass flags directly to the container. Required settings:

- `TYPESENSE_API_KEY`: a long, random string used for all API authentication.
- `TYPESENSE_DATA_DIR`: set to `/data` inside the container (the mount point).
- Optional: add `--enable-cors` if you will call the API from a browser origin other than the server host.

Example `.env`:
```
TYPESENSE_API_KEY=your-secret-key-here
```

### Start the Typesense Collections Application

Run the container with a persistent volume and port mapping:
```bash
docker run -d \
  --name typesense \
  -p 8108:8108 \
  -v /var/lib/typesense:/data \
  -e TYPESENSE_API_KEY=your-secret-key-here \
  typesense/typesense:30.2 \
  --data-dir /data \
  --enable-cors
```
Verify the server is up by sending a health check:
```bash
curl http://localhost:8108/health
```
A `200 OK` response means Typesense is ready to accept collections and queries.

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

The open-source Typesense server (Typesense Collections) has no license fee. It is released under GPL-3.0, so you can self-host it on any infrastructure without paying Typesense.

Typesense Cloud, the managed service, uses a subscription model. The entry-level cluster (0.5GB burst memory, one replica) costs approximately **$21.60 per month**.

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

Typesense Cloud bills dedicated RAM and vCPU hourly (about $21.60/month for a 0.5 GB burst node). Self-hosting Collections on Railway uses the same `typesense/typesense:30.2` binary with your volume and keys; you trade managed backups for flat compute cost.

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

A small node with enough RAM for a few collections usually lands in the single-digit to low-teens USD per month plus volume. Railway’s $5 GitHub trial covers early experiments.

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

Size RAM to the sum of collection data held in memory. Start around 1 GB RAM for small multi-collection setups; grow as products, docs, and users indexes expand.

## Frequently Asked Questions (FAQs)
### When should I split into multiple collections?
Split when documents have different schemas, ranking needs, or permissions. Collections are isolated indexes, so use separate ones for distinct entity types (e.g., products vs. articles) or per-tenant data. Keep same-schema data in one collection for unified search.
### How does multi_search merge results?
multi_search sends several search requests in one HTTP call and returns each collection's results as a separate array. It does not merge or re-rank across collections. Your app must combine results if a unified list is needed. Use it to cut network round trips.
### Do aliases help zero-downtime reindexes?
Yes. Create a new collection (e.g., products_v2), index all data, then point an alias (products) to it atomically. Clients query the alias, so you can reindex without downtime or client config changes.
### What image and port does this template use?
The template runs typesense/typesense:30.2 on port 8108, stores data in /data, and sets TYPESENSE_API_KEY for auth. It also enables CORS via --enable-cors. License is GPL-3.0.
### Can browser clients search multiple collections?
Yes, with CORS enabled.

## 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-collections
