Skip to content

Commit fd09aed

Browse files
committed
refactor(email): Move resend to package
1 parent ee96f34 commit fd09aed

File tree

15 files changed

+254
-30
lines changed

15 files changed

+254
-30
lines changed

.github/workflows/bump_publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,21 @@ jobs:
8282

8383
- name: Publish canary
8484
if: ${{ (github.event.inputs.mode == 'bump_and_publish' || github.event.inputs.mode == 'publish') && github.event.inputs.release == 'canary' }}
85-
run: pnpm publish --filter create-vitnode-app --filter @vitnode/core --filter @vitnode/config --filter @vitnode/blog --filter @vitnode/nodemailer --tag canary --no-git-checks --access public
85+
run: pnpm publish --filter create-vitnode-app --filter @vitnode/core --filter @vitnode/config --filter @vitnode/blog --filter @vitnode/nodemailer --filter @vitnode/resend --tag canary --no-git-checks --access public
8686
env:
8787
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8888
NPM_CONFIG_PROVENANCE: true
8989

9090
- name: Publish release candidate
9191
if: ${{ (github.event.inputs.mode == 'bump_and_publish' || github.event.inputs.mode == 'publish') && github.event.inputs.release == 'release-candidate' }}
92-
run: pnpm publish --filter create-vitnode-app --filter @vitnode/core --filter @vitnode/config --filter @vitnode/blog --filter @vitnode/nodemailer --tag rc --no-git-checks --access public
92+
run: pnpm publish --filter create-vitnode-app --filter @vitnode/core --filter @vitnode/config --filter @vitnode/blog --filter @vitnode/nodemailer --filter @vitnode/resend --tag rc --no-git-checks --access public
9393
env:
9494
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9595
NPM_CONFIG_PROVENANCE: true
9696

9797
- name: Publish stable
9898
if: ${{ (github.event.inputs.mode == 'bump_and_publish' || github.event.inputs.mode == 'publish') && github.event.inputs.release == 'stable' }}
99-
run: pnpm publish --filter create-vitnode-app --filter @vitnode/core --filter @vitnode/config --filter @vitnode/blog --filter @vitnode/nodemailer --tag latest --no-git-checks --access public
99+
run: pnpm publish --filter create-vitnode-app --filter @vitnode/core --filter @vitnode/config --filter @vitnode/blog --filter @vitnode/nodemailer --filter @vitnode/resend --tag latest --no-git-checks --access public
100100
env:
101101
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
102102
NPM_CONFIG_PROVENANCE: true

apps/docs/content/docs/dev/email/nodemailer.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ export const vitNodeApiConfig = buildApiConfig({
6161
Add the following environment variables to your `.env` file:
6262

6363
```bash title=".env"
64-
NODE_MAILER_FROM=xxx
65-
NODE_MAILER_HOST=xxx
66-
NODE_MAILER_PASSWORD=xxx
67-
NOD_EMAILER_USER=xxx
64+
NODE_MAILER_FROM=your_verified_email
65+
NODE_MAILER_HOST=smtp.your-email-provider.com
66+
NODE_MAILER_PASSWORD=your_email_password
67+
NOD_EMAILER_USER=your_email_username
6868
```
6969

7070
</Step>
Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,67 @@
11
---
22
title: Resend
3-
description: How to use Resend for sending emails in your application.
3+
description: Send emails using Resend with the Resend adapter.
44
---
55

6-
<Callout type="warn" title="This documentation is under construction! 🚧">
7-
We're working hard to bring you the best documentation experience.
8-
</Callout>
6+
| Cloud | Self-Hosted | Links |
7+
| ------------ | ------------ | --------------------------------------------------- |
8+
| ✅ Supported | ✅ Supported | [NPM Package](https://www.npmjs.com/package/resend) |
9+
10+
## Usage
11+
12+
<Steps>
13+
<Step>
14+
### Installation
15+
16+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
17+
18+
<Tabs groupId='package-manager' persist items={['bun', 'pnpm', 'npm']} label='Install resend adapter'>
19+
20+
```bash tab="bun"
21+
bun i @vitnode/resend -D
22+
```
23+
24+
```bash tab="pnpm"
25+
pnpm i @vitnode/resend -D
26+
```
27+
28+
```bash tab="npm"
29+
npm i @vitnode/resend -D
30+
```
31+
32+
</Tabs>
33+
34+
</Step>
35+
<Step>
36+
### Import the adapter
37+
38+
```ts title="vitnode.api.config.ts"
39+
// [!code ++]
40+
import { ResendEmailAdapter } from "@vitnode/resend";
41+
import { buildApiConfig } from "@vitnode/core/vitnode.config";
42+
43+
export const vitNodeApiConfig = buildApiConfig({
44+
email: {
45+
// [!code ++:4]
46+
adapter: ResendEmailAdapter({
47+
apiKey: process.env.RESEND_API_KEY,
48+
from: process.env.RESEND_FROM_EMAIL,
49+
}),
50+
},
51+
});
52+
```
53+
54+
</Step>
55+
<Step>
56+
57+
### Environment Variables
58+
59+
Add the following environment variables to your `.env` file:
60+
61+
```bash title=".env"
62+
RESEND_API_KEY=your_resend_api_key
63+
RESEND_FROM_EMAIL=your_verified_resend_email
64+
```
65+
66+
</Step>
67+
</Steps>

apps/docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"@types/react-dom": "^19.2.2",
5555
"@vitnode/config": "workspace:*",
5656
"@vitnode/nodemailer": "workspace:*",
57+
"@vitnode/resend": "workspace:*",
5758
"babel-plugin-react-compiler": "^1.0.0",
5859
"class-variance-authority": "^0.7.1",
5960
"eslint": "^9.39.1",

apps/docs/src/vitnode.api.config.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { blogApiPlugin } from "@vitnode/blog/config.api";
22
import { NodeCronAdapter } from "@vitnode/core/api/adapters/cron/node-cron.adapter";
3+
import { ResendEmailAdapter } from "@vitnode/resend";
34

45
import { NodemailerEmailAdapter } from "@vitnode/nodemailer";
56
import { DiscordSSOApiPlugin } from "@vitnode/core/api/adapters/sso/discord";
@@ -33,11 +34,15 @@ export const vitNodeApiConfig = buildApiConfig({
3334
duration: 60, // per 60 seconds
3435
},
3536
email: {
36-
adapter: NodemailerEmailAdapter({
37-
from: process.env.NODE_MAILER_FROM,
38-
host: process.env.NODE_MAILER_HOST,
39-
password: process.env.NODE_MAILER_PASSWORD,
40-
user: process.env.NOD_EMAILER_USER,
37+
// adapter: NodemailerEmailAdapter({
38+
// from: process.env.NODE_MAILER_FROM,
39+
// host: process.env.NODE_MAILER_HOST,
40+
// password: process.env.NODE_MAILER_PASSWORD,
41+
// user: process.env.NOD_EMAILER_USER,
42+
// }),
43+
adapter: ResendEmailAdapter({
44+
apiKey: process.env.RESEND_API_KEY,
45+
from: process.env.RESEND_FROM_EMAIL,
4146
}),
4247
logo: {
4348
text: "VitNode Email Test",

packages/nodemailer/.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.turbo
2+
/src
3+
/node_modules
4+
/tsconfig.json
5+
/.swcrc
6+
/eslint.config.mjs

packages/resend/.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.turbo
2+
/src
3+
/node_modules
4+
/tsconfig.json
5+
/.swcrc
6+
/eslint.config.mjs

packages/resend/.swcrc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://swc.rs/schema.json",
3+
"minify": true,
4+
"jsc": {
5+
"baseUrl": "./",
6+
"target": "esnext",
7+
"paths": {
8+
"@/*": ["./src/*"]
9+
},
10+
"parser": {
11+
"syntax": "typescript",
12+
"tsx": true
13+
},
14+
"transform": {
15+
"react": {
16+
"runtime": "automatic"
17+
}
18+
}
19+
},
20+
"module": {
21+
"type": "nodenext",
22+
"strict": true,
23+
"resolveFully": true
24+
}
25+
}

packages/resend/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# (VitNode) Resend Adapter
2+
3+
This package provides an adapter for integrating Resend email services into VitNode applications, enabling seamless email sending capabilities.
4+
5+
<p align="center">
6+
<br>
7+
<a href="https://vitnode.com/" target="_blank">
8+
<picture>
9+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/VitNode/vitnode/canary/assets/logo/vitnode_logo_dark.svg">
10+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/VitNode/vitnode/canary/assets/logo/vitnode_logo_light.svg">
11+
<img alt="VitNode Logo" src="https://raw.githubusercontent.com/VitNode/vitnode/canary/assets/logo/vitnode_logo_light.svg" width="400">
12+
</picture>
13+
</a>
14+
<br>
15+
<br>
16+
</p>
17+
18+
| Cloud | Self-Hosted | Links | Documentation |
19+
| ------------ | ------------ | --------------------------------------------------- | ------------------------------------------------- |
20+
| ✅ Supported | ✅ Supported | [NPM Package](https://www.npmjs.com/package/resend) | [Docs](https://vitnode.com/docs/dev/email/resend) |

packages/resend/eslint.config.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import eslintVitNode from "@vitnode/config/eslint";
2+
import { fileURLToPath } from "node:url";
3+
import { dirname } from "node:path";
4+
5+
const __dirname = dirname(fileURLToPath(import.meta.url));
6+
7+
export default [
8+
...eslintVitNode,
9+
{
10+
languageOptions: {
11+
parserOptions: {
12+
project: "./tsconfig.json",
13+
tsconfigRootDir: __dirname,
14+
},
15+
},
16+
},
17+
];

0 commit comments

Comments
 (0)