Skip to content

Typesense

Part of the Sidecar Services catalog.

What it does

Typesense is a typo-tolerant, low-latency search engine. As a sidecar it backs faceted or instant search on a project locally, standing in for a hosted Typesense cluster a site would point at in production. You add it when project code indexes content into Typesense and queries it for search results, and you want that integration running on your machine instead of mocked.

How it works

The preset pins typesense/typesense:0.25.2 and listens on container port 8108. It runs with --api-key=wdg-local-dev --enable-cors and persists its index in a named volume mounted at /data, so your data survives a restart.

Typesense gets a browser UI: the host port is auto-allocated from the 7000 to 7999 range and de-conflicted across all projects. Add it and then read the URL from the service list.

bash
wdg my-site service add typesense
wdg my-site service list

The service list output shows the browser URL for the allocated host port.

How it integrates with the local WordPress container

Adding the sidecar injects these env vars into the WordPress container:

VariableValue
TYPESENSE_HOSTwdg-my-site-typesense (the @HOST token resolved at add-time)
TYPESENSE_PORT8108
TYPESENSE_API_KEYwdg-local-dev

WordPress reaches Typesense over wdg-network at wdg-my-site-typesense:8108, never the host port. The host port exists only for your browser.

These env vars are connectivity hints. The project still supplies the code that reads them and talks to Typesense (a search plugin or custom integration that creates collections, indexes posts, and runs queries). A typical consumer reads the values in PHP:

php
$host = getenv( 'TYPESENSE_HOST' );   // wdg-my-site-typesense
$port = getenv( 'TYPESENSE_PORT' );   // 8108
$key  = getenv( 'TYPESENSE_API_KEY' ); // wdg-local-dev

Adding the sidecar wires reachability only. The integration code lives in the project.

Add and remove

bash
wdg my-site service add typesense
wdg my-site service remove typesense          # keeps the data volume
wdg my-site service remove typesense --purge  # also deletes the data volume