This is a proof of concept using drizzle-orm with electric-sql.
The structure of the project is as follows:
- A code generator for drizzle in
apps/electric_drizzle-generator
- A small react library in
libs/electric-drizzle-react
- An example with nextjs in
apps/electric_drizzle
- Code generator that outputs a reasonable amount of code and is also readable
- No coupling between server orm and client drizzle code
- Basic drizzle queries work (select, insert, update, delete)
- Relational queries work
- live queries work, relation and normal ones
- no special datatype handling (bool to int version, date versions etc)
- some gaps in the typing for relational queries
- code in a rough state, just a proof of concept
- relation are all interpreted as one to many
- "UI" really basic
- relational query not updating, seems like an electric bug not working with sub queries
yarn
docker compose start
docker compose -f apps/electric-drizzle/backend/docker-compose.yml up -d
Run the migrations
npx nx run electric-drizzle:migrate
Start next dev server
npx nx run electric-drizzle:serve:development
App should be available at http://localhost:4200
npx nx run electric-drizzle-generator:run