This directory holds the code for the Resend Integration Guide.
You can either:
- install and use it as a Medusa application;
- or copy its source files into an existing Medusa application.
- Node.js v20+
- Git CLI
- PostgreSQL
- Resend Account with API key.
- Clone the repository and change to the
resend-integration
directory:
git clone https://github.com/medusajs/examples.git
cd examples/resend-integration
2. Rename the .env.template
file to .env
.
3. Set the following environment variables:
RESEND_API_KEY= # Resend API key
RESEND_FROM_EMAIL= # Resend from email. Use onboarding@resend.dev if you don't have a verified domain.
4. If necessary, change the PostgreSQL username, password, and host in the DATABASE_URL
environment variable.
5. Install dependencies:
yarn # or npm install
6. Setup and seed the database:
npx medusa db:setup
yarn seed # or npm run seed
7. Start the Medusa application:
yarn dev # or npm run dev
If you have an existing Medusa application, copy the content of the following directories:
src/modules/resend
src/workflows
src/subscribers
Then, add the Resend Module to medusa-config.js
:
module.exports = defineConfig({
// ...
modules: [
{
resolve: "@medusajs/medusa/notification",
options: {
providers: [
{
resolve: "./src/modules/resend",
id: "resend",
options: {
channels: ["email"],
api_key: process.env.RESEND_API_KEY,
from: process.env.RESEND_FROM_EMAIL,
},
},
],
},
},
]
})
Set the following environment variables:
RESEND_API_KEY= # Resend API key
RESEND_FROM_EMAIL= # Resend from email. Use onboarding@resend.dev if you don't have a verified domain.
And install the following dependencies:
yarn add resend # or npm install resend
yarn add @react-email/components -E # or npm install @react-email/components -E