Skip to content

integrate database #7

@ryanatkn

Description

@ryanatkn

#6 adds the proof of concept but until there's a database backing it, realworld utility will be very limited.

Postgres has been my preferred db for a long time, and pglite seems like it could give us the best of both worlds - an embeddable db for browser usage and easy deployment, and the same API if you want to connect a full Postgres server, or one of its many cloud formations. For now browser usage is not a priority for me, and it won't be in the initial implementation, but it will be very useful in the future.

I haven't used Drizzle but it's what I see recommended the most among Svelte users. Previously I've just used postgres and a small migration lib, and Drizzle looks like it strikes a balance I like with SQL and it can be used with postgres. See also drizzle-zod. I did some benchmarks -- https://github.com/ryanatkn/sql-js-benchmarks/blob/main/results/output.md -- my current takeaway is that I'll make a thin wrapper around @electric-sql/pglite and pg's drivers due to the apparent costs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions