Skip to content

Commit b270472

Browse files
committed
docs: add readme for postgres-new next project
1 parent 8916b7a commit b270472

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

apps/postgres-new/README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,32 @@
22

33
In-browser Postgres sandbox with AI assistance. Built on Next.js.
44

5+
## Architecture
6+
7+
We use PGlite for 2 purposes:
8+
9+
1. A "meta" DB that keeps track of all of the user databases along with their message history
10+
2. A "user" DB for each database the user creates along with whatever tables/data they've created
11+
12+
Both databases are stored locally in the browser via IndexedDB. This means that these databases are not persisted to the cloud and cannot be accessed from multiple devices (though this is on the roadmap).
13+
14+
Every PGlite instance runs in a Web Worker so that the main thread is not blocked.
15+
16+
## AI
17+
18+
The AI component is powered by OpenAI's GPT-4o model. The project uses [Vercel's AI SDK ](https://sdk.vercel.ai/docs/introduction) to simplify message streams and tool calls.
19+
20+
## Authentication
21+
22+
Because LLMs cost money, a lightweight auth wall exists to prevent abuse. It is currently only used to validate that the user has a legitimate GitHub account, but in the future it could be used to save private/public databases to the cloud.
23+
24+
Authentication and users are managed by a [Supabase](https://supabase.com/) database. You can find the migrations and other configuration for this in the root [`./supabase`](../../supabase/) directory.
25+
526
## Development
627

7-
1. Install deps:
28+
From this directory (`./apps/postgres-new`):
29+
30+
1. Install dependencies:
831
```shell
932
npm i
1033
```

0 commit comments

Comments
 (0)