@tursodatabase/vercel-experimental 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Turso
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,232 @@
1
+ <p align="center">
2
+ <a href="https://turso.tech/">
3
+ <picture>
4
+ <img src="/.github/assets/cover.png" alt="Turso database for Vercel" />
5
+ </picture>
6
+ </a>
7
+ <h1 align="center">Turso + Vercel Integration</h1>
8
+ </p>
9
+
10
+ <p align="center">
11
+ Zero-config SQLite databases for Vercel Functions.
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://turso.tech"><strong>Turso</strong></a> ·
16
+ <a href="https://docs.turso.tech"><strong>Docs</strong></a> ·
17
+ <a href="https://turso.tech/blog"><strong>Blog &amp; Tutorials</strong></a>
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="LICENSE">
22
+ <picture>
23
+ <img src="https://img.shields.io/github/license/tursodatabase/turso-vercel?color=0F624B" alt="MIT License" />
24
+ </picture>
25
+ </a>
26
+ <a href="https://tur.so/discord-ts">
27
+ <picture>
28
+ <img src="https://img.shields.io/discord/933071162680958986?color=0F624B" alt="Discord" />
29
+ </picture>
30
+ </a>
31
+ <a href="https://www.npmjs.com/package/@tursodatabase/vercel-experimental">
32
+ <picture>
33
+ <img src="https://img.shields.io/npm/v/@tursodatabase/vercel-experimental?color=0F624B" alt="npm version" />
34
+ </picture>
35
+ </a>
36
+ </p>
37
+
38
+ > **⚠️ Warning:** This software is in BETA. It may still contain bugs and unexpected behavior. Use caution with production data and ensure you have backups.
39
+
40
+ ## Features
41
+
42
+ - **Zero-config databases** &mdash; Databases are created automatically on first use
43
+ - **Local SQLite** &mdash; Fast reads from a local database copy in the serverless function
44
+ - **Automatic sync** &mdash; Writes are automatically pushed to Turso when the database connection is closed
45
+ - **Partial sync** &mdash; Sync only the data you need for efficient cold starts
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ npm install @tursodatabase/vercel-experimental
51
+ ```
52
+
53
+ ## Setup
54
+
55
+ 1. Get your Turso API token:
56
+ ```bash
57
+ turso auth api-tokens mint my-vercel-token
58
+ ```
59
+
60
+ 2. Get your organization slug:
61
+ ```bash
62
+ turso org list
63
+ ```
64
+
65
+ 3. Add environment variables to your Vercel project:
66
+ ```
67
+ TURSO_API_TOKEN=your-api-token
68
+ TURSO_ORG=your-org-slug
69
+ TURSO_DATABASE=your-database-name
70
+ ```
71
+
72
+ > **Important:** Store `TURSO_DATABASE` as a secret environment variable in Vercel, just like your API token. The API token grants access to your entire Turso organization, so if an attacker can control the database name passed to `createDb()`, they could access any database in your org. By keeping the database name in a secret environment variable, you ensure it cannot be injected or tampered with.
73
+
74
+ ## Quickstart
75
+
76
+ ```ts
77
+ import { createDb } from "@tursodatabase/vercel-experimental";
78
+
79
+ // Get or create a database using the secret database name from environment
80
+ const db = await createDb(process.env.TURSO_DATABASE!);
81
+
82
+ // Create tables
83
+ await db.execute(`
84
+ CREATE TABLE IF NOT EXISTS users (
85
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
86
+ name TEXT NOT NULL,
87
+ email TEXT UNIQUE
88
+ )
89
+ `);
90
+
91
+ // Insert data
92
+ await db.execute(
93
+ "INSERT INTO users (name, email) VALUES (?, ?)",
94
+ ["Alice", "alice@example.com"]
95
+ );
96
+
97
+ // Query data
98
+ const result = await db.query("SELECT * FROM users");
99
+ console.log(result.rows);
100
+ ```
101
+
102
+ ## API Reference
103
+
104
+ ### `createDb(name, options?)`
105
+
106
+ Creates or retrieves a database instance.
107
+
108
+ ```ts
109
+ const db = await createDb(process.env.TURSO_DATABASE!, {
110
+ group: "default", // Database group (optional)
111
+ partialSync: true, // Enable partial sync (optional)
112
+ });
113
+ ```
114
+
115
+ ### `db.query(sql, params?)`
116
+
117
+ Execute a SELECT query and return results.
118
+
119
+ ```ts
120
+ const result = await db.query(
121
+ "SELECT * FROM users WHERE id = ?",
122
+ [1]
123
+ );
124
+
125
+ console.log(result.columns); // ["id", "name", "email"]
126
+ console.log(result.rows); // [[1, "Alice", "alice@example.com"]]
127
+ ```
128
+
129
+ ### `db.execute(sql, params?)`
130
+
131
+ Execute an INSERT, UPDATE, DELETE, or DDL statement.
132
+
133
+ ```ts
134
+ await db.execute(
135
+ "UPDATE users SET name = ? WHERE id = ?",
136
+ ["Bob", 1]
137
+ );
138
+ ```
139
+
140
+ ### `db.push()`
141
+
142
+ Manually push local changes to the remote Turso database.
143
+
144
+ ```ts
145
+ await db.execute("INSERT INTO users (name) VALUES (?)", ["Charlie"]);
146
+ await db.push();
147
+ ```
148
+
149
+ ### `db.pull()`
150
+
151
+ Pull latest changes from the remote Turso database.
152
+
153
+ ```ts
154
+ await db.pull(); // Get latest data from Turso
155
+ ```
156
+
157
+ ## Examples
158
+
159
+ ### Next.js Server Component
160
+
161
+ ```tsx
162
+ import { createDb } from "@tursodatabase/vercel-experimental";
163
+
164
+ async function getUsers() {
165
+ const db = await createDb(process.env.TURSO_DATABASE!);
166
+ const result = await db.query("SELECT * FROM users");
167
+ return result.rows;
168
+ }
169
+
170
+ export default async function UsersPage() {
171
+ const users = await getUsers();
172
+
173
+ return (
174
+ <ul>
175
+ {users.map((user) => (
176
+ <li key={user[0]}>{user[1]}</li>
177
+ ))}
178
+ </ul>
179
+ );
180
+ }
181
+ ```
182
+
183
+ ### Next.js Server Action
184
+
185
+ ```tsx
186
+ import { createDb } from "@tursodatabase/vercel-experimental";
187
+ import { revalidatePath } from "next/cache";
188
+
189
+ async function addUser(formData: FormData) {
190
+ "use server";
191
+
192
+ const name = formData.get("name") as string;
193
+ const db = await createDb(process.env.TURSO_DATABASE!);
194
+
195
+ await db.execute("INSERT INTO users (name) VALUES (?)", [name]);
196
+ await db.push();
197
+
198
+ revalidatePath("/users");
199
+ }
200
+ ```
201
+
202
+ ### API Route
203
+
204
+ ```ts
205
+ import { createDb } from "@tursodatabase/vercel-experimental";
206
+ import { NextResponse } from "next/server";
207
+
208
+ export async function GET() {
209
+ const db = await createDb(process.env.TURSO_DATABASE!);
210
+ const result = await db.query("SELECT * FROM users");
211
+
212
+ return NextResponse.json(result.rows);
213
+ }
214
+
215
+ export async function POST(request: Request) {
216
+ const { name } = await request.json();
217
+ const db = await createDb(process.env.TURSO_DATABASE!);
218
+
219
+ await db.execute("INSERT INTO users (name) VALUES (?)", [name]);
220
+ await db.push();
221
+
222
+ return NextResponse.json({ success: true });
223
+ }
224
+ ```
225
+
226
+ ## Documentation
227
+
228
+ Visit our [official documentation](https://docs.turso.tech) for more details.
229
+
230
+ ## Support
231
+
232
+ Join us [on Discord](https://tur.so/discord-ts) to get help using this SDK. Report security issues [via email](mailto:security@turso.tech).
package/dist/index.d.ts CHANGED
@@ -1,4 +1,27 @@
1
- export { createDb, type CreateDbOptions } from "./createDb.js";
2
- export { VercelDatabase, type QueryResult, type DatabaseOptions } from "./database.js";
3
- export { setWaitUntil, flushAll } from "./flush.js";
1
+ import { type DatabaseOpts } from "@tursodatabase/sync";
2
+ export interface QueryResult {
3
+ columns: string[];
4
+ rows: unknown[][];
5
+ }
6
+ export interface DatabaseOptions {
7
+ partialSync?: boolean;
8
+ bootstrapStrategy?: NonNullable<DatabaseOpts["partialSyncExperimental"]>["bootstrapStrategy"];
9
+ }
10
+ export interface CreateDbOptions extends DatabaseOptions {
11
+ group?: string;
12
+ }
13
+ export declare class TursoDatabase {
14
+ readonly name: string;
15
+ private db;
16
+ private dirty;
17
+ private constructor();
18
+ static open(name: string, localPath: string, url: string, authToken: string, options?: DatabaseOptions): Promise<TursoDatabase>;
19
+ query(sql: string, params?: unknown[]): Promise<QueryResult>;
20
+ execute(sql: string, params?: unknown[]): Promise<void>;
21
+ push(): Promise<void>;
22
+ pull(): Promise<void>;
23
+ close(): Promise<void>;
24
+ }
25
+ export declare function createDb(name: string, options?: CreateDbOptions): Promise<TursoDatabase>;
26
+ export { TursoDatabase as VercelDatabase };
4
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOhF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,yBAAyB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;CAC/F;AAED,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAuBD,qBAAa,aAAa;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,CAAW;IACrB,OAAO,CAAC,KAAK,CAAS;IAEtB,OAAO;WAKM,IAAI,CACf,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,aAAa,CAAC;IAYnB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAW5D,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUvD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAMrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAW7B;AAMD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CA2BxF;AA8DD,OAAO,EAAE,aAAa,IAAI,cAAc,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,155 @@
1
- export { createDb } from "./createDb.js";
2
- export { VercelDatabase } from "./database.js";
3
- export { setWaitUntil, flushAll } from "./flush.js";
1
+ import { join } from "node:path";
2
+ import { tmpdir } from "node:os";
3
+ import { createClient } from "@tursodatabase/api";
4
+ import { connect } from "@tursodatabase/sync";
5
+ import { waitUntil } from "@vercel/functions";
6
+ // ============================================================================
7
+ // State
8
+ // ============================================================================
9
+ const instances = new Map();
10
+ const credentials = new Map();
11
+ const connections = new Set();
12
+ const closeChecks = new Map();
13
+ let apiClient = null;
14
+ let apiClientOrg = null;
15
+ // ============================================================================
16
+ // Database Class
17
+ // ============================================================================
18
+ export class TursoDatabase {
19
+ name;
20
+ db;
21
+ dirty = false;
22
+ constructor(name, db) {
23
+ this.name = name;
24
+ this.db = db;
25
+ }
26
+ static async open(name, localPath, url, authToken, options) {
27
+ const opts = { path: localPath, url, authToken };
28
+ if (options?.partialSync) {
29
+ opts.partialSyncExperimental = {
30
+ bootstrapStrategy: options.bootstrapStrategy ?? { kind: "prefix", length: 128 * 1024 },
31
+ };
32
+ }
33
+ return new TursoDatabase(name, await connect(opts));
34
+ }
35
+ async query(sql, params) {
36
+ const stmt = this.db.prepare(sql);
37
+ try {
38
+ const columns = stmt.columns().map((c) => c.name);
39
+ const rows = await stmt.all(...(params ?? []));
40
+ return { columns, rows: rows.map((row) => Object.values(row)) };
41
+ }
42
+ finally {
43
+ stmt.close();
44
+ }
45
+ }
46
+ async execute(sql, params) {
47
+ const stmt = this.db.prepare(sql);
48
+ try {
49
+ await stmt.run(...(params ?? []));
50
+ this.dirty = true;
51
+ }
52
+ finally {
53
+ stmt.close();
54
+ }
55
+ }
56
+ async push() {
57
+ if (!this.dirty)
58
+ return;
59
+ await this.db.push();
60
+ this.dirty = false;
61
+ }
62
+ async pull() {
63
+ await this.db.pull();
64
+ }
65
+ async close() {
66
+ connections.delete(this);
67
+ closeChecks.get(this)?.();
68
+ closeChecks.delete(this);
69
+ try {
70
+ await this.push();
71
+ }
72
+ finally {
73
+ instances.delete(this.name);
74
+ await this.db.close();
75
+ }
76
+ }
77
+ }
78
+ // ============================================================================
79
+ // Public API
80
+ // ============================================================================
81
+ export function createDb(name, options) {
82
+ const existing = instances.get(name);
83
+ if (existing)
84
+ return existing;
85
+ const promise = initDb(name, options);
86
+ instances.set(name, promise);
87
+ promise.catch(() => instances.delete(name));
88
+ promise.then((db) => {
89
+ connections.add(db);
90
+ waitUntil(new Promise((resolve) => {
91
+ closeChecks.set(db, resolve);
92
+ setTimeout(resolve, 5000);
93
+ }).then(() => {
94
+ closeChecks.delete(db);
95
+ if (connections.has(db)) {
96
+ console.warn(`Database "${db.name}" was not closed. ` +
97
+ "Call db.close() to ensure writes are pushed and errors are surfaced.");
98
+ }
99
+ }));
100
+ });
101
+ return promise;
102
+ }
103
+ // ============================================================================
104
+ // Internals
105
+ // ============================================================================
106
+ async function initDb(name, options) {
107
+ const creds = await ensureDb(name, options?.group);
108
+ const localPath = join(tmpdir(), `${name}.db`);
109
+ return TursoDatabase.open(name, localPath, creds.url, creds.authToken, options);
110
+ }
111
+ async function ensureDb(name, group) {
112
+ const cached = credentials.get(name);
113
+ if (cached)
114
+ return cached;
115
+ const client = getClient();
116
+ let db;
117
+ try {
118
+ db = await client.databases.get(name);
119
+ }
120
+ catch (err) {
121
+ if (isNotFound(err)) {
122
+ db = await client.databases.create(name, { group: group ?? "default" });
123
+ }
124
+ else {
125
+ throw err;
126
+ }
127
+ }
128
+ if (!db?.hostname) {
129
+ throw new Error(`Failed to get hostname for database: ${name}`);
130
+ }
131
+ const token = await client.databases.createToken(name, { authorization: "full-access" });
132
+ const creds = { url: `libsql://${db.hostname}`, authToken: token.jwt };
133
+ credentials.set(name, creds);
134
+ return creds;
135
+ }
136
+ function getClient() {
137
+ const org = requireEnv("TURSO_ORG");
138
+ if (!apiClient || apiClientOrg !== org) {
139
+ apiClient = createClient({ org, token: requireEnv("TURSO_API_TOKEN") });
140
+ apiClientOrg = org;
141
+ }
142
+ return apiClient;
143
+ }
144
+ function requireEnv(name) {
145
+ const value = process.env[name];
146
+ if (!value)
147
+ throw new Error(`${name} environment variable is required`);
148
+ return value;
149
+ }
150
+ function isNotFound(err) {
151
+ return err instanceof Error && "status" in err && err.status === 404;
152
+ }
153
+ // Backwards compatibility alias
154
+ export { TursoDatabase as VercelDatabase };
4
155
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,cAAc,EAA0C,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAoC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAyB9C,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkC,CAAC;AAC5D,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;AACnD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAiB,CAAC;AAC7C,MAAM,WAAW,GAAG,IAAI,GAAG,EAA6B,CAAC;AAEzD,IAAI,SAAS,GAA2C,IAAI,CAAC;AAC7D,IAAI,YAAY,GAAkB,IAAI,CAAC;AAEvC,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,MAAM,OAAO,aAAa;IACf,IAAI,CAAS;IACd,EAAE,CAAW;IACb,KAAK,GAAG,KAAK,CAAC;IAEtB,YAAoB,IAAY,EAAE,EAAY;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,C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IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,mCAAmC,CAAC,CAAC;IACxE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,UAAU,CAAC,GAAY;IAC9B,OAAO,GAAG,YAAY,KAAK,IAAI,QAAQ,IAAI,GAAG,IAAK,GAA0B,CAAC,MAAM,KAAK,GAAG,CAAC;AAC/F,CAAC;AAED,gCAAgC;AAChC,OAAO,EAAE,aAAa,IAAI,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tursodatabase/vercel-experimental",
3
- "version": "0.0.2",
4
- "description": "Turso database integration for Vercel Functions.",
3
+ "version": "0.0.4",
4
+ "description": "Zero-config SQLite databases for Vercel Functions.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -24,16 +24,9 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@tursodatabase/api": "^1.9.0",
27
- "@tursodatabase/sync": "^0.5.0-pre.5"
28
- },
29
- "peerDependencies": {
27
+ "@tursodatabase/sync": "^0.5.0-pre.5",
30
28
  "@vercel/functions": "^1.0.0"
31
29
  },
32
- "peerDependenciesMeta": {
33
- "@vercel/functions": {
34
- "optional": true
35
- }
36
- },
37
30
  "devDependencies": {
38
31
  "@types/node": "^20.0.0",
39
32
  "typescript": "^5.0.0"