Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why ./src/lib/server/db as the default path for drizzle? #185

Open
garysassano opened this issue Oct 20, 2024 · 2 comments
Open

Why ./src/lib/server/db as the default path for drizzle? #185

garysassano opened this issue Oct 20, 2024 · 2 comments

Comments

@garysassano
Copy link

First time I see this ./src/lib/server path. Was it used for anything else before? Also this path looks quite lengthy, not ideal in my opinion.

Why not simply use ./src/db as the default path for drizzle and also set up a $db alias in the SvelteKit config?

@manuel3108
Copy link
Member

I'm sure @AdrianGonz97 will share his intention behind that, but personally I do think that this path is quite accurate.

Besides the path you suggest, there are probably at least a thousand different suggestions that are all viable. The goal here is to get you up and running quickly with that new integration. In my opinion, adding a custom alias for db is easy and prevents the cli from supporting many different use cases and patterns.

@AdrianGonz97
Copy link
Member

These modules were added to the src/lib/server directory as we want them to be server-only modules. Generally, you don't want to execute DB queries outside of the server. Putting the DB related modules into a server directory ensures just that - if you try to import them anywhere in the client, SvelteKit will throw a helpful error to tell you that you shouldn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants