Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 5e205cf

Browse files
jog1tNathanFlurry
authored andcommitted
feat: sqlite
1 parent 69062e3 commit 5e205cf

File tree

43 files changed

+1545
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1545
-173
lines changed

examples/counter/scripts/connect.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/// <reference types="node" />
22
import { createClient } from "@rivetkit/worker/client";
3-
import type { Registry } from "../workers/registry";
3+
import type { Registry } from "../src/workers/registry";
44

55
async function main() {
6-
const client = createClient<Registry>(process.env.ENDPOINT ?? "http://localhost:6420");
6+
const client = createClient<Registry>(
7+
process.env.ENDPOINT ?? "http://127.0.0.1:8080",
8+
);
79

8-
const counter = client.counter.connect()
10+
const counter = (await client.counter.getOrCreate()).connect();
911

1012
counter.on("newCount", (count: number) => console.log("Event:", count));
1113

examples/drizzle/.env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DB_FILE_NAME=file:local.db

examples/drizzle/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Hono Integration for RivetKit
2+
3+
Example project demonstrating Hono web framework integration with [RivetKit](https://rivetkit.org).
4+
5+
[Learn More →](https://github.com/rivet-gg/rivetkit)
6+
7+
[Discord](https://rivet.gg/discord)[Documentation](https://rivetkit.org)[Issues](https://github.com/rivet-gg/rivetkit/issues)
8+
9+
## Getting Started
10+
11+
### Prerequisites
12+
13+
- Node.js
14+
15+
### Installation
16+
17+
```sh
18+
git clone https://github.com/rivet-gg/rivetkit
19+
cd rivetkit/examples/hono
20+
npm install
21+
```
22+
23+
### Development
24+
25+
```sh
26+
npm run dev
27+
```
28+
29+
Open your browser to http://localhost:3000 to see the Hono server with RivetKit integration.
30+
31+
## License
32+
33+
Apache 2.0

examples/drizzle/drizzle.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineConfig } from "@rivetkit/db/drizzle";
2+
3+
export default defineConfig({
4+
out: "./drizzle",
5+
schema: "./src/db/schema.ts",
6+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE `users_table` (
2+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
3+
`name` text NOT NULL,
4+
`age` integer NOT NULL,
5+
`email` text NOT NULL
6+
);
7+
--> statement-breakpoint
8+
CREATE UNIQUE INDEX `users_table_email_unique` ON `users_table` (`email`);
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"version": "6",
3+
"dialect": "sqlite",
4+
"id": "22f3d49c-97d5-46ca-b0f1-99950c3efec7",
5+
"prevId": "00000000-0000-0000-0000-000000000000",
6+
"tables": {
7+
"users_table": {
8+
"name": "users_table",
9+
"columns": {
10+
"id": {
11+
"name": "id",
12+
"type": "integer",
13+
"primaryKey": true,
14+
"notNull": true,
15+
"autoincrement": true
16+
},
17+
"name": {
18+
"name": "name",
19+
"type": "text",
20+
"primaryKey": false,
21+
"notNull": true,
22+
"autoincrement": false
23+
},
24+
"age": {
25+
"name": "age",
26+
"type": "integer",
27+
"primaryKey": false,
28+
"notNull": true,
29+
"autoincrement": false
30+
},
31+
"email": {
32+
"name": "email",
33+
"type": "text",
34+
"primaryKey": false,
35+
"notNull": true,
36+
"autoincrement": false
37+
}
38+
},
39+
"indexes": {
40+
"users_table_email_unique": {
41+
"name": "users_table_email_unique",
42+
"columns": [
43+
"email"
44+
],
45+
"isUnique": true
46+
}
47+
},
48+
"foreignKeys": {},
49+
"compositePrimaryKeys": {},
50+
"uniqueConstraints": {},
51+
"checkConstraints": {}
52+
}
53+
},
54+
"views": {},
55+
"enums": {},
56+
"_meta": {
57+
"schemas": {},
58+
"tables": {},
59+
"columns": {}
60+
},
61+
"internal": {
62+
"indexes": {}
63+
}
64+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "7",
3+
"dialect": "sqlite",
4+
"entries": [
5+
{
6+
"idx": 0,
7+
"version": "6",
8+
"when": 1750711614205,
9+
"tag": "0000_wonderful_iron_patriot",
10+
"breakpoints": true
11+
},
12+
{
13+
"idx": 1,
14+
"version": "6",
15+
"when": 1750716663518,
16+
"tag": "0001_rich_susan_delgado",
17+
"breakpoints": true
18+
}
19+
]
20+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import journal from './meta/_journal.json';
2+
import m0000 from './0000_wonderful_iron_patriot.sql';
3+
4+
export default {
5+
journal,
6+
migrations: {
7+
m0000,
8+
}
9+
}
10+

examples/drizzle/hooks.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export async function load(url, context, nextLoad) {
2+
if(url.endsWith('.sql')) {
3+
return {
4+
shortCircuit: true,
5+
format: 'module',
6+
source: `export default 'SQL file loaded from ${url}';`
7+
}
8+
}
9+
return nextLoad(url, context)
10+
}

examples/drizzle/package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "example-sqlite",
3+
"version": "0.9.0-rc.1",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "tsx --watch src/server.ts",
8+
"check-types": "tsc --noEmit"
9+
},
10+
"devDependencies": {
11+
"@types/node": "^22.13.9",
12+
"rivetkit": "workspace:*",
13+
"tsx": "^3.12.7",
14+
"typescript": "^5.5.2"
15+
},
16+
"dependencies": {
17+
"@rivetkit/db": "workspace:0.9.0-rc.1",
18+
"drizzle-kit": "^0.31.2",
19+
"drizzle-orm": "^0.44.2"
20+
},
21+
"example": {
22+
"platforms": [
23+
"*"
24+
]
25+
},
26+
"stableVersion": "0.8.0"
27+
}

0 commit comments

Comments
 (0)