Main tools
- Deco.cx for hosting and CMS.
- Deco Records as an SQLite database, using Drizzle ORM
- Resend app for sending confirmation emails. Email sending API that offers a free plan of 3,000 emails per month.
Necessary configurations
- Create a site on deco.cx
- Configure Deco Records
For this tutorial, we created a “newsletter” table with columnsid
,confirmed_at
,confirmation_key
.
- Install the Resend app in the “Apps” menu, configuring the API Key. When installing the Resend app on deco, you will find instructions on how to do this.
Creating the sections used
Two sections were used in this tutorial:-
newsletterSubscribe.tsx
: Newsletter subscription form (email field) + inline action that performs the process of including the email in the database and sending the email using the Resend app. Main components of the section:And in the form, it contains the use of HTMX to make the request asynchronously and update only the necessary section. -
newsletterConfirmation.tsx
: Section to be included on the/confirm
page of the site so that users can confirm the subscription and receive positive feedback. The main use of this section was the use of the loader to process the data: