Running local Typesense

View Source

This document guides you through setting up a local Typesense instance for development purposes. Running a local instance allows you to experiment with search functionalities and integrate them into your development workflow seamlessly.

Prerequisites

Install Elixir

This project uses Elixir version >= v1.14

There are 4 ways to install Elixir:

Install Docker

We use docker container for spinning up local Typesense instance.

Here are 3 ways to install:

not for production use

This script is intended as a convenient way to configure docker's package repositories and to install Docker Engine, This script is not recommended for production environments.

# this is slightly edited so that you don't
# have to save the file on the machine
curl -sSL https://get.docker.com/ | sh

Setting up

We are using Docker compose to bootstrap a local Typesense instance from a sample docker compose file.

Clone the ex_typesense GitHub repository:

git clone https://github.com/jaeyson/ex_typesense.git

Navigate to the cloned GitHub repository and start the Typesense instance:

cd ex_typesense

docker compose up -d

More info on spinning a local instance: https://typesense.org/docs/guide/install-typesense.html

Once you've started Typesense, you can verify its installation by accessing the health endpoint through a browser or curl in the terminal:

$ curl http://localhost:8108/health
{"ok":true}

In a separate terminal, you can view the logs of your local Typesense instance using following command:

# logs from all instances
docker compose logs -f

# or specifically Typesense
docker container logs --follow --tail 50 typesense

This Docker Compose setup exposes three services with dedicated URLs:

  • http://localhost:8107 (Internal Server Status), provides information about the health and status of your internal server.
  • http://localhost:8108 (Typesense Server and API), allows you to interact with the Typesense search engine and its API functionalities.
  • http://localhost:8109 (Typesense Dashboard), opens the Typesense web interface for managing your search collections and settings.