Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Scout Typesense Driver Laravel Package

typesense/laravel-scout-typesense-driver

A Typesense driver for Laravel Scout that brings fast, typo-tolerant full-text search, faceting, filtering, geo search, and synonyms to Eloquent models. Swap Scout's default engine for Typesense with simple configuration and a native Laravel integration for scalable, relevant app search.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

typesense/laravel-scout-typesense-driver is a pluggable Engine implementation for Laravel Scout. It sits behind the existing Searchable trait and Model::search() façade, translating Scout's Eloquent-centric contract (index on save/delete, bulk import, paginated search, raw hit mapping) into Typesense collection operations. That means domain code stays untouched — a meaningful architectural win if the application already uses Scout. If search is currently raw SQL LIKE queries or an Elasticsearch-specific client, the fit is weaker, because adopting Scout is itself a refactor.

The driver introduces Typesense as a new stateful service in the deployment topology. That is acceptable when search is treated as a first-class bounded context, but it is overkill for small datasets where the database driver suffices.

Integration feasibility

Composer-installable and straightforward for a senior Laravel engineer: require the package alongside laravel/scout, publish the Scout config, populate the typesense block (host, port, protocol, API key, search-only key), add use Searchable plus searchableAs() and toSearchableArray() to models, then run php artisan scout:import. A Typesense node is required — Docker Compose locally, Typesense Cloud or Kubernetes in production. Expect low-to-moderate effort for greenfield search, and moderate effort when migrating from Algolia or Meilisearch because the Scout contract is identical.

Technical risk

  • Small ecosystem: 145 stars and a single-track release cadence (latest April 2024). Verify composer.json constraints against the target Laravel (10/11/12) and Scout major versions; version lag is the most likely adoption blocker.
  • Feature surface: advanced Typesense capabilities (curation, synonyms, vector/hybrid search, multi-search, geo) may only be partially surfaced through Scout. Plan for occasional direct use of typesense/typesense-php for edge cases.
  • Schema rigidity: Typesense collection schemas are typed. Changing toSearchableArray() requires a reindex, not a migration. Design collections deliberately.
  • Operational coupling: search uptime now depends on a separate cluster's memory, health, and network path.
  • License: MIT, no legal friction.

Key questions

  • Which Laravel/Scout/PHP versions are in scope, and does the driver's constraint matrix cover all of them?
  • Self-hosted, Typesense Cloud, or managed K8s — and who owns the cluster?
  • Which search capabilities are actually required (facets, typo tolerance, synonyms, geo, vector, curations, per-tenant scoping)?
  • What are the current and 18-month targets for index size, write rate, query QPS, and p95 latency?
  • Is graceful degradation mandatory when search is unavailable?
  • Can search-only or per-tenant scoped API keys be exposed to clients?

Integration Approach

Stack fit

Standard Laravel stack applies: Laravel 9+, PHP 8.1+, MySQL/Postgres, Redis queues with Horizon. Scout dispatches indexing to queued jobs, so it composes cleanly with existing async patterns. Typesense's HTTP/JSON API maps directly to Laravel's HTTP client and config layer, and the service can be added to existing docker-compose or Helm charts on an internal port.

Migration path

  1. Baseline current search quality, latency, and query volume.
  2. Provision Typesense in dev/stage/prod and wire Scout config plus environment variables.
  3. Instrument one pilot model and run scout:import.
  4. Run dual-write with the legacy search path as primary and Typesense as shadow; compare results.
  5. Flip reads per model behind a feature flag; monitor error rate and latency.
  6. Decommission the legacy path once metrics hold for a full release cycle.

Compatibility

Pin the driver major version to the Scout major version and lock it in composer.json. Run CI against each supported Laravel version. Pin the Typesense server image (e.g., 0.25.x/27.x) and stage server upgrades before rolling to production. Check for Searchable trait collisions with any existing search packages.

Sequencing

  • Weeks 1–2: infrastructure, config, pilot model, engineering spike.
  • Weeks 3–4: schema design for core entities, backfill scripts, dual-write.
  • Weeks 5–6: flagged rollout, observability, runbook, cutover.

Operational Impact

Maintenance

Two assets to maintain: the driver package (small, slow-moving) and the Typesense cluster (server upgrades, backups, schema changes). Establish a scheduled reindex playbook and drift detection — document-count comparisons and sampled-result checks — and budget quarterly upgrade testing for Laravel, Scout, and Typesense server versions.

Support

Community-supported via GitHub issues; Typesense Inc. offers commercial support and SLAs for the service but not specifically for this driver. At 145 stars the ecosystem is thin — expect to read source for edge cases and keep a fork-and-pin fallback if the package is abandoned.

Scaling

Typesense is memory-resident and scales well vertically; HA requires an odd-numbered cluster behind a load-balanced endpoint. Indexing is queue-driven, so chunk and rate-limit large backfills to avoid saturating nodes. Capacity planning should be driven by QPS × result-set size, not document count alone. For multi-tenancy, decide early between per-tenant collections and filter fields.

Failure modes

  • Typesense unavailable → Model::search() raises; wrap in a DB-query or cached-result fallback and alert on error rate.
  • Index drift after failed or scaled-down queue jobs → periodic reconciliation job.
  • Schema mismatch after a toSearchableArray() change → reindex with a zero-downtime collection/alias swap.
  • Memory OOM during imports → cap batch size and monitor RSS.
  • Key leakage → enforce scoped search-only keys and rotate them.
  • Cluster split-brain or node loss → odd node count with quorum.

Ramp-up

Engineers need Typesense query semantics (query_by, filter_by, sort_by, facets) beyond the Scout façade. Estimate one to two sprints for a mid-size team to ship a pilot plus a runbook, with an extra half-sprint for dashboards and alerting. Assign a single owner for the search domain and document fallback and reindex procedures before launch.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager