These requirements can be deceivingly complex, to “show stopper” if you aren’t used to managing things done over time. As most tutorials, and curriculum (like freeCodeCamp) usually go over “user event driven” setups, where the user does something (creates something), and that goes through the “whole stack”.
In this case, you actually have another flow. Namely the reminder email sent 10 minutes before a class is scheduled to start.
I’ll leave the above resources for getting the idea of “what a back-end does”, and provide some context around the single requirement of sending reminder emails.
Sending reminder emails based on time before an event.
So there are a few ways to do this. All of them are based around a concept called a job schedule, like a cron job.
Depending on where your application is setup, you could setup an actual cron job, or setup some configuration with your runtime/cloud provider to call an endpoint on a given schedule. This will be how your program “checks” for reminder emails to send. Depending on how classes could be setup, you could be running this job schedule every 10 minutes, to every 1 hour, to even possibly every minute. Less is better, as you don’t want to run computations too much or your just wasting.
The next part is letting the code that is ran on that schedule to know what emails to send, and to who. This is where you usually have some pre-set data saved in your database that says “send an email at 2:15pm” that is easily found. This should be setup ahead of time, and not calculated on the fly, as date-time calculations can get nasty.
The advantage of this approach is its flexible in whatever ops you have. You can’t just use setTimeout
and set the reminder in the far future, as if your program deactivates/restarts it loses those variables. So you must save the state of when to send the emails in your database.
Dealing with dates and times can be annoying as well, there’s also the possibility you need to deal with different timezones. All in all this sort of feature can get finicky fast so plan out extra time to iron out the kinks.
Hopefully that helped at least get an idea of what you need to do.
Good luck, keep building, keep learning ![:+1: :+1:](https://emoji.discourse-cdn.com/twitter/+1.png?v=12)