Serverless API with Cloudflare Workers (Hono, D1 & Drizzle ORM)

  Рет қаралды 25,958

CodeBrew

CodeBrew

Күн бұрын

Пікірлер: 68
@dova5944
@dova5944 8 ай бұрын
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!
@cdbrw
@cdbrw 8 ай бұрын
Thanks your comment made my day 🙏 the goal is to make each video better than the last so hopefully its only up from here
@technoM4niac
@technoM4niac 9 ай бұрын
Im glad to be early for the next big upcoming tech youtuber. Thanks for adding comments to your examples, helps to follow along 😎😎😎
@cdbrw
@cdbrw 9 ай бұрын
Thanks, yea I figure I should add more comments to the videos 🤔
@cas818028
@cas818028 9 ай бұрын
That cold start was brutal
@cdbrw
@cdbrw 9 ай бұрын
after the first deploy?
@journeyofc6200
@journeyofc6200 7 ай бұрын
wtf are you talking about?
@ustav_o
@ustav_o 8 ай бұрын
that might've been the best tutorial i've ever seen
@cdbrw
@cdbrw 8 ай бұрын
thanks 🫶
@juniorxInnovationAcademy
@juniorxInnovationAcademy 7 ай бұрын
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
@abdulraheem_codes
@abdulraheem_codes 5 ай бұрын
Aboslute Beast, Since i have startred learning about cloudflare, i am just binge-watching your cloudflare content
@cdbrw
@cdbrw 5 ай бұрын
This is awesome, thank you 🙏 have more cloudflare stuff on the way 😉
@Next-Js
@Next-Js Ай бұрын
I would appreciate more videos integrating nextjs with cloudflare, d1..r2..images etc.
@rafamuttoni
@rafamuttoni 9 ай бұрын
Great video, man! Thanks for making it.
@cdbrw
@cdbrw 9 ай бұрын
Thanks for watching, glad you found it useful 🙏
@yuhapps6758
@yuhapps6758 4 ай бұрын
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.
@cdbrw
@cdbrw 4 ай бұрын
🥹🥹
@MohsenFarajYT
@MohsenFarajYT Ай бұрын
I didn't know you could use drizzle for cloudflare. This makes things really easier. Thanks!
@phantazzor
@phantazzor Күн бұрын
how to copy over local data to remote ... on d1 , I have been trying many things but I always copy 0 rows
@VSIMadeIt
@VSIMadeIt 9 ай бұрын
Intersted in seeing something like this with Turso instead of D1.
@cdbrw
@cdbrw 9 ай бұрын
Noted, will work on the video soon 🫡
@YouCan-wu2so
@YouCan-wu2so 5 ай бұрын
Dude thank you!. Your video helped me solve an issue I had trying to use D1 locally.
@rafalk0
@rafalk0 9 ай бұрын
Awesome video! What's that VS Code db plugin you're using?
@cdbrw
@cdbrw 9 ай бұрын
Thanks! Its just called "Database Client", I think its one of the more popular ones
@IanMathaiya
@IanMathaiya 8 ай бұрын
What are you using to highlight the errors like that 7:17?
@cdbrw
@cdbrw 8 ай бұрын
Its a vscode extension called "Error Lens"
@ayushrameja
@ayushrameja 9 ай бұрын
Great video 🌟
@cdbrw
@cdbrw 9 ай бұрын
thank you 🙏
@emilzonjeronimo8898
@emilzonjeronimo8898 2 ай бұрын
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.
@ElenaBG3
@ElenaBG3 12 сағат бұрын
Saved🎉
@void-deus
@void-deus 2 ай бұрын
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 ?
@hardikpatel5286
@hardikpatel5286 3 ай бұрын
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?
@tuannguyenanh7466
@tuannguyenanh7466 2 ай бұрын
Thank you so much
@adityaparghi-j8e
@adityaparghi-j8e 3 ай бұрын
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
@hardikpatel5286
@hardikpatel5286 3 ай бұрын
Which database extension are you using to connect sqlite file?
@flakybuild
@flakybuild 8 ай бұрын
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?
@cdbrw
@cdbrw 8 ай бұрын
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 🤔
@IkromAuliaFahdi
@IkromAuliaFahdi 3 ай бұрын
have you create unit testing use hono? I have struggle with it
@2u841r
@2u841r 4 ай бұрын
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
@DudexChannel
@DudexChannel 3 ай бұрын
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: "" },
@2u841r
@2u841r 3 ай бұрын
@@DudexChannel yeah, that what i write in previous comment
@juancarlosmamanirojas865
@juancarlosmamanirojas865 6 ай бұрын
thanks for the video, What is the extension for database connection?
@cdbrw
@cdbrw 5 ай бұрын
Its called "Database Client" by Weijan Chen
@4115steve
@4115steve 8 ай бұрын
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.
@cdbrw
@cdbrw 8 ай бұрын
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 👀
@samijuniorkahil7914
@samijuniorkahil7914 9 ай бұрын
does drizzle create a new connection to the db on every request?
@cdbrw
@cdbrw 9 ай бұрын
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.
@samijuniorkahil7914
@samijuniorkahil7914 9 ай бұрын
@@cdbrw ah that makes sense
@illzcodes
@illzcodes 8 ай бұрын
Have you figured out how to get drizzle studio to run? I keep getting an error even though my setup is exactly like this.
@cdbrw
@cdbrw 8 ай бұрын
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
@jacobtb1
@jacobtb1 9 ай бұрын
amazing vid, thanks
@cdbrw
@cdbrw 9 ай бұрын
glad you found it useful 🙏
@adityacodes
@adityacodes 3 ай бұрын
which theme is this?
@fra4897
@fra4897 9 ай бұрын
how to have multiple routes in multiple files?
@cdbrw
@cdbrw 9 ай бұрын
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!
@fra4897
@fra4897 9 ай бұрын
@@cdbrw Thank you so much :)
@roco9393
@roco9393 5 ай бұрын
​@@cdbrw I luv u 😘, excellent explanation
@DBDCheeto
@DBDCheeto 7 ай бұрын
that was good
@PeterZhou-vi3ep
@PeterZhou-vi3ep 9 ай бұрын
d1 is great, but it doesn't support transactions
@cdbrw
@cdbrw 9 ай бұрын
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
@iogilarb
@iogilarb 8 ай бұрын
cloudflare?
@cdbrw
@cdbrw 8 ай бұрын
cloudflare.
@patrickjreid
@patrickjreid 6 ай бұрын
I got to say, with all the cloudflare news lately I would avoid anything they do with every fiber of my being.
@everistusolumese9350
@everistusolumese9350 6 ай бұрын
That is just your opinion.
@bambanx
@bambanx 3 ай бұрын
Why you say that? Ty
Serverless With HTMX & Cloudflare Workers
7:59
CodeBrew
Рет қаралды 2,9 М.
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
The Cloudflare Stack
13:26
Cloudflare Developers
Рет қаралды 21 М.
Is Hono the holy grail of web frameworks?
18:33
AJ Stuyvenberg
Рет қаралды 14 М.
Streamlining Schema Management with Drizzle ORM & Cloudflare D1
9:15
backpine labs
Рет қаралды 2,8 М.
Build a Production-Grade API with HonoJS, Cloudflare, Upstash (2024)
1:04:21
Josh tried upstash
Рет қаралды 13 М.