Skip to content

Commit a027cde

Browse files
committed
chore: unify env to SEEKDB_*, document OceanBase/tenant, reorder examples (embedded first), expand Packages, remove TEST_CONFIG_OB
1 parent d58ab0e commit a027cde

16 files changed

Lines changed: 198 additions & 108 deletions

File tree

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
# DASHSCOPE_API_KEY=your_qwen_api_key_here
22
# OPENAI_API_KEY=your_qwen_api_key_here
3+
4+
# Server-mode tests / examples (optional; defaults: host=127.0.0.1, port=2881, user=root, database=test)
5+
# SEEKDB_HOST=127.0.0.1
6+
# SEEKDB_PORT=2881
7+
# SEEKDB_USER=root
8+
# SEEKDB_PASSWORD=
9+
# SEEKDB_DATABASE=test

.github/workflows/ci.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,11 @@ jobs:
9999
- name: Run server tests
100100
working-directory: packages/seekdb
101101
env:
102-
SERVER_HOST: 127.0.0.1
103-
SERVER_PORT: 2881
104-
SERVER_USER: root
105-
SERVER_PASSWORD: ""
106-
SERVER_DATABASE: test
107-
SERVER_TENANT: sys
102+
SEEKDB_HOST: 127.0.0.1
103+
SEEKDB_PORT: 2881
104+
SEEKDB_USER: root
105+
SEEKDB_PASSWORD: ""
106+
SEEKDB_DATABASE: test
108107
run: pnpm exec vitest run --exclude 'tests/embedded/**'
109108

110109
# Embedded-mode tests on multiple platforms (requires native bindings build per OS; Docker per job)
@@ -162,12 +161,11 @@ jobs:
162161
- name: Run embedded tests
163162
working-directory: packages/seekdb
164163
env:
165-
SERVER_HOST: 127.0.0.1
166-
SERVER_PORT: 2881
167-
SERVER_USER: root
168-
SERVER_PASSWORD: ""
169-
SERVER_DATABASE: test
170-
SERVER_TENANT: sys
164+
SEEKDB_HOST: 127.0.0.1
165+
SEEKDB_PORT: 2881
166+
SEEKDB_USER: root
167+
SEEKDB_PASSWORD: ""
168+
SEEKDB_DATABASE: test
171169
run: |
172170
if [ "$RUNNER_OS" = "Linux" ]; then
173171
pnpm exec vitest run tests/embedded/ 2>&1 | tee /tmp/vitest.log

DEVELOP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pnpm --filter seekdb exec vitest run tests/embedded/
115115
**Tests and running mode**:
116116

117117
- **Embedded-mode tests** live under `packages/seekdb/tests/embedded/` and use a temporary database path per test file. They do not require a seekdb/OceanBase server.
118-
- **Server-mode tests** (under `packages/seekdb/tests/` but outside `embedded/`) connect to `127.0.0.1:2881` and require a local seekdb or OceanBase instance.
118+
- **Server-mode tests** (under `packages/seekdb/tests/` but outside `embedded/`) connect to `127.0.0.1:2881` and require a local seekdb or OceanBase instance. Override with `SEEKDB_HOST`, `SEEKDB_PORT`, `SEEKDB_USER`, `SEEKDB_PASSWORD`, `SEEKDB_DATABASE`.
119119
- **Mode consistency** tests (`tests/embedded/mode-consistency.test.ts`) run both embedded and server modes; they require the native addon and a server for the server part.
120120
- Embedded test coverage vs server is documented in `packages/seekdb/tests/embedded/COVERAGE_REPORT.md`.
121121

README.md

Lines changed: 68 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,26 @@ For complete usage, please refer to the official documentation.
3636

3737
This is a monorepo containing:
3838

39-
| Package | Description |
40-
| ------------------------ | ----------------------------------------------------------------------------------------------------------- |
41-
| `seekdb` | Core SDK for seekdb operations |
42-
| `@seekdb/prisma-adapter` | Prisma driver adapter for seekdb Embedded (use Prisma ORM with no MySQL server) |
43-
| `embeddings` | Several embedding functions we provide, including local default-embed, OpenAI embedding, Ollama, Jina, etc. |
39+
| Package | Description |
40+
| ------------------------------ | --------------------------------------------------------------------------------------------------------------- |
41+
| **Core** | |
42+
| `seekdb` | Core SDK for seekdb (Embedded + Server mode), collections, vector/hybrid search, raw SQL via `client.execute()` |
43+
| `@seekdb/js-bindings` | Native addon for Embedded mode; optional dependency of `seekdb`, can be loaded on demand |
44+
| **Integrations** | |
45+
| `@seekdb/prisma-adapter` | Prisma driver adapter for seekdb Embedded (use Prisma with seekdb Embedded) |
46+
| **Embedding packages** | |
47+
| `@seekdb/default-embed` | Default local embedding (e.g. Xenova/all-MiniLM-L6-v2), no API key; recommended for getting started |
48+
| `@seekdb/ollama` | Ollama local embedding |
49+
| `@seekdb/sentence-transformer` | Sentence Transformer local models |
50+
| `@seekdb/openai` | OpenAI embedding API |
51+
| `@seekdb/qwen` | Alibaba DashScope / Qwen embedding API |
52+
| `@seekdb/jina` | Jina AI embedding API |
53+
| `@seekdb/cohere` | Cohere embedding API |
54+
| `@seekdb/voyageai` | Voyage AI embedding API |
55+
| `@seekdb/amazon-bedrock` | AWS Bedrock embedding |
56+
| `@seekdb/google-vertex` | Google Vertex AI embedding |
57+
| `@seekdb/siliconflow` | SiliconFlow embedding API |
58+
| `@seekdb/tencent-hunyuan` | Tencent Hunyuan embedding API |
4459

4560
## Installation
4661

@@ -60,22 +75,21 @@ The SDK supports two modes; the constructor arguments to `SeekdbClient` determin
6075
| **Embedded** | `path` (database directory path) | Runs locally with no separate seekdb server; data is stored under the given path (e.g. `./seekdb.db`). Requires native addon `@seekdb/js-bindings`. |
6176
| **Server** | `host` (and `port`, `user`, `password`, etc.) | Connects to a remote seekdb or OceanBase instance. |
6277

78+
**OceanBase and seekdb**: OceanBase is compatible with seekdb and can be understood as its distributed, multi-tenant, etc. version. seekdb-js therefore supports **OceanBase server mode** with the same API: use the same `SeekdbClient` / `AdminClient` and connection parameters; when connecting to OceanBase, additionally pass `tenant` (e.g. `"sys"` or your tenant name). See [OceanBase mode](#oceanbase-mode-server-mode-with-tenant) below.
79+
6380
- **SeekdbClient**: Pass `path` for embedded mode, or `host` (and port, user, password, etc.) for server mode.
6481
- **AdminClient()**: For admin operations only; pass `path` for embedded or `host` for server. In embedded mode you do not specify a database name.
6582

6683
## Quick Start
6784

68-
**Server mode** (connect to a deployed seekdb):
85+
**Embedded mode** (local file, no server):
6986

7087
```typescript
7188
import { SeekdbClient } from "seekdb";
7289

7390
// 1. Connect
7491
const client = new SeekdbClient({
75-
host: "127.0.0.1",
76-
port: 2881,
77-
user: "root",
78-
password: "",
92+
path: "./seekdb.db",
7993
database: "test",
8094
});
8195

@@ -93,14 +107,17 @@ const results = await collection.query({ queryTexts: "Hello", nResults: 5 });
93107
console.log("query results", results);
94108
```
95109

96-
**Embedded mode** (local file, no server):
110+
**Server mode** (connect to a deployed seekdb):
97111

98112
```typescript
99113
import { SeekdbClient } from "seekdb";
100114

101115
// 1. Connect
102116
const client = new SeekdbClient({
103-
path: "./seekdb.db",
117+
host: "127.0.0.1",
118+
port: 2881,
119+
user: "root",
120+
password: "",
104121
database: "test",
105122
});
106123

@@ -124,7 +141,18 @@ console.log("query results", results);
124141
125142
### Client Connection
126143

127-
**Server mode** (seekdb / OceanBase):
144+
**Embedded mode** (local database file):
145+
146+
```typescript
147+
import { SeekdbClient } from "seekdb";
148+
149+
const client = new SeekdbClient({
150+
path: "./seekdb.db", // database file path
151+
database: "test",
152+
});
153+
```
154+
155+
**Server mode**:
128156

129157
```typescript
130158
import { SeekdbClient } from "seekdb";
@@ -135,19 +163,19 @@ const client = new SeekdbClient({
135163
user: "root",
136164
password: "",
137165
database: "test",
138-
// Required for OceanBase mode
139-
// tenant: "sys",
140166
});
141167
```
142168

143-
**Embedded mode** (local database file):
169+
**OceanBase mode** (server mode with tenant): OceanBase is compatible with seekdb (distributed, multi-tenant, etc.). Use the same server-mode connection; when the backend is OceanBase, pass `tenant` (e.g. `"sys"` or your tenant name):
144170

145171
```typescript
146-
import { SeekdbClient } from "seekdb";
147-
148172
const client = new SeekdbClient({
149-
path: "./seekdb.db", // database file path
173+
host: "127.0.0.1",
174+
port: 2881,
175+
user: "root",
176+
password: "",
150177
database: "test",
178+
tenant: "sys", // or your OceanBase tenant
151179
});
152180
```
153181

@@ -444,6 +472,19 @@ const collection = await client.createCollection({
444472

445473
Use `AdminClient()` for database management. It returns a `SeekdbClient` instance. In **embedded mode** you only pass `path`; no database name is required.
446474

475+
**Embedded mode** (local database file):
476+
477+
```typescript
478+
import { AdminClient } from "seekdb";
479+
480+
const admin = AdminClient({ path: "./seekdb.db" });
481+
await admin.createDatabase("new_database");
482+
const databases = await admin.listDatabases();
483+
const db = await admin.getDatabase("new_database");
484+
await admin.deleteDatabase("new_database");
485+
await admin.close();
486+
```
487+
447488
**Server mode**:
448489

449490
```typescript
@@ -454,7 +495,6 @@ const admin = AdminClient({
454495
port: 2881,
455496
user: "root",
456497
password: "",
457-
// OceanBase mode requires tenant: "sys"
458498
});
459499

460500
await admin.createDatabase("new_database");
@@ -464,12 +504,17 @@ await admin.deleteDatabase("new_database");
464504
await admin.close();
465505
```
466506

467-
**Embedded mode** (no server):
507+
**OceanBase mode** (server mode with tenant): add `tenant` (e.g. `"sys"` or your tenant name) to the config:
468508

469509
```typescript
470-
import { AdminClient } from "seekdb";
510+
const admin = AdminClient({
511+
host: "127.0.0.1",
512+
port: 2881,
513+
user: "root",
514+
password: "",
515+
tenant: "sys", // or your OceanBase tenant
516+
});
471517

472-
const admin = AdminClient({ path: "./seekdb.db" });
473518
await admin.createDatabase("new_database");
474519
const databases = await admin.listDatabases();
475520
const db = await admin.getDatabase("new_database");

examples/complete-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function main() {
3333
// database: "test",
3434
// user: "root",
3535
// password: "",
36-
// // for OceanBase, set tenant to "sys"
36+
// // For OceanBase: add tenant: "sys" or your tenant.
3737
// // tenant: "sys",
3838
// });
3939

examples/hybrid-search-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async function main() {
2626
// database: "test",
2727
// user: "root",
2828
// password: "",
29-
// // for OceanBase, set tenant to "sys"
29+
// // For OceanBase: add tenant: "sys" or your tenant.
3030
// // tenant: "sys",
3131
// });
3232

examples/seekdb-prisma/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Vector/hybrid search with seekdb-js and type-safe relational tables with Prisma.
44

55
- **Server mode** (`pnpm start`): same database, two connections (SeekdbClient + PrismaClient via `DATABASE_URL`).
6-
- **Embedded mode** (`pnpm run start:embedded`): use [@seekdb/prisma-adapter](https://www.npmjs.com/package/@seekdb/prisma-adapter) so Prisma runs SQL via `client.execute()` — no MySQL server.
6+
- **Embedded mode** (`pnpm run start:embedded`): use [@seekdb/prisma-adapter](https://www.npmjs.com/package/@seekdb/prisma-adapter) so Prisma runs SQL via `client.execute()`.
77

88
## Prerequisites
99

examples/simple-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function main() {
3131
// database: "test",
3232
// user: "root",
3333
// password: "",
34-
// // for OceanBase, set tenant to "sys"
34+
// // For OceanBase: add tenant: "sys" or your tenant.
3535
// // tenant: "sys",
3636
// });
3737

packages/prisma-adapter/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @seekdb/prisma-adapter
22

3-
Prisma driver adapter for **seekdb Embedded**. Use Prisma ORM with seekdb in-process — no MySQL server required.
3+
Prisma driver adapter for **seekdb Embedded**. Use Prisma with seekdb Embedded.
44

55
- **Provider**: `mysql` (seekdb is MySQL-compatible)
66
- **Use case**: Vector/hybrid search with seekdb Collection API + type-safe relational tables with Prisma, all in one embedded database file.

packages/prisma-adapter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@seekdb/prisma-adapter",
33
"version": "0.1.0",
4-
"description": "Prisma driver adapter for seekdb Embedded — use Prisma with seekdb in-process (no MySQL server)",
4+
"description": "Prisma driver adapter for seekdb Embedded — use Prisma with seekdb Embedded",
55
"keywords": [
66
"seekdb",
77
"prisma",

0 commit comments

Comments
 (0)