Skip to content

Servers

9 server examples implementing the same REST API contract. Swap backends without code changes — clients (editors, web apps, RemoteStore) work with any of them.

API contract

All servers implement the same REST contract, documented below.

All servers expose 7 endpoints:

GET    /configs              → ["demo", "work-links", ...]
GET    /configs/:name        → { config: AlapConfig, meta: { createdAt, updatedAt } }
PUT    /configs/:name        → body is AlapConfig JSON → 204
DELETE /configs/:name        → 204
GET    /search               → cross-config search
POST   /cherry-pick          → { source, expression } → { allLinks }
POST   /query                → { expression, configName?, configs? } → { results }

Search query parameters

ParamDescription
tagMatch links with this tag
qCase-insensitive substring match across fields
regexRegex match across fields
fieldsComma-separated: label,url,tags,description,id (default: all)
configRegex pattern to filter config names
limitMax results (default 100, max 1000)

Cherry-pick and query

These endpoints resolve Alap expressions server-side. Node/Bun servers use AlapEngine from alap/core. Python, PHP, Go, and Rust servers use native ports of the expression parser. All servers sanitize URLs in responses.

Server matrix

ServerLanguageFrameworkDatabaseDependencies
Express + SQLiteNode.jsExpressSQLite3
Hono + SQLiteNode.jsHonoSQLite3
Bun + SQLiteTypeScriptBun built-inSQLite0
Laravel + SQLitePHPLaravel 12SQLiteComposer
Flask + SQLitePythonFlaskSQLite2
Django + SQLitePythonDjango 5.1SQLite2
FastAPI + PostgreSQLPythonFastAPIPostgreSQL4
Gin + SQLiteGoGinSQLite3
Axum + SQLiteRustAxumSQLite4

All servers default to port 3000. All include Dockerfiles (Podman-compatible).

Quick start

SQLite servers (no external database)

bash
cd examples/servers/express-sqlite
npm install
node seed.js
node server.js
# → http://localhost:3000

FastAPI + PostgreSQL

bash
cd examples/servers/fastapi-postgres
docker compose up
# → http://localhost:3000

Docker (any server)

bash
cd examples/servers/express-sqlite
docker build -t alap-express .
docker run -p 3000:3000 alap-express

Using with RemoteStore

typescript
import { createRemoteStore } from 'alap/storage';

const store = createRemoteStore({ baseUrl: 'http://localhost:3000' });
const config = await store.load('demo');

Any of the 9 servers works as the backend. Pick the language and framework that fits your stack.