Typesense is a fast, open-source search engine designed as an easier, open alternative to Algolia. It's built in C++ for low-latency, in-memory search with typo tolerance, faceting, and geo-search. Like Meilisearch it ships as a single binary with a clean REST API, and like any stateful search engine it needs durable storage and proper key management in production. Here's a complete deployment walkthrough.
Typesense at a glance
Typesense keeps your indexes primarily in memory for sub-50ms searches, persisting to disk for durability. The headline features: typo tolerance, instant search-as-you-type, faceting, filtering, geosearch, and a built-in vector/semantic search capability. Its API is clean and the client libraries are excellent. The practical implication of "in-memory" is that RAM is your primary sizing constraint — your dataset should comfortably fit in memory.
Step 1: Set the API key
Typesense requires a bootstrap API key. This is the admin key — guard it.
TYPESENSE_API_KEY=<a strong random key>
TYPESENSE_DATA_DIR=/data
TYPESENSE_ENABLE_CORS=trueGenerate the key with openssl rand -base64 32. CORS can be enabled if you'll query directly from browsers (with scoped keys — more below).
Step 2: Persistence
Typesense persists its on-disk state to the data directory. In a container that directory must be a persistent volume so your collections survive restarts:
volumes:
- mount: /data
size: 10GiEven though Typesense serves from memory, it replays the on-disk write-ahead log on startup to rebuild state — so losing the volume means losing your data.
Step 3: Deploy on PandaStack
Typesense provides an official Docker image:
- 1Create a container app using
typesense/typesense:27.x(pin the version). - 2Set the start command or rely on the image entrypoint, passing
--data-dir /data --api-key=$TYPESENSE_API_KEY. - 3Attach a persistent volume at
/data. - 4Expose port 8108 (bind to the injected port).
- 5Attach a custom domain like
search.yourdomain.comwith automatic SSL.
Step 4: Scoped search keys for the browser
Never ship the admin API key to a browser. Typesense supports scoped search keys — keys derived from a search-only parent key that can even embed filters (e.g., restrict a user to only their own documents). The flow:
# 1. create a search-only key with the admin key
curl 'https://search.yourdomain.com/keys' \
-H "X-TYPESENSE-API-KEY: $TYPESENSE_API_KEY" \
-d '{"description":"search-only","actions":["documents:search"],"collections":["*"]}'| Key | Actions | Where it lives |
|---|---|---|
| Admin (bootstrap) | All | Server-side only |
| Search-only | documents:search | Server-side, used to derive scoped keys |
| Scoped key | Search + embedded filters | Safe in the browser |
Scoped keys are generated client-side from the search-only key using an HMAC, so you can issue per-user keys without a round trip.
Step 5: Create a collection and index documents
curl 'https://search.yourdomain.com/collections' \
-H "X-TYPESENSE-API-KEY: $TYPESENSE_API_KEY" \
-d '{
"name": "products",
"fields": [
{"name": "title", "type": "string"},
{"name": "price", "type": "float", "facet": true},
{"name": "category", "type": "string", "facet": true}
],
"default_sorting_field": "price"
}'Then bulk-import documents via the /documents/import endpoint with JSONL.
Resource and HA notes
- Memory first. Your collections must fit in RAM with headroom. Choose a memory-optimized tier for large datasets; estimate roughly your document size plus index overhead.
- High availability. Typesense supports a clustered mode (Raft-based, typically 3 or 5 nodes) for HA and read scaling. A single node is fine for many production apps; clustering is for when you can't tolerate downtime.
- Pin versions. Typesense data files are version-specific; plan upgrades and back up before bumping major versions.
Typesense vs. Meilisearch (quick take)
Both are excellent open Algolia alternatives. Typesense leans into in-memory speed, a built-in HA clustering story, and native vector search; Meilisearch leans into developer ergonomics and a slightly simpler mental model. Either is a great choice — pick based on whether you value Typesense's clustering/vector features or Meilisearch's simplicity.
Honest caveats
The in-memory architecture is a double-edged sword: blazing fast, but your dataset is bounded by RAM, which can get expensive for very large corpora. Single-node Typesense is a single point of failure; production-critical search should run the clustered mode, which adds operational complexity (managing 3+ nodes and Raft). And as with any versioned data store, treat upgrades carefully.
Wrapping up
Deploying Typesense to production is about three things: a guarded admin key, a persistent data volume, and scoped search keys so the browser never sees your admin credentials. Size for memory, and reach for clustering only when you need true HA.
PandaStack's persistent volumes, memory-optimized tiers, and automatic SSL make a production Typesense deploy straightforward, and the free tier lets you prototype. Get started at https://dashboard.pandastack.io.
References
- Typesense documentation: https://typesense.org/docs/
- Typesense API keys & scoped keys: https://typesense.org/docs/latest/api/api-keys.html
- Typesense high availability: https://typesense.org/docs/guide/high-availability.html
- Typesense Docker / self-hosting: https://typesense.org/docs/guide/install-typesense.html
- Typesense server configuration: https://typesense.org/docs/latest/api/server-configuration.html