Skip to main content
Related: Quickstart, Configuration, CLI

Install

Add the gem to your host app:
Create an initializer config/initializers/search_engine.rb:
It is recommended to add:
…in the initializer if you want to store your Typesense collections models in a non‑autoloaded directory. This snippet ensures that Typesense collection models load after the Rails application is ready (models are available). See Configuration for available knobs and ENV fallbacks.

Requirements

  • Ruby >= 3.1, Rails >= 6.1
  • Dependency: typesense >= 4.1.0 (pulled automatically, but may conflict with base64 gem — requires v0.2.0)
  • A running Typesense server reachable at host:port over protocol with a valid API key

Environment variables

  • TYPESENSE_HOST (e.g., localhost)
  • TYPESENSE_PORT (e.g., 8108)
  • TYPESENSE_PROTOCOL (http or https)
  • TYPESENSE_API_KEY (never commit to source control)

Post‑install checklist

  1. Bundle and boot your app.
  2. Verify configuration without leaking secrets:
  3. Run a smoke search against your Typesense server:
Next: tune defaults in Configuration and explore the Client.