Damp

Typesense Search

Open-source search engine

Open-source alternative to Algolia with fast search, typo tolerance, and ranking using Typesense latest version.

Docker Configuration

Image: typesense/typesense:latest
Ports: 8108:8108
Volume: damp-typesense:/typesense-data

DAMP identifies the service using Docker labels. Container name is auto-generated by Docker.

Port Configuration

Default ports: 8108 (host) → 8108 (container)

If port 8108 is occupied on the host machine, DAMP automatically uses the next available port. Check the DAMP interface to see the actual port assigned.

Environment Variables

VariableValueDescription
TYPESENSE_DATA_DIR/typesense-dataData directory
TYPESENSE_API_KEYxyzAdmin API key
TYPESENSE_ENABLE_CORStrueEnable CORS
All API requests require the API key: xyz

Connection Information

From Host Machine (Windows)

http://localhost:8108

All API requests must include the header X-TYPESENSE-API-KEY: xyz.

From Project Containers

Use the container name or ID shown in the DAMP interface.

http://[container-name]:8108

Replace [container-name] with the actual container name displayed in DAMP.

Laravel Scout Integration

Install Typesense Scout Driver

composer require typesense/typesense-php
composer require typesense/laravel-scout-typesense-driver

Configure .env

SCOUT_DRIVER=typesense
TYPESENSE_API_KEY=xyz
TYPESENSE_HOST=[container-name]
TYPESENSE_PORT=8108
TYPESENSE_PROTOCOL=http

Replace [container-name] with the actual container name displayed in DAMP.

Usage

use Laravel\Scout\Searchable;

class Product extends Model
{
    use Searchable;
}

// Search
$products = Product::search('laptop')->get();

Direct API Usage

Create Collection

curl "http://localhost:8108/collections" \
  -X POST \
  -H "X-TYPESENSE-API-KEY: xyz" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "products",
    "fields": [
      {"name": "name", "type": "string"},
      {"name": "price", "type": "float"}
    ],
    "default_sorting_field": "price"
  }'

Index Documents

curl "http://localhost:8108/collections/products/documents" \
  -X POST \
  -H "X-TYPESENSE-API-KEY: xyz" \
  -H "Content-Type: application/json" \
  -d '{"name": "Laptop", "price": 999.99}'
curl "http://localhost:8108/collections/products/documents/search?q=laptop&query_by=name" \
  -H "X-TYPESENSE-API-KEY: xyz"

Features

  • Fast search optimized for speed
  • Typo tolerance handles misspellings
  • Geo search for location-based queries
  • Faceting to filter results by attributes
  • Built-in API key authentication

Data Persistence

All collections and documents are stored in the damp-typesense Docker volume. Removing the service preserves your indexes.

On this page