Deploying Typesense
Fast typo-tolerant search with geo search, faceting, and multi-tenant.
PlatformsIntermediate
Why
Typesense is an open-source search engine with typo tolerance, geo search, faceting, and multi-tenant collections. C++ for speed, single binary, easy self-host.
Platform-as-a-Service adoption grew 24% in 2024 as teams shift from VM management to git-push deploys. the cloud infrastructure market reached $330B in 2024, growing 22% year-over-year (Synergy Research), and PaaS layers capture the majority of new workloads.
When
Use Typesense for e-commerce search, geo search, and multi-tenant SaaS. Avoid for log analytics.
How
1. Docker — typesense/typesense:26.0
2. Config — TYPESENSE_API_KEY for auth
3. Collection — create with schema
4. Index — add documents to collection
5. Search — GET /collections/:name/documents/search
6. Geo — geopoint field + geo filter
7. Multi-tenant — separate collections per tenant
Example
# docker-compose.yml
services:
typesense:
image: typesense/typesense:26.0
environment:
TYPESENSE_API_KEY: xyz
TYPESENSE_DATA_DIR: /data
ports: ["8108:8108"]
volumes: [tsdata:/data]
volumes: { tsdata: }
# Create collection and search
curl -X POST localhost:8108/collections -H 'X-TYPESENSE-API-KEY: xyz' -d '{
"name": "places", "fields": [
{ "name": "name", "type": "string" },
{ "name": "location", "type": "geopoint" }
]
}'
curl 'localhost:8108/collections/places/documents/search?q=cafe&query_by=name' -H 'X-TYPESENSE-API-KEY: xyz'
Common Problems
- ⚠No API key — Typesense refuses to start without TYPESENSE_API_KEY
- ⚠Collection schema immutable — can't change field types after creation, re-create
- ⚠Configuration drift between environments — use infrastructure-as-code (Terraform/Pulumi) to keep dev/staging/prod identical
Best Practices
- ✓Use separate collections for multi-tenant — better isolation and performance
- ✓Use geo search for location-based — Typesense has excellent geo support
- ✓Set up health checks and graceful shutdown — handle SIGTERM to drain in-flight requests before exit