Im trying to build a multi-tenant inventory and small business records management system on Cloudflare. I really hope it doesnt let me down. Thanks for this video and the one you did after this adding in Lucia. They've been really helpful
You are the man man man. I like you man. I like you a lot. Your video is exactly what I need right now. Oh my eyes are full of tears. Thank you so much.
Dejo like , gracias compa , estaré siguiendo tu canal ,,espero mas material asi , me gusta como funciona todo este entorno , podrias mostrar como subir archivos etc ?
Awesome video. Thank you. I have a question. For every end point, i am create drizzle object. drizzle(c.env.DB). Is there any way to create drizzle object only at one place and reuse?
npm run db:generate This command is deprecated, please use updated 'generate' command (and a link) so you have to remove :sqlite (from generate:sqlite and up:sqlite from the file package.json) and add "dialect": "sqlite", in drizzle.config.json
What about migrations in a CD pipeline? Handle the migrations manually with " bunx wrangler d1 execute --remote file= " does not seem to be the best approach. And the command provided by drizzle to apply migrations doesnt work because it doesnt use a DATABASE_URL variable.
Great video 👌 Would you know a good way to run all of the pending migrations with drizzle in D1 so that one doesn't need to always explicitly specify them?
I've actually been thinking about this and maybe I'll make a video on it once I figure it out. Check out this GitHub thread: github.com/drizzle-team/drizzle-orm/discussions/1388 I haven't tried the above so I can't say if it will work. The other idea I've been playing around with is using the bun shell to write a script which will execute each one by one. Will see if I can get anywhere with these 🤔
Hello can anyone please answer this, when i run npm create cloudflare --name and i select cloudflare workers , typescript, deploy no and when i go to vs code and run npm run dev it throws error errono -4095 i done everything uninstall Wrangler, install it again but it just doesn't work how can resolve this if anyone help
I'm still waiting for a better way to allow for this. Basically as of right now the only way to really do this is to split up your drizzle config into a local version and a cloudflare version but I'll wait on a more official implementation. If you're looking to get it working right now though, I recommend going through this thread and checking out the blog posts aswell: github.com/drizzle-team/drizzle-orm/discussions/1545
Since Cloudflare D1 is a serverless database, it doesn't require a persistent connection like a traditional database. You interact with it using HTTP-based APIs or through the D1 bindings available in Cloudflare Workers which eliminates the need for connection pooling and simplifies the handling of database operations. Drizzle just abstracts all these interactions for us and makes sure all operations are self-contained, without having to rely on persistent connections or stateful sessions.
If let's say you had a `users` api and you wanted to split that up into its own router file, you would create it in lets say a users.ts file then create the router like so: const users = new Hono(); You then add whatever routes you want to it and export users at the bottom of the file. Now in your main index.ts, all you have to do is just import users and then: const api = new Hono(); api.route('/users', users); Hope this helps!
Yea theres certain things like that where it shows its still very early days and not quite production ready yet but I still think overall it has the potential be really good
I didn't know you could use drizzle for cloudflare. This makes things really easier. Thanks!
Awesome video man, from the quality of this video I would have never guessed this is such a small channel. Keep up the good work!
Thanks your comment made my day 🙏 the goal is to make each video better than the last so hopefully its only up from here
Im glad to be early for the next big upcoming tech youtuber. Thanks for adding comments to your examples, helps to follow along 😎😎😎
Thanks, yea I figure I should add more comments to the videos 🤔
Im trying to build a multi-tenant inventory and small business records management system on Cloudflare. I really hope it doesnt let me down. Thanks for this video and the one you did after this adding in Lucia. They've been really helpful
that might've been the best tutorial i've ever seen
thanks 🫶
That cold start was brutal
after the first deploy?
wtf are you talking about?
Aboslute Beast, Since i have startred learning about cloudflare, i am just binge-watching your cloudflare content
This is awesome, thank you 🙏 have more cloudflare stuff on the way 😉
You are the man man man. I like you man. I like you a lot. Your video is exactly what I need right now. Oh my eyes are full of tears. Thank you so much.
🥹🥹
Great video, man! Thanks for making it.
Thanks for watching, glad you found it useful 🙏
Dejo like , gracias compa , estaré siguiendo tu canal ,,espero mas material asi , me gusta como funciona todo este entorno , podrias mostrar como subir archivos etc ?
Awesome video! What's that VS Code db plugin you're using?
Thanks! Its just called "Database Client", I think its one of the more popular ones
Intersted in seeing something like this with Turso instead of D1.
Noted, will work on the video soon 🫡
Dude thank you!. Your video helped me solve an issue I had trying to use D1 locally.
Awesome video. Thank you. I have a question.
For every end point, i am create drizzle object. drizzle(c.env.DB). Is there any way to create drizzle object only at one place and reuse?
Thank you so much
npm run db:generate
This command is deprecated, please use updated 'generate' command (and a link)
so you have to remove :sqlite (from generate:sqlite and up:sqlite from the file package.json)
and add "dialect": "sqlite", in drizzle.config.json
create a drizzle.config.ts file with the content export default defineConfig({
schema: "src/db/schema.ts",
out: "drizzle/migrations",
dialect: "sqlite", // "postgresql" | "mysql"
dbCredentials: {
url: ""
},
@@DudexChannel yeah, that what i write in previous comment
Which database extension are you using to connect sqlite file?
What about migrations in a CD pipeline? Handle the migrations manually with " bunx wrangler d1 execute --remote file= " does not seem to be the best approach. And the command provided by drizzle to apply migrations doesnt work because it doesnt use a DATABASE_URL variable.
Great video 🌟
thank you 🙏
Great video 👌 Would you know a good way to run all of the pending migrations with drizzle in D1 so that one doesn't need to always explicitly specify them?
I've actually been thinking about this and maybe I'll make a video on it once I figure it out. Check out this GitHub thread: github.com/drizzle-team/drizzle-orm/discussions/1388
I haven't tried the above so I can't say if it will work. The other idea I've been playing around with is using the bun shell to write a script which will execute each one by one. Will see if I can get anywhere with these 🤔
have you create unit testing use hono? I have struggle with it
thanks for the video, What is the extension for database connection?
Its called "Database Client" by Weijan Chen
amazing vid, thanks
glad you found it useful 🙏
Hello can anyone please answer this, when i run npm create cloudflare --name and i select cloudflare workers , typescript, deploy no and when i go to vs code and run npm run dev it throws error errono -4095 i done everything uninstall Wrangler, install it again but it just doesn't work how can resolve this if anyone help
that was good
what other databases like d1 deploy to the edge? This seems like the best stack for a web app that uses edge with D1 and workers.
There’s also Turso for sqlite and Neon for postgres. I’m sure there’s other ones too. Check out the video I made on Turso if you’re interested 👀
Have you figured out how to get drizzle studio to run? I keep getting an error even though my setup is exactly like this.
I'm still waiting for a better way to allow for this. Basically as of right now the only way to really do this is to split up your drizzle config into a local version and a cloudflare version but I'll wait on a more official implementation.
If you're looking to get it working right now though, I recommend going through this thread and checking out the blog posts aswell: github.com/drizzle-team/drizzle-orm/discussions/1545
What are you using to highlight the errors like that 7:17?
Its a vscode extension called "Error Lens"
which theme is this?
does drizzle create a new connection to the db on every request?
Since Cloudflare D1 is a serverless database, it doesn't require a persistent connection like a traditional database. You interact with it using HTTP-based APIs or through the D1 bindings available in Cloudflare Workers which eliminates the need for connection pooling and simplifies the handling of database operations.
Drizzle just abstracts all these interactions for us and makes sure all operations are self-contained, without having to rely on persistent connections or stateful sessions.
@@cdbrw ah that makes sense
how to have multiple routes in multiple files?
If let's say you had a `users` api and you wanted to split that up into its own router file, you would create it in lets say a users.ts file then create the router like so:
const users = new Hono();
You then add whatever routes you want to it and export users at the bottom of the file. Now in your main index.ts, all you have to do is just import users and then:
const api = new Hono();
api.route('/users', users);
Hope this helps!
@@cdbrw Thank you so much :)
@@cdbrw I luv u 😘, excellent explanation
d1 is great, but it doesn't support transactions
Yea theres certain things like that where it shows its still very early days and not quite production ready yet but I still think overall it has the potential be really good
cloudflare?
cloudflare.
I got to say, with all the cloudflare news lately I would avoid anything they do with every fiber of my being.
That is just your opinion.
Why you say that? Ty