---
title: "Deploy Meilisearch"
description: "Fast search engine that indexes your data and handles typos"
category: "Storage"
url: https://railway.com/deploy/meilisearch-engine
---

# Deploy Meilisearch

Fast search engine that indexes your data and handles typos

**[Deploy Meilisearch on Railway](https://railway.com/template/meilisearch-engine)**

- **Creator:** A3A
- **Category:** Storage

## Template content

### meilisearch-ui https://raw.githubusercontent.com/eyeix/meilisearch-ui/main/public/meili-logo.svg

- **Image:** eyeix/meilisearch-ui:lite
- **Start command:** `/bin/sh -c 'C=""; if [ -r /sys/fs/cgroup/cpu.max ]; then CM=$(cat /sys/fs/cgroup/cpu.max); Q=${CM%% *}; P=${CM##* }; if [ "$Q" != "max" ] && [ -n "$P" ]; then C=$(( (Q + P - 1) / P )); fi; fi; [ -n "$C" ] || C=2; [ "$C" -le 4 ] || C=4; sed -i "s/^worker_processes .*/worker_processes ${C};/" /etc/nginx/nginx.conf; echo "railway: nginx worker_processes=${C}"; exec /docker-entrypoint.sh nginx -g "daemon off;"'`
- **Health check:** /
- **Public domain:** Yes

### meilisearch https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/meilisearch.svg

- **Image:** getmeili/meilisearch:v1
- **Start command:** `/bin/sh -c 'mkdir -p /meili_data/snapshots /meili_data/dumps /meili_data/tmp; C=""; if [ -r /sys/fs/cgroup/cpu.max ]; then CM=$(cat /sys/fs/cgroup/cpu.max); Q=${CM%% *}; P=${CM##* }; if [ "$Q" != "max" ] && [ -n "$P" ]; then C=$(( (Q + P - 1) / P )); fi; fi; [ -n "$C" ] || C=4; T=$(( C / 2 )); [ "$T" -ge 1 ] || T=1; M=""; if [ -r /sys/fs/cgroup/memory.max ]; then MM=$(cat /sys/fs/cgroup/memory.max); if [ "$MM" != "max" ]; then M=$MM; fi; fi; [ -n "$M" ] || M=2147483648; [ -n "$MEILI_MAX_INDEXING_THREADS" ] || export MEILI_MAX_INDEXING_THREADS=$T; [ -n "$MEILI_MAX_INDEXING_MEMORY" ] || export MEILI_MAX_INDEXING_MEMORY=$(( M / 2 )); echo "railway: cgroup cpus=$C mem=$M -> MEILI_MAX_INDEXING_THREADS=$MEILI_MAX_INDEXING_THREADS MEILI_MAX_INDEXING_MEMORY=$MEILI_MAX_INDEXING_MEMORY"; exec tini -s -- /bin/meilisearch'`
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Meilisearch on Railway

Meilisearch is an open-source search engine written in Rust that returns ranked, typo-tolerant results in a couple of milliseconds — what teams reach for when they want Algolia's search-as-you-type experience without handing their data to a third party. You point it at JSON documents — products, articles, tickets, customer records — and it builds an index handling misspellings, filters, facets, sorting, synonyms and geographic queries through one REST API.

This template lets you self-host Meilisearch on Railway with a working admin dashboard attached, so you can create an index and run your first query minutes after deploying. It runs two services: `meilisearch`, the engine, backed by a persistent volume holding every index, snapshot and dump; and `meilisearch-ui`, a browser dashboard for creating indexes, uploading documents and testing queries. The engine is protected by a master key from the first boot, serves a REST API on its public domain, and is reachable privately at `meilisearch.railway.internal:7700`.

![Diagram of the Meilisearch engine and dashboard services on Railway](https://res.cloudinary.com/rroe4rtk/image/upload/v1787292595/meilisearch-architecture.png)

## Getting Started with Meilisearch on Railway

After the deploy finishes, copy `MEILI_MASTER_KEY` from the `meilisearch` service's variables — that key is the root credential, and Meilisearch has no usernames or passwords. Check the engine at `https:///health`, which answers `{"status":"available"}` unauthenticated; every other route returns 401 without the key. Then open the `meilisearch-ui` domain, click the `+` tile and add an instance using the engine's public URL and the master key — the dashboard keeps that key in your own browser and calls the engine directly.

The instance page shows the engine's version, database size and index list. Click **Create**, give the index a UID such as `movies` and a primary key such as `id`, then use **Upload documents** to push a JSON array. Open **Documents**, type a deliberately misspelled query and check you get sensible hits back in single-digit milliseconds — that round trip proves the deployment works. Use **Settings** to declare searchable, filterable and sortable attributes before pointing your app at the API.

![Meilisearch dashboard showing a connected instance and its movies index](https://res.cloudinary.com/rroe4rtk/image/upload/v1787292597/meilisearch-instance-overview.png)
![Misspelled search query returning six matching movies in two milliseconds](https://res.cloudinary.com/rroe4rtk/image/upload/v1787292599/meilisearch-typo-tolerant-search.png)
![JSON index configuration listing searchable, filterable and sortable attributes](https://res.cloudinary.com/rroe4rtk/image/upload/v1787292603/meilisearch-index-settings.png)

## About Hosting Meilisearch

Meilisearch is a single Rust binary with an embedded LMDB store, which is what makes it practical to self-host: no cluster to babysit, no JVM to tune, no coordination layer. It accepts documents over HTTP, indexes them through an internal task queue, and serves queries from memory-mapped files on disk. Teams self-host it when search data is sensitive, or when per-record SaaS pricing stops making sense.

Key features:

- **Typo tolerance and search-as-you-type**, under 50 ms on typical datasets
- **Filtering, faceting and sorting** on any attribute marked filterable or sortable
- **Hybrid search** combining full-text matching with vector embeddings
- **Scoped API keys and tenant tokens**, so each client sees only their own data
- **Official SDKs** for JavaScript, Python, PHP, Ruby, Go, Rust, Java and .NET

The architecture is deliberately small. The `meilisearch` service owns the volume at `/meili_data`, holding the index at `data.ms` alongside snapshots and dumps. The `meilisearch-ui` service is a static single-page app served by nginx: it holds no data and keeps your connection details in browser local storage, so it needs no volume, database or secrets.

## Why Deploy Meilisearch on Railway

Railway removes the operational work that usually surrounds a self-hosted search engine.

- Persistent volume attached and configured, so indexes survive every redeploy
- Master key generated at deploy time — no unauthenticated instance is exposed
- Private networking lets your app query the engine without leaving Railway
- Health checks, automatic HTTPS and a public REST endpoint out of the box
- Indexing threads and memory sized from the container's real limits, not the host's

## Common Use Cases

- **Product search for an ecommerce storefront**, with facets for brand, price and availability
- **In-app search across documents, tickets or records**, using tenant tokens so each customer searches only their own rows
- **Documentation and knowledge-base search**, replacing a slow `LIKE '%query%'` with instant, misspelling-tolerant results
- **A retrieval layer for an AI assistant**, where hybrid search returns the passages a model answers from

## Dependencies for Meilisearch

- **`getmeili/meilisearch:v1`** — the search engine, pinned to the v1 line so it stays current without jumping a major
- **`eyeix/meilisearch-ui:lite`** — the dashboard, prebuilt static assets on nginx ([github.com/eyeix/meilisearch-ui](https://github.com/eyeix/meilisearch-ui))
- **One persistent volume** mounted at `/meili_data` on the engine

No database, cache, queue or object storage is needed — Meilisearch stores everything itself.

### Environment Variables Reference

| Variable | Service | Purpose |
|---|---|---|
| `MEILI_MASTER_KEY` | meilisearch | Root credential; every other key derives from it |
| `MEILI_ENV` | meilisearch | `production` makes the master key mandatory |
| `MEILI_HTTP_ADDR` | meilisearch | `[::]:7700`, so other services can reach it privately |
| `MEILI_UPGRADE_DB` | meilisearch | Migrates the database in place after a version bump |
| `PORT` | both | Listening port for each service |

### Deployment Dependencies

- Source: [github.com/meilisearch/meilisearch](https://github.com/meilisearch/meilisearch)
- Image: [hub.docker.com/r/getmeili/meilisearch](https://hub.docker.com/r/getmeili/meilisearch)
- Docs: [meilisearch.com/docs](https://www.meilisearch.com/docs)

## Hardware Requirements for Self-Hosting Meilisearch

Meilisearch is memory-hungry while indexing and modest while serving, so size for the import, not the queries.

| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2–4 vCPU |
| RAM | 1 GB | 4–8 GB, comfortably above your index size |
| Storage | 1 GB volume | 2–3× the size of your raw documents |
| Runtime | Linux container | Linux container |

This template caps indexing threads and memory from the container's own limits, so a large import cannot exhaust the instance mid-index.

## Self-Hosting Meilisearch

To run the same engine locally with a persistent data directory:

```
docker run -d --name meilisearch -p 7700:7700 \
  -e MEILI_ENV=production \
  -e MEILI_MASTER_KEY=$(openssl rand -hex 32) \
  -v $(pwd)/meili_data:/meili_data \
  getmeili/meilisearch:v1
```

Create an index, add documents, then search — the same request shapes work against your Railway domain:

```
AUTH="Authorization: Bearer $MEILI_MASTER_KEY"
JSON='Content-Type: application/json'

curl -X POST localhost:7700/indexes -H "$AUTH" -H "$JSON" \
  --data '{"uid":"movies","primaryKey":"id"}'

curl -X POST localhost:7700/indexes/movies/documents -H "$AUTH" -H "$JSON" \
  --data-binary @movies.json

curl -X POST localhost:7700/indexes/movies/search -H "$AUTH" -H "$JSON" \
  --data '{"q":"advenure"}'
```

## How Much Does Meilisearch Cost to Self-Host?

The Meilisearch Community Edition is free and open source under the MIT license, commercial use included, so there is no per-record or per-request charge however large the index grows. Meilisearch also sells a Cloud service and an Enterprise Edition covering sharding and S3-streaming snapshots under a separate license — neither is part of this template. Self-hosting on Railway costs only the compute, memory and storage the services use.

## FAQ

**What is Meilisearch?**
An open-source, typo-tolerant search engine written in Rust. You send it JSON documents over a REST API and it returns ranked, filtered, faceted results in milliseconds — most often described as an open-source Algolia alternative.

**What does this Railway template deploy?**
Two services: the Meilisearch engine with a persistent volume for its indexes and snapshots, and `meilisearch-ui`, a browser dashboard for managing them.

**How do I authenticate against self-hosted Meilisearch?**
With API keys, not accounts. The master key is generated at deploy time and Meilisearch derives four scoped keys from it. Fetch them with `GET /keys` and give your frontend the search-only key.

**Why does the Meilisearch service need a volume?**
The index, its snapshots and any dumps live on disk at `/meili_data`. Without a persistent volume every redeploy would start from an empty index.

**Can my other Railway services query Meilisearch privately?**
Yes — any service in the project reaches it at `http://meilisearch.railway.internal:7700`, keeping search traffic off the internet.

**Is the admin dashboard safe to expose publicly?**
It stores nothing server-side; your instance URL and API key live only in your browser, so the dashboard is useless without the key. The security boundary is the engine's master key, which rejects every unauthenticated request.

**How do I back up a self-hosted Meilisearch index?**
Snapshots are written to the volume daily, and you can trigger a portable dump any time from the dashboard's **Dump** button or with `POST /dumps`. Dumps are version-independent, so they also move data between instances.


## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/meilisearch-engine
