Skip to content

gridlhq/flapjack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ž Flapjack

Self-hosted search engine with an Algolia-compatible API. Single binary, no dependencies.

CI Release License: MIT Status: Beta

Drop-in replacement for Algolia β€” works with InstantSearch.js and the algoliasearch client. Typo-tolerant full-text search with faceting, geo search, and custom ranking. Single static binary, runs anywhere, data stays on disk.

Live Demo Β· Geo Demo Β· API Docs


Quickstart

curl -fsSL https://install.flapjack.foo | sh    #install

flapjack                                        #run the server

open http://127.0.0.1:7700/dashboard            #load the dashboard


# Add documents
curl -X POST http://localhost:7700/indexes/movies/documents \
  -d '[
    {"objectID":"1","title":"The Matrix","year":1999},
    {"objectID":"2","title":"Inception","year":2010}
  ]'

# Search
curl "http://localhost:7700/indexes/movies/search?q=matrxi"

flapjack uninstall
Quickstart API
Method Endpoint Description
GET /indexes List all indexes
GET /indexes/:name/search?q=... Search (query params)
POST /indexes/:name/search Search (JSON body)
POST /indexes/:name/documents Add/update documents
GET /indexes/:name/documents/:id Get a document
DELETE /indexes/:name/documents/:id Delete a document
POST /indexes/:name/documents/delete Bulk delete by ID array
GET /indexes/:name/settings Get index settings
PUT /indexes/:name/settings Update index settings
DELETE /indexes/:name Delete an index
GET /tasks/:taskId Check task status
POST /migrate Migrate from Algolia

These are convenience endpoints with no auth required in dev mode. The full Algolia-compatible API lives under /1/ with support for API keys, secured keys, filters, facets, and everything else.

Note:

Binaries: Releases.

# Install specific version
curl -fsSL https://install.flapjack.foo | sh -s -- v0.2.0

# Custom install directory
FLAPJACK_INSTALL=/opt/flapjack curl -fsSL https://install.flapjack.foo | sh

# Skip PATH modification
NO_MODIFY_PATH=1 curl -fsSL https://install.flapjack.foo | sh

Migrate from Algolia

flapjack

curl -X POST http://localhost:7700/migrate \
  -d '{"appId":"YOUR_ALGOLIA_APP_ID","apiKey":"YOUR_ALGOLIA_ADMIN_KEY","sourceIndex":"products"}'

Search:

curl "http://localhost:7700/indexes/products/search?q=widget"

Then point your frontend at Flapjack instead of Algolia:

import algoliasearch from 'algoliasearch';

// app-id can be any string, api-key is your FLAPJACK_ADMIN_KEY or a search key
const client = algoliasearch('my-app', 'your-flapjack-api-key');
client.transporter.hosts = [{ url: 'localhost:7700', protocol: 'http' }];

// Everything else stays the same

InstantSearch.js widgets work as-is β€” SearchBox, Hits, RefinementList, Pagination, GeoSearch, etc.


Features

Feature Details
Full-text search Prefix matching, typo tolerance (Levenshtein ≀1/≀2)
Filters Numeric, string, boolean, date β€” AND/OR/NOT
Faceting Hierarchical, searchable, filterOnly, wildcard *
Geo search aroundLatLng, insideBoundingBox, insidePolygon, auto-radius
Highlighting Typo-aware, supports nested objects and arrays
Custom ranking Multi-field, asc/desc
Synonyms One-way, multi-way, alternative corrections
Query rules Rewrite queries, pin/hide results
Pagination page/hitsPerPage and offset/length
Distinct Deduplication by attribute
Stop words & plurals English built-in
Batch operations Add, update, delete, clear, browse
API keys ACL, index patterns, TTL, secured keys (HMAC)
S3 backup/restore Scheduled snapshots, auto-restore on startup

Algolia-compatible REST API under /1/ β€” works with InstantSearch.js v5, the algoliasearch client, and Laravel Scout.


Comparison

Flapjack Algolia Meilisearch Typesense Elasticsearch OpenSearch
Self-hosted βœ… ❌ βœ… βœ… βœ… βœ…
License MIT Proprietary MIT GPL-3 ELv2 / SSPL / AGPL Apache 2.0
Algolia-compatible API βœ… β€” ❌ ❌ ❌ ❌
InstantSearch.js Native Native Adapter Adapter Community Community
One-click Algolia migration βœ… β€” ❌ ❌ ❌ ❌
Typo tolerance βœ… βœ… βœ… βœ… βœ… βœ…
Faceting (hierarchical) βœ… βœ… βœ… βœ… βœ… βœ…
Filters (numeric, string, bool, date) βœ… βœ… βœ… βœ… βœ… βœ…
Geo search βœ… βœ… βœ… βœ… βœ… βœ…
Synonyms βœ… βœ… βœ… βœ… βœ… βœ…
Query rules (pin/hide) Basic βœ… ❌ βœ… βœ… βœ…
Custom ranking βœ… βœ… βœ… βœ… βœ… βœ…
Analytics Basic βœ… Cloud only βœ… βœ… βœ…
Scoped API keys (HMAC) βœ… βœ… βœ… βœ… βœ… ❌
S3 backup/restore βœ… N/A ❌ ❌ Snapshots Snapshots
Dashboard UI βœ… βœ… βœ… Cloud only Kibana Dashboards
Embeddable as library βœ… ❌ ❌ ❌ ❌ ❌
HA / clustering ❌ βœ… Cloud only βœ… βœ… βœ…
Multi-language English only 60+ Many Many Many Many
Vector / semantic search ❌ βœ… βœ… βœ… βœ… βœ…
AI search (RAG) ❌ βœ… βœ… βœ… βœ… βœ…
Hybrid search (keyword + vector) ❌ βœ… βœ… βœ… βœ… βœ…
A/B testing ❌ βœ… ❌ ❌ ❌ Partial

Deployment

cargo build --release
./target/release/flapjack

Requires Rust 1.70+. Pre-built binaries for Linux x86_64 (static musl), Linux ARM64, macOS Intel, and macOS Apple Silicon on the releases page.

Docker
# docker-compose.yml
services:
  flapjack:
    image: flapjack/flapjack:latest
    ports:
      - "7700:7700"
    volumes:
      - ./data:/data
    environment:
      FLAPJACK_DATA_DIR: /data
      FLAPJACK_ADMIN_KEY: ${ADMIN_KEY}
    restart: unless-stopped
Systemd
# /etc/systemd/system/flapjack.service
[Unit]
Description=Flapjack Search Server
After=network.target

[Service]
Type=simple
User=flapjack
WorkingDirectory=/var/lib/flapjack
Environment=FLAPJACK_DATA_DIR=/var/lib/flapjack/data
Environment=FLAPJACK_ADMIN_KEY=your-key
ExecStart=/usr/local/bin/flapjack
Restart=always

[Install]
WantedBy=multi-user.target

Configuration

Variable Default Description
FLAPJACK_DATA_DIR ./data Index storage directory
FLAPJACK_BIND_ADDR 127.0.0.1:7700 Listen address
FLAPJACK_ADMIN_KEY β€” Admin API key (enables auth)
FLAPJACK_ENV development production requires auth on all endpoints
FLAPJACK_S3_BUCKET β€” S3 bucket for snapshots
FLAPJACK_S3_REGION us-west-1 S3 region
FLAPJACK_SNAPSHOT_INTERVAL β€” Auto-snapshot interval (e.g. 6h)
FLAPJACK_SNAPSHOT_RETENTION β€” Retention period (e.g. 30d)

Data stored in FLAPJACK_DATA_DIR. Mount as a volume in Docker.


API Documentation


Use as a Library

Flapjack's core can be embedded directly:

[dependencies]
flapjack = { version = "0.1", default-features = false }

See LIB.md for the embedding guide.


Architecture

Built on Tantivy (forked for edge-ngram prefix search). Axum + Tokio HTTP server. Supports 600+ indexes per 4GB node.

flapjack/              # Core library (search, indexing, query execution)
flapjack-http/         # HTTP server (Axum handlers, routing)
flapjack-replication/  # Cluster coordination
flapjack-ssl/          # TLS (Let's Encrypt, ACME)
flapjack/       # Binary entrypoint

Development

cargo install cargo-nextest
cargo nextest run

Roadmap

Security

  • Hash API keys at rest (salted SHA-256)
  • Admin key on first boot only
  • Key type prefixes (fj_admin_, fj_search_)

Infrastructure

  • High availability β€” multi-node replication
  • Managed cloud (SaaS)

Search

  • Vector / hybrid search
  • AI search (RAG)
  • A/B testing
  • Multi-language support

Platform

  • Webhooks
  • Role-based access control

Dashboard Screenshots

Flapjack includes a built-in dashboard UI served at http://localhost:7700 when the server is running.


License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published