https://github.com/hasanqq/react-email-microservice
A simple microservice template created to use the react-email package from an API with express & zod.
https://github.com/hasanqq/react-email-microservice
email email-template express microservice react
Last synced: 11 months ago
JSON representation
A simple microservice template created to use the react-email package from an API with express & zod.
- Host: GitHub
- URL: https://github.com/hasanqq/react-email-microservice
- Owner: HasanQQ
- Created: 2025-01-04T14:52:54.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-24T13:32:36.000Z (about 1 year ago)
- Last Synced: 2025-03-31T06:22:42.073Z (12 months ago)
- Topics: email, email-template, express, microservice, react
- Language: TypeScript
- Homepage:
- Size: 116 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Email Microservice
A simple microservice template created to use the [react-email](https://github.com/resend/react-email) package. It has
same examples as "[create-email](https://www.npmjs.com/package/create-email)" (react-email) and the following features
have been added.
- [express](https://github.com/expressjs/express) implementation
- [rollup plugin](./rollup/plugin-clone-static-files.ts) for static file versioning
## Commands
List of available commands.
| Command | Description |
| --------------- | ---------------------------------------------- |
| `npm run dev` | Start the dev server. |
| `npm run build` | Build the production server with static files. |
| `npm run start` | Run the production server. |
## Example Usage
After build you can send component properties to the `[POST] http://localhost:3000/templates/:template/render` endpoint as a JSON body.
For example:
```bash
curl \
--request POST \
--url http://localhost:3000/templates/notion-magic-link/render \
--header 'Content-Type: application/json' \
--data '{"loginCode":"sparo-ndigo-amurt-secan"}'
```
Response will be something like that:
```json
{
"message": "SUCCESS",
"body": {
"html": "...",
"text": "..."
}
}
```
## TODOs
- [x] ~zod implementation for request payloads~
- [ ] automatic template/file discovery for express side
- [ ] move core functions/files into a package