wip
This commit is contained in:
parent
320a3f71d4
commit
a9e8479be7
12
.env.example
12
.env.example
@ -1,7 +1,7 @@
|
|||||||
SMTP_HOST=smtp.mailtrap.io
|
SMTP_HOST=localhost
|
||||||
SMTP_PORT=2525
|
SMTP_PORT=587
|
||||||
SMTP_USER=your_smtp_user
|
SMTP_USER="project.1"
|
||||||
SMTP_PASS=your_smtp_password
|
SMTP_PASS="secret.1"
|
||||||
EMAIL_FROM=noreply@example.com
|
EMAIL_FROM="noreply@lauf-fuer-kaya.de"
|
||||||
EMAIL_REPLYTO=noreply@example.com
|
EMAIL_REPLYTO="info@lauf-fuer-kaya.de"
|
||||||
REDIS_URL=redis://localhost:6379
|
REDIS_URL=redis://localhost:6379
|
102
README.md
Normal file
102
README.md
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
# 📧 Email Microservice
|
||||||
|
|
||||||
|
A modern email microservice built with Hono and TypeScript, supporting multiple languages and HTML/Text email templates.
|
||||||
|
|
||||||
|
## ✨ Features
|
||||||
|
|
||||||
|
- 🌐 Multi-language support (English & German)
|
||||||
|
- 📝 HTML and Text email templates
|
||||||
|
- 📚 OpenAPI/Swagger documentation
|
||||||
|
- ⚡ High-performance with Bun runtime
|
||||||
|
- 🔄 Queue-based email processing
|
||||||
|
- 🎨 Handlebars templating
|
||||||
|
|
||||||
|
## 🚀 Quick Start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install dependencies
|
||||||
|
bun install
|
||||||
|
|
||||||
|
# Start development server
|
||||||
|
bun dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📖 API Documentation
|
||||||
|
|
||||||
|
Swagger UI is available at: `/swagger`
|
||||||
|
|
||||||
|
## 🔍 Example API Calls
|
||||||
|
|
||||||
|
### Send Welcome Email
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X POST http://localhost:3000/api/v1/email \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"to": "user@example.com",
|
||||||
|
"subject": "Welcome to Lauf für Kaya! 2025",
|
||||||
|
"templateName": "welcome",
|
||||||
|
"language": "en",
|
||||||
|
"data": {
|
||||||
|
"name": "John Doe",
|
||||||
|
"barcode_url": "https://barcodeapi.org/api/8/12345670?",
|
||||||
|
"link": "https://run.lauf-fuer-kaya.de/selfservice/"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Send Password Reset Email
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X POST http://localhost:3000/api/v1/email \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"to": "user@example.com",
|
||||||
|
"subject": "Password Reset Request",
|
||||||
|
"templateName": "password-reset",
|
||||||
|
"language": "de",
|
||||||
|
"data": {
|
||||||
|
"name": "John Doe",
|
||||||
|
"resetLink": "https://example.com/reset/123",
|
||||||
|
"expiresIn": "24 hours"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Check Queue Status
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl http://localhost:3000/api/v1/email/status
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📝 Environment Variables
|
||||||
|
|
||||||
|
```env
|
||||||
|
SMTP_HOST=localhost
|
||||||
|
SMTP_PORT=587
|
||||||
|
SMTP_USER="project.1"
|
||||||
|
SMTP_PASS="secret.1"
|
||||||
|
EMAIL_FROM="noreply@lauf-fuer-kaya.de"
|
||||||
|
EMAIL_REPLYTO="info@lauf-fuer-kaya.de"
|
||||||
|
REDIS_URL=redis://localhost:6379
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🛠️ Development
|
||||||
|
|
||||||
|
The project uses:
|
||||||
|
- 🏃♂️ Bun for runtime and package management
|
||||||
|
- 🌐 Hono for the web framework
|
||||||
|
- 📚 Zod for validation
|
||||||
|
- 📧 Nodemailer for email sending
|
||||||
|
- 📑 Handlebars for templating
|
||||||
|
- 📊 BullMQ for queue management
|
||||||
|
|
||||||
|
## 📦 Available Templates
|
||||||
|
|
||||||
|
### Welcome Email
|
||||||
|
- Languages: 🇬🇧 English, 🇩🇪 German
|
||||||
|
- Variables: `name`, `link`, `barcode_url`
|
||||||
|
|
||||||
|
### Password Reset
|
||||||
|
- Languages: 🇬🇧 English, 🇩🇪 German
|
||||||
|
- Variables: `name`, `resetLink`, `expiresIn`
|
Loading…
x
Reference in New Issue
Block a user