Writing Cron Jobs Just Became Fun Again

  Рет қаралды 10,680

Web Dev Cody

Web Dev Cody

Ай бұрын

Be sure to checkout convex.dev/c/wdc which is the sponsor of this video, and convex is the backend as a service I use for project planner ai. I highly recommend trying it out!
My Products
📖 ProjectPlannerAI: projectplannerai.com
🤖 IconGeneratorAI: icongeneratorai.com
📝 ThumbnailCritique: thumbnailcritique.com
Useful Links
💬 Discord: / discord
🔔 Newsletter: newsletter.webdevcody.com/
📁 GitHub: github.com/webdevcody
📺 Twitch: / webdevcody
🤖 Website: webdevcody.com
🐦 Twitter: / webdevcody

Пікірлер: 48
@anthonygg_
@anthonygg_ Ай бұрын
Stop reminding me that I need to finish my projects. Low key I like this feature A LOT. Keep pumping those amazing features!
@WebDevCody
@WebDevCody Ай бұрын
Thanks man!
@koachbryan
@koachbryan Ай бұрын
Grammar police but, The title of that email says "You're friendly reminder".. should be Your friendly reminder
@WebDevCody
@WebDevCody Ай бұрын
Thanks! I’ll fix that when I get a chance 🤣
@bastin.5854
@bastin.5854 Ай бұрын
I've developed something similar using AWS Scheduler. It also provides a cron job and implements exponential backoff. Worked great as well!
@cas818028
@cas818028 Ай бұрын
Same
@yassinesafraoui
@yassinesafraoui Ай бұрын
The way you implemented this is quite interesting, at first I thought whenver a user visits a plan I add a cron job to run after 7 days to remind the user and I cancel the previously added cron jobs, I think this way would be good to allow users to customize how often they want to be reminded, but as I have more and more active users this number of created cron jobs will blow up
@Stallion45
@Stallion45 Ай бұрын
Love these Convex project videos and I’m still working on rethinking my design process to fit into Convex. Have you done any videos regarding form submission with Convex? Coming from my current project of react hook forms, zod validation , and server actions with Prisma I’m curious what the best approach to form submission and validation is on the Convex end prior to data mutation functions? I validate forms on the front end, but I struggle with trusting the data received by my Convex mutation functions…, or am I overthinking things?
@WebDevCody
@WebDevCody Ай бұрын
Depending on the data you save, you still may need to bring in zod to your convex mutation to verify a v.string() is in certain format, etc. I still use use form hook with zod for client side forms
@lakitu3624
@lakitu3624 Ай бұрын
You could add the reminders enabled check to the db query to prevent having to filter those out in js. Should be slightly better in case there are a lot of plans that have a matching timestamp
@WebDevCody
@WebDevCody Ай бұрын
Yeah that could help with db query performance, but feels like a premature optimization until I reach thousands of user projects.
@lakitu3624
@lakitu3624 Ай бұрын
Yeah that's fair enough
@feossandon
@feossandon Ай бұрын
Very nice workflow :O Is it possible to perform SSR query fetching without using client useQuery to reduce requests and revalidate with Next.js when necessary? btw. did Convex reduce its bandwidth in the free tier? :/
@WebDevCody
@WebDevCody Ай бұрын
Yes convex has a method to fetch the data in a SSR RSC and pass it down as initial props to your useQuery
@patolorde
@patolorde Ай бұрын
What happened to clean architecture pantry project
@marcoio8742
@marcoio8742 Ай бұрын
Interesting. I have a small problem with this architecture though. I am sure that you considered the numbers for your particular case and this is fine, but this model doesn't scale. First of all, you query the database daily at 9am which potentially might return a very large result object. You load it entirely to memory and don't use pagination, but the probability that the projects become a lot, like over 1mil is out of the question so this is fine. But the second thing is the queue turnover time of 200ms to send emails. If you have a list of 10k projects that needs to be reminded (it is fair I guess) you are looking at a time of execution of your cron job of 2k seconds. Which is not too long (it's like 30 mins) but you get my point. My question in this case is why did you for an external service like Resend, when you could use a native nodemailer for instance, considering you are using your email to send emails?
@WebDevCody
@WebDevCody Ай бұрын
These are all great points, but I’m not at scale so I don’t spend time architecting for scale. I will say resend has a bulk send method where I can batch 100 emails at a time which could help speed up this process. Using nodemailer would require setting up or using an existing smtp server (more time to setup) and using gmail to send emails has various limits in place. Sending from resend often gives higher guarantees that my emails will never go to junk mail and additionally they have a nice feature where I can send marketing emails directly to my users mailing list and has built in unsubscribing functionality.
@rodjenihm
@rodjenihm Ай бұрын
When he has 10k customer he will be making enough money to hire Rust specialist to rewrite it scalable.
@WebDevCody
@WebDevCody Ай бұрын
@@rodjenihm convex is written in rust, so I think I’m good on the api and database side of things
@jovanjevtic1620
@jovanjevtic1620 Ай бұрын
Why didn't you filter the plans by remindersEnabled right away in the query?
@WebDevCody
@WebDevCody Ай бұрын
That’s an option. It sounds more like a premature optimization don’t you think?
@hazemturki
@hazemturki Ай бұрын
Wouldn't it make sense to query all the data at once. And send the emails in bulk (1000 batches)?
@WebDevCody
@WebDevCody Ай бұрын
Absolutely 😅 I forgot resend has a resend.batch.send method. But, the api still has 10 requests per second rate limit, so even if sending batches of 100 (which is their max batch size), you’ll need to handle rate limiting the same approach
@sincethatmoment
@sincethatmoment Ай бұрын
that thumbnail is funny af
@oscdev
@oscdev Ай бұрын
Awesome stuff!
@SeibertSwirl
@SeibertSwirl Ай бұрын
Good job bub!!!❤
@abdirahmann
@abdirahmann Ай бұрын
i cant sign up on project planner ai with throwaays emails! why?? how can i check out the app??
@WebDevCody
@WebDevCody Ай бұрын
make a throw away email on gmail instead of some random throw away email service
@gilneyn.mathias1134
@gilneyn.mathias1134 Ай бұрын
this is why i like Laravel too, so much is already there, ready for use 👍
@JohnFarrellDev
@JohnFarrellDev Ай бұрын
Small thing, your subject starts with "You're friendly reminder" when it should be "Your friendly reminder".
@CookerSingh
@CookerSingh Ай бұрын
A day without web dev cody videos is just a normal day 😝. Have you used SSEs in your project, i would love to see where you used them as i am getting some trouble while setting up in mine.
@WebDevCody
@WebDevCody Ай бұрын
I’ve used them once a long time ago. Convex uses websockets for all the real-time updates, so the need to write SSE goes away
@ESArnau
@ESArnau Ай бұрын
Small typo in your email: You're friendly reminder -> Your friendly reminder. GOod vid btw
@WebDevCody
@WebDevCody Ай бұрын
Oppps thank you!
@Nurof3n_
@Nurof3n_ Ай бұрын
@@WebDevCody also miniutes -> minutes
@alexandrepereira6522
@alexandrepereira6522 Ай бұрын
@@WebDevCody Another typo "30 miniutes" a day
@WebDevCody
@WebDevCody Ай бұрын
@@alexandrepereira6522 y’all are the best
@MrArod1207
@MrArod1207 Ай бұрын
More convex tutorials please!
@fottymutunda6320
@fottymutunda6320 Ай бұрын
What's that nice vs code theme?
@WebDevCody
@WebDevCody Ай бұрын
Bearded theme stained blue
@Vicseverin
@Vicseverin Ай бұрын
Came to KZbin to search best way to build email templates in React but decided to watch your video first, turns out…
Serverless might bankrupt you (and how to deploy to a VPS instead)
14:26
17 New JavaScript Projects for Beginners [Full Course]
4:53:27
Code With Bubb
Рет қаралды 17 М.
1 класс vs 11 класс (неаккуратность)
01:00
Omega Boy Past 3 #funny #viral #comedy
00:22
CRAZY GREAPA
Рет қаралды 36 МЛН
The delivery rescued them
00:52
Mamasoboliha
Рет қаралды 7 МЛН
CrewAI Tutorial for Beginners: Learn How To Use Latest CrewAI Features
35:06
Testcontainers have forever changed the way I write tests
12:11
Dreams of Code
Рет қаралды 105 М.
Interview With A Sr JavaScript Dev | Prime Reacts
24:43
ThePrimeTime
Рет қаралды 161 М.
Pretty much every website uses the wrong font size…
15:33
Theo - t3․gg
Рет қаралды 62 М.
I'm now VPS red pilled (and protecting with CloudFlare)
8:12
Web Dev Cody
Рет қаралды 31 М.
Cron Jobs For Beginners | Linux Task Scheduling
12:47
Akamai Developer
Рет қаралды 218 М.
JavaScript Visualized - Event Loop, Web APIs, (Micro)task Queue
12:35
You might not need useEffect() ...
21:45
Academind
Рет қаралды 147 М.
Solid Programming - No Thanks
32:00
ThePrimeTime
Рет қаралды 230 М.