-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
- Accepted Date: 2025-10-26
- Reference Issues/Discussions: Change DB Client to a more dynamic alternative Kysely #7
- Author: @Adammatthiesen
- Champion(s): @Adammatthiesen
- Implementation PRs:
- Getting Started: Kysely Project Stage 1 studiocms#963
- Implementing new SDK: Implement new Kysely SDK studiocms#1029
Summary
Migrate StudioCMS from AstroDB to Kysely with new custom packages for handling.
Background & Motivation
Currently we rely on AstroDB and drizzle-orm, which in their current configuration has some minor issues, but even once it technically supports multiple dialects there would be the issue of slight difference in the resulting drizzle client between dialects. This will make it difficult to properly support AstroDB once user's will be able to swap out their driver (since each table would need a different schema based on the current dialect).
Kysely on the other-hand, has support for all the same db dialects but with a single unified interface to work with that supports many different dialects with easy switching during initialization. Kysely also has a fairly similar interface but without all the extra helper imports needed to build a db query.
Goals
- Introduce a new
@withstudiocmsscoped package that will include:- Kysely interfaces
- shared public DB types and helpers
- Migration and schema utilities
- Utilize Effect for basic operations
- Implement CLI to manage migrations/db initialization in StudioCMS
- Pull migrations and schemas from shared package
- Implement DB Client and replace drizzle-orm in StudioCMS SDK and CLI
- Utilize utils & types from shared package
- Will allow us to overhaul the current SDK and replace it with a even more dynamic system
Non-Goals
- We could support more than just sqlite/libsql quickly
- If this goes, we would be able to skip a bunch of steps towards leaving beta versioning.