EpistemicDB Quickstart
Get EpistemicDB running in 5 minutes.
Prerequisites
- Node.js 20+
- Docker (for PostgreSQL with pgvector)
1. Start the database
bash
git clone <repo-url> && cd epistemicdb
docker compose up -dThis starts PostgreSQL with pgvector on port 5432 and the EpistemicDB server on port 5433.
2. Initialize a project
bash
mkdir my-knowledge-base && cd my-knowledge-base
npx edb init my-kb
npm install @epistemicdb/clientThis creates:
edb.config.ts— project configuration.env— environment variables (EDB_URL, EDB_KEY)queries/example.eql— sample EQL query
3. Generate types
bash
npx edb gen-typesGenerates src/edb.types.ts with typed interfaces for KOs, bonds, and query results.
4. Write your first query
Create queries/my-first.eql:
eql
FETCH KO
WHERE decay_score > 0.35
AND confidence > 0.60
AS projection DYNAMIC
ORDER BY K DESC
LIMIT 105. Run it
bash
# Against the server
eql query queries/my-first.eql
# Or from TypeScripttypescript
import { createClient } from '@epistemicdb/client'
const edb = createClient('http://localhost:5433', process.env.EDB_KEY!)
const result = await edb.query(`
FETCH KO
WHERE entity = "pricing"
AND decay_score > 0.35
ORDER BY K DESC
`)
console.log(result.data.rows)6. Use tagged template literals
typescript
const entity = 'pricing'
const threshold = 0.35
const result = await edb.eql`
FETCH KO
WHERE entity = ${entity}
AND decay_score > ${threshold}
ORDER BY K DESC
`7. Subscribe to changes
typescript
const sub = await edb.watch('WATCH KO WHERE entity = "pricing" AND decay_score < 0.40')
sub.on('update', (event) => {
console.log('KO changed:', event.ko.id, event.changed_fields)
})Next steps
- EQL Reference — all 5 statement types
- Self-hosting Guide — Docker Compose setup, API endpoints