Skip to content

API & SDK

Eidos doesn’t provide traditional REST APIs. Instead, it exposes Eidos’s core capabilities through a unified SDK interface. This means that official features, extension development, and API calls all use the same interfaces and methods.

Eidos provides three different usage scenarios, but they all use the same API interface:

In extensions, you can directly use the global eidos object:

// Query table data in current space
eidos.currentSpace.table("tableId").rows.query()
// Operate on tables in specified space
eidos.space("mySpace").table("tableId").rows.add({
name: "New Record",
status: "active",
})

Through RPC interface, you can remotely call the same methods.

const response = await fetch("http://localhost:13127/rpc", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
space: "mySpace",
method: "table('tableId').rows.query",
params: [],
}),
})
const data = await response.json()
console.log(data)

Headless mode is a powerful feature of Eidos that allows you to run Eidos instances independently without relying on Eidos Desktop.

Each Eidos Space is essentially an independent SQLite file, which means:

  • Completely Independent: Each Space can be exported and run separately
  • Lightweight Deployment: Only requires SQLite file to start a complete Eidos instance
  • Easy Integration: Can be quickly integrated into any JavaScript/TypeScript runtime application

It revolves around DataSpace. Build a DataSpace instance, then you can use the same API for operations:

import { DataSpace } from "@eidos.space/core"
// 1. Initialize database adapter
const db = new DenoServerDatabase("./db.sqlite3")
// 2. Create DataSpace instance
const dataSpace = new DataSpace({
db: db,
activeUndoManager: false,
dbName: "your-db-name",
context: {
// Runtime-specific API implementations
setInterval: undefined,
},
// TODO: Filesystem manager implementation
efsManager: new EidosFileSystemManager(),
})

1. Blog System

const posts = await dataSpace.table("posts").rows.query()

2. Personal Website CMS

const pages = await dataSpace.table("pages").rows.query()

3. API Service Backend

import express from "express"
// RESTful API endpoints
app.get("/api/users", async (req, res) => {
const users = await dataSpace.table("users").rows.query()
res.json(users)
})
app.post("/api/users", async (req, res) => {
const newUser = await dataSpace.table("users").rows.add(req.body)
res.json(newUser)
})

This unified design brings the following advantages:

  • Low Learning Curve: Learn once, use everywhere
  • Code Reusability: Extension code can be easily migrated to other environments
  • Feature Consistency: Ensures all calling methods have the same capabilities
  • High Development Efficiency: No need to learn different APIs for different scenarios