Deploy Typesense | Open Source Algolia Alternative Search Engine
Self Host Typesense. Typo-tolerant, vector search, faceted navigation
Typesense
Just deployed
/data
Deploy and Host Typesense on Railway
Deploy Typesense on Railway to get a lightning-fast, typo-tolerant search engine running in minutes. Self-host Typesense as an open-source alternative to Algolia and Elasticsearch with sub-50ms search responses, built-in typo tolerance, and vector search capabilities — no JVM tuning or cluster management required.
This Railway template deploys a single Typesense service backed by a persistent volume for index storage. CORS is enabled by default, and the thread pool is tuned for Railway's container environment.
Getting Started with Typesense on Railway
After deployment completes, your Typesense instance is immediately ready to accept API requests. Navigate to your generated Railway URL and append /health to verify the server is running — you should see {"ok":true}.
To start indexing data, you'll need the API key set during deployment. Use the Typesense Dashboard (a separate open-source web UI) or any HTTP client to create your first collection. Here's a quick test to verify your instance:
curl -H "X-TYPESENSE-API-KEY: your-api-key" \
"https://your-typesense.up.railway.app/collections"
Install a client library for your language — official SDKs are available for JavaScript, Python, PHP, and Ruby. Create a collection schema, index some documents, and run your first search query.
About Hosting Typesense
Typesense is an open-source, typo-tolerant search engine built in C++ for maximum performance. It serves as a drop-in alternative to Algolia (with open-source pricing) and a simpler alternative to Elasticsearch (without JVM complexity).
- Instant search-as-you-type with automatic typo tolerance
- Vector search and hybrid search for semantic/AI-powered queries
- Faceted navigation with filtering, sorting, and grouping
- Geo-search for location-based results
- Built-in rate limiting and API key scoping
- Raft-based clustering for high availability
- 25.6k+ GitHub stars — active community and development
Typesense uses embedded RocksDB for storage — no external database required. It runs as a single self-contained binary, making it straightforward to operate.
Why Deploy Typesense on Railway
- One-click deployment with persistent volume for index data
- No JVM, no Elasticsearch cluster management — single binary
- Automatic HTTPS and domain provisioning
- Scale vertically by adjusting Railway service resources
- Private networking for backend-to-search communication
Common Use Cases for Self-Hosted Typesense
- E-commerce product search — instant autocomplete with faceted filtering by category, price, brand
- Documentation and knowledge base search — index docs sites with typo tolerance for developer portals
- SaaS application search — power in-app search bars with sub-50ms responses
- Semantic search with AI — combine keyword and vector search using built-in embedding models
Dependencies for Typesense on Railway
- Typesense —
typesense/typesense:29.1(Docker Hub) - Volume — persistent storage at
/datafor indexes, state, and metadata
Environment Variables Reference for Self-Hosting Typesense
| Variable | Value | Description |
|---|---|---|
TYPESENSE_API_KEY | (your key) | Admin API key for authentication |
TYPESENSE_DATA_DIR | /data | Data directory on the volume mount |
TYPESENSE_ENABLE_CORS | true | Allow cross-origin browser requests |
TYPESENSE_THREAD_POOL_SIZE | 8 | Worker threads (reduced for Railway containers) |
TYPESENSE_NUM_COLLECTIONS_PARALLEL_LOAD | 4 | Parallel collection loading at startup |
Deployment Dependencies
- Runtime: C++ native binary (no JVM, no Node.js)
- Docker Hub: typesense/typesense
- GitHub: typesense/typesense (25.6k stars, GPL-3.0)
- Docs: typesense.org/docs
Hardware Requirements for Self-Hosting Typesense
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPUs | 4 vCPUs |
| RAM | 256 MB (empty) | 2–4 GB (production datasets) |
| Storage | 1 GB | 5x RAM provisioned |
| Runtime | Docker or native binary | SSD storage recommended |
RAM scales with dataset size: if your searchable fields total X MB, provision 2–3x MB of RAM. Vector search with built-in embedding models requires 2–6 GB additional RAM for model loading.
Self-Hosting Typesense with Docker
Pull the official image and run with a persistent data directory:
docker run -d --name typesense \
-p 8108:8108 \
-v $(pwd)/typesense-data:/data \
-e TYPESENSE_API_KEY=your-api-key-here \
-e TYPESENSE_DATA_DIR=/data \
-e TYPESENSE_ENABLE_CORS=true \
-e TYPESENSE_THREAD_POOL_SIZE=8 \
typesense/typesense:29.1
Or with Docker Compose:
services:
typesense:
image: typesense/typesense:29.1
ports:
- "8108:8108"
volumes:
- typesense-data:/data
environment:
TYPESENSE_API_KEY: your-api-key-here
TYPESENSE_DATA_DIR: /data
TYPESENSE_ENABLE_CORS: "true"
volumes:
typesense-data:
Typesense vs Algolia vs Elasticsearch
| Feature | Typesense | Algolia | Elasticsearch |
|---|---|---|---|
| Open Source | Yes (GPL-3.0) | No | Yes (SSPL) |
| Pricing | Free self-host | Per-search pricing | Free self-host |
| Setup Complexity | Single binary | Managed only | JVM + cluster config |
| Typo Tolerance | Built-in | Built-in | Requires config |
| Vector Search | Built-in | No | Via plugin |
| Query Speed | <50ms | <50ms | Varies |
| Scale Limit | Millions of docs | Unlimited (managed) | Billions of docs |
Typesense offers Algolia-level search quality with self-hosting freedom. Choose Elasticsearch for massive-scale log analytics; choose Typesense for developer-friendly search with simple operations.
Is Typesense Free to Self-Host?
Typesense is fully open-source under the GPL-3.0 license. Self-hosting is free — you only pay for infrastructure. On Railway, a basic Typesense instance costs approximately $5–10/month. Typesense Cloud offers managed hosting starting from $0.035/hour for a 0.5 GB RAM cluster. There are no per-search or per-record charges with either option.
FAQ
What is Typesense and why self-host it? Typesense is an open-source search engine designed for instant, typo-tolerant search. Self-hosting gives you full control over your search infrastructure, zero per-query costs, and the ability to keep data on your own servers.
What does this Typesense Railway template deploy? This template deploys a single Typesense server (v29.1) with a persistent volume for index storage, CORS enabled, and thread pool tuned for Railway's container environment. No external database is needed — Typesense uses embedded RocksDB.
Why does this template include a persistent volume?
Typesense stores all indexed data, collection schemas, and Raft state on disk. Without a volume, all data would be lost on every deployment or restart. The volume at /data ensures your search indexes persist across redeploys.
How do I create collections and index data in self-hosted Typesense?
Use the Typesense API with your admin API key. Send a POST request to /collections with your schema definition, then POST documents to /collections/{name}/documents. Official SDKs for JavaScript, Python, PHP, and Ruby handle this with type-safe methods.
Why is the thread pool size set to 8 instead of the default?
Typesense defaults to NUM_CORES * 8 threads (often 256), which exceeds Railway container thread limits and causes a crash. Setting TYPESENSE_THREAD_POOL_SIZE=8 prevents this while still providing adequate concurrency for most workloads.
Can I use Typesense for vector search and AI-powered queries on Railway? Yes. Typesense supports vector search natively — you can store embedding vectors alongside text fields and run hybrid keyword+semantic searches. For built-in embedding models (S-BERT, E-5), ensure your Railway service has at least 2–4 GB RAM for model loading.
Template Content
Typesense
typesense/typesense:29.1