Skip to content

Commit 0a693f3

Browse files
committed
chore: setup MinIO as local CDN for email development
1 parent d8c5a71 commit 0a693f3

33 files changed

+11249
-6439
lines changed

.devcontainer/.env.production.local.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ SUPPORT_EMAIL=support@app.com
3939

4040
EMAIL_FRONTEND_BASE_URL=http://localhost:3000/frontend/
4141
EMAIL_BACKEND_BASE_URL=http://localhost:3000/backend/
42-
EMAIL_ASSETS_BASE_URL=http://localhost:3000/assets/
42+
# CDN Configuration (MinIO for email assets in development)
43+
CDN_URL=http://localhost:9000/public-assets
4344

4445
PRINT_LOGS_TO_CONSOLE=true

.devcontainer/cdn-assets/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# CDN Assets
2+
3+
This folder contains assets that are served directly by MinIO via volume mapping for use in email templates and other static content.
4+
5+
**Note**: Files in this folder are directly accessible to the MinIO container via volume mapping - no upload process needed!
6+
7+
## Files Included
8+
9+
### Static Directory (`static/`)
10+
- `logo.png` - Company logo for email headers (150x45px recommended)
11+
- `header.png` - Header image for emails
12+
- `footer.png` - Footer image for emails
13+
- `logo.svg` - Vector version of the logo
14+
- `logo-placeholder.png` - Placeholder logo image
15+
- `icons/email-icon.png` - Email-related icons
16+
17+
### Root Directory
18+
- `email-header.jpg` - Header image for email templates (600x200px recommended)
19+
- `company-icon.svg` - Scalable company icon
20+
- `email-footer.png` - Footer image for email branding (600x100px recommended)
21+
22+
## How to Use
23+
24+
### 1. Start MinIO
25+
```bash
26+
docker-compose -f .devcontainer/docker-compose.dev.yml up -d
27+
```
28+
29+
### 2. Access via Public URLs
30+
Once MinIO is running, you can access these assets directly via:
31+
- `http://localhost:9000/public-assets/static/logo.png`
32+
- `http://localhost:9000/public-assets/static/header.png`
33+
- `http://localhost:9000/public-assets/static/footer.png`
34+
- `http://localhost:9000/public-assets/email-header.jpg`
35+
- `http://localhost:9000/public-assets/company-icon.svg`
36+
- `http://localhost:9000/public-assets/email-footer.png`
37+
38+
### 3. Use in Email Templates
39+
In your email templates, use the environment variable:
40+
```javascript
41+
const logoUrl = `${process.env.CDN_URL}/static/logo.png`;
42+
// Results in: http://localhost:9000/public-assets/static/logo.png
43+
```
44+
45+
## Replacing with Real Assets
46+
47+
To use real image files:
48+
1. Replace the placeholder files with actual PNG/JPG/SVG files
49+
2. Keep the same filenames
50+
3. Restart MinIO: `docker-compose -f .devcontainer/docker-compose.dev.yml restart minio`
51+
52+
## Production Setup
53+
54+
For production, update the `CDN_URL` environment variable to point to your production CDN:
55+
```bash
56+
CDN_URL=https://your-cdn-domain.com/assets
57+
```
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
349 KB
Loading
349 KB
Loading
349 KB
Loading
349 KB
Loading
349 KB
Loading

0 commit comments

Comments
 (0)