Skip to content

Commit 7dab33e

Browse files
🚀 Launch Open-Temp-Mail v1.0.0
Official launch of Open-Temp-Mail! Key Features: - Modern, high-performance temporary email service - Powered by Cloudflare Workers and React - Privacy-first anonymous inboxes - Comprehensive Admin Dashboard - Custom Domain Support
0 parents  commit 7dab33e

82 files changed

Lines changed: 15351 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Production
5+
dist/
6+
build/
7+
8+
# Environment Variables
9+
.env
10+
.env.local
11+
.env.development.local
12+
.env.test.local
13+
.env.production.local
14+
.dev.vars
15+
16+
# Cloudflare
17+
.wrangler/
18+
worker-configuration.d.ts
19+
20+
# Logs
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
logs/
25+
*.log
26+
27+
# Runtime data
28+
pids/
29+
*.pid
30+
*.seed
31+
*.pid.lock
32+
33+
# Editor/IDE
34+
.vscode/
35+
.idea/
36+
*.swp
37+
*.swo
38+
.cursor
39+
40+
# OS Generated
41+
.DS_Store
42+
.DS_Store?
43+
._*
44+
.Spotlight-V100
45+
.Trashes
46+
ehthumbs.db
47+
Thumbs.db
48+
49+
# Testing
50+
coverage/
51+
.nyc_output/
52+
53+
# Temporary
54+
tmp/
55+
temp/
56+
57+
# Application Specific
58+
eml/
59+
60+
# Preserved User Specific
61+
/asset/bookmarks_2025_9_5_2.html
62+
/asset/bookmarks_2025_9_5.html

DEPLOY.md

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# Open-Temp-Mail Deployment Guide
2+
3+
This guide provides step-by-step instructions to deploy the Open-Temp-Mail application to Cloudflare Workers. It covers everything from setting up your environment to rigorous verification.
4+
5+
## Prerequisites
6+
7+
Before starting, ensure you have the following installed:
8+
9+
1. **Node.js & npm**: Download and install from [Node.js official website](https://nodejs.org/). (Version 18 or higher recommended).
10+
2. **Git**: Download and install from [Git official website](https://git-scm.com/).
11+
3. **Cloudflare Account**: Sign up at [Cloudflare](https://dash.cloudflare.com/sign-up) if you don't have one.
12+
13+
---
14+
15+
## Automated Deployment (Recommended)
16+
17+
We provide a script to automate the entire setup process.
18+
19+
1. **Install & Login**:
20+
```bash
21+
npm install -g wrangler
22+
wrangler login
23+
```
24+
2. **Run Setup**:
25+
```bash
26+
cd "version 2"
27+
npm run deploy:setup
28+
```
29+
Follow the interactive prompts to set up your database, secrets, and deploy.
30+
31+
---
32+
33+
## Manual Deployment
34+
35+
If you prefer to set up everything manually, follow these steps.
36+
37+
## Step 1: Install Wrangler CLI
38+
39+
The Wrangler CLI is the command-line tool for building and managing Cloudflare Workers.
40+
41+
1. Open your terminal (Command Prompt, PowerShell, or macOS Terminal).
42+
2. Install Wrangler globally:
43+
```bash
44+
npm install -g wrangler
45+
```
46+
3. Verify the installation:
47+
```bash
48+
wrangler --version
49+
```
50+
51+
---
52+
53+
## Step 2: Login to Cloudflare
54+
55+
Connect your local environment to your Cloudflare account.
56+
57+
1. Run the login command:
58+
```bash
59+
wrangler login
60+
```
61+
2. A browser window will open asking you to authorize Wrangler.
62+
3. Click **"Allow"**.
63+
4. Close the browser tab once you see the success message.
64+
5. In your terminal, you should see: `Successfully logged in`.
65+
66+
---
67+
68+
## Step 3: Project Setup
69+
70+
Navigate to the project directory and install dependencies.
71+
72+
1. Open your terminal in the `version 2` folder of your project:
73+
```bash
74+
cd "path/to/open-temp-mail"
75+
```
76+
2. Install project dependencies:
77+
```bash
78+
npm install
79+
```
80+
81+
---
82+
83+
## Step 4: Create Cloudflare Resources
84+
85+
You need two main resources: a **D1 Database** (for storing user/mailbox data) and an **R2 Bucket** (for storing full email contents).
86+
87+
### 4.1 Create D1 Database
88+
89+
1. Run the creation command:
90+
```bash
91+
wrangler d1 create maill_free_db
92+
```
93+
2. **Copy the output!** You will see something like this:
94+
```toml
95+
[[d1_databases]]
96+
binding = "DB" # i.e. available in your Worker on env.DB
97+
database_name = "maill_free_db"
98+
database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
99+
```
100+
3. Open `wrangler.toml` in your text editor.
101+
4. Find the `[[d1_databases]]` section.
102+
5. Update the `database_id` with the one you just copied. **Do not change the `binding` name (`TEMP_MAIL_DB`)**, as the code relies on it.
103+
104+
### 4.2 Initialize Database Schema
105+
106+
Apply the database structure (tables) to your new D1 database.
107+
108+
1. Run the execute command:
109+
```bash
110+
wrangler d1 execute maill_free_db --file=d1-init.sql
111+
```
112+
2. Type `y` if prompted to confirm (for remote databases).
113+
114+
### 4.3 Create R2 Bucket
115+
116+
1. Run the create command:
117+
```bash
118+
wrangler r2 bucket create mail-eml
119+
```
120+
2. Confirm it matches the `bucket_name` in your `wrangler.toml` (default is `mail-eml`).
121+
122+
---
123+
124+
## Step 5: Configure Secrets
125+
126+
Set up secure environment variables for your application.
127+
128+
1. **Strict Admin Password** (Required):
129+
```bash
130+
wrangler secret put ADMIN_PASSWORD
131+
# Enter your desired rigorous password when prompted
132+
```
133+
134+
2. **JWT Signing Token** (Required):
135+
```bash
136+
wrangler secret put JWT_TOKEN
137+
# Enter a long, random string (e.g., generated via `openssl rand -hex 32`)
138+
```
139+
140+
3. **Resend API Key** (Optional, for sending emails):
141+
```bash
142+
wrangler secret put RESEND_API_KEY
143+
# Enter your key from https://resend.com
144+
```
145+
146+
---
147+
148+
## Step 6: Build and Deploy
149+
150+
Now, build the frontend and deploy the full stack to Cloudflare.
151+
152+
1. **Build the Frontend**:
153+
This compiles your React code into static assets in the `dist/` folder.
154+
```bash
155+
npm run build
156+
```
157+
158+
2. **Deploy to Cloudflare Workers**:
159+
This uploads your backend code and the static assets.
160+
```bash
161+
wrangler deploy
162+
```
163+
164+
3. **Success!**
165+
The terminal will output your Worker's URL, e.g., `https://open-temp-mail.your-subdomain.workers.dev`.
166+
167+
---
168+
169+
## Step 7: Post-Deployment Configuration
170+
171+
### 7.1 Setup Email Routing (Catch-All)
172+
173+
To receive emails, you must configure Cloudflare Email Routing.
174+
175+
1. Go to the [Cloudflare Dashboard](https://dash.cloudflare.com/).
176+
2. Select your domain.
177+
3. Navigate to **Email** > **Email Routing**.
178+
4. Click **"Get Started"** if not already enabled.
179+
5. Go to the **Routes** tab.
180+
6. Click **Create Custom Address**.
181+
- **Custom Address**: Enter `*` (Catch-all) to receive emails for any address (e.g., `anything@yourdomain.com`).
182+
- **Action**: `Send to a Worker`.
183+
- **Destination**: Select your newly deployed Worker (`open-temp-mail`).
184+
7. Click **Save**.
185+
186+
### 7.2 Verify Deployment
187+
188+
1. Open your Worker URL in a browser.
189+
2. You should see the Open-Temp-Mail login page.
190+
3. Login with `admin` and the password you set in **Step 5**.
191+
4. Try creating a random mailbox to test database connectivity.
192+
5. Try sending an email to that mailbox (from an external account like Gmail) to test Email Routing.
193+
194+
---
195+
196+
## Troubleshooting
197+
198+
- **Frontend loads blank**: Open your browser's Developer Tools (F12) -> Console. Check for errors.
199+
- **Database errors**: Ensure you ran the `d1 execute` command (Step 4.2).
200+
- **"Uncaught (in promise)"**: Check your `wrangler secret list` to ensure all secrets are set.
201+
- **Email not received**: Verify your domain's MX records in Cloudflare DNS settings match what Email Routing requires.
202+
203+
---
204+
205+
## Local Development
206+
207+
You can run the application locally in two modes: **Local Mode** (using a local temporary database) or **Remote Mode** (connecting to your live Cloudflare D1 database).
208+
209+
### Option 1: Local Backend (Default)
210+
*Use this for safe development without affecting production data.*
211+
212+
1. **Start Frontend**:
213+
```bash
214+
npm run dev
215+
```
216+
(Runs on `http://localhost:5173`)
217+
218+
2. **Start Backend** (in a new terminal):
219+
```bash
220+
npm run dev:backend
221+
```
222+
(Runs on `http://localhost:8787` using a local SQLite file)
223+
224+
### Option 2: Remote Backend (Live Data)
225+
*Use this to debug with your actual production database.*
226+
227+
1. **Start Frontend**:
228+
```bash
229+
npm run dev
230+
```
231+
232+
2. **Start Backend** (in a new terminal):
233+
```bash
234+
npm run dev:backend:remote
235+
```
236+
(Runs on `http://localhost:8787` but connects to your generic Cloudflare D1 DB)
237+

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# 📬 Open-Temp-Mail
2+
3+
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/deploy-button.svg)](https://deploy.workers.cloudflare.com/?url=https://github.com/yourusername/open-temp-mail)
4+
![License](https://img.shields.io/badge/license-MIT-blue.svg)
5+
![Version](https://img.shields.io/badge/version-1.0.0-green.svg)
6+
![Status](https://img.shields.io/badge/status-stable-success.svg)
7+
8+
**Open-Temp-Mail** is a modern, high-performance temporary email service built for speed, privacy, and ease of deployment. Engineered with React, Vite, and Cloudflare Workers, it provides a seamless disposable email experience with a premium UI.
9+
10+
---
11+
12+
## ✨ Features
13+
14+
- **🚀 Blazing Fast**: Powered by Cloudflare Workers for edge-latency global performance.
15+
- **🛡️ Privacy First**: Completely anonymous and disposable inboxes.
16+
- **🎨 Stunning UI**: A beautiful, dark-mode focused interface built with **Tailwind CSS v4**.
17+
- **📱 Fully Responsive**: Optimized for mobile, tablet, and desktop experiences.
18+
- **🔐 Secure Access**: Role-based authentication for Admins and Users.
19+
- **📨 Advanced Mailbox Tools**:
20+
- **⭐ Favorites**: Pin important inboxes for quick access.
21+
- **🔄 Forwarding Rules**: Set up auto-forwarding to real email addresses.
22+
- **👁️ Sanitized Viewing**: Safe HTML email rendering with XSS protection.
23+
- **🔍 Filtering**: Filter by All, Favorites, or Forwarding status.
24+
25+
## 🛠️ Tech Stack
26+
27+
![React](https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB)
28+
![Vite](https://img.shields.io/badge/Vite-646CFF?style=for-the-badge&logo=vite&logoColor=white)
29+
![Tailwind CSS](https://img.shields.io/badge/Tailwind_CSS-38B2AC?style=for-the-badge&logo=tailwind-css&logoColor=white)
30+
![Cloudflare Workers](https://img.shields.io/badge/Cloudflare_Workers-F38020?style=for-the-badge&logo=cloudflare&logoColor=white)
31+
![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
32+
![D1 Database](https://img.shields.io/badge/Cloudflare_D1-F38020?style=for-the-badge&logo=cloudflare&logoColor=white)
33+
34+
## 🚀 Getting Started
35+
36+
### Prerequisites
37+
- **Node.js** 18+
38+
- **Cloudflare Account** (for Workers & D1)
39+
40+
### Installation
41+
42+
1. **Clone the repository**
43+
```bash
44+
git clone https://github.com/yourusername/open-temp-mail.git
45+
cd open-temp-mail
46+
```
47+
48+
2. **Install Dependencies**
49+
```bash
50+
npm install
51+
```
52+
53+
3. **Run Development Server**
54+
```bash
55+
npm run dev
56+
```
57+
Visit `http://localhost:5173` to view the app.
58+
59+
## 📦 Deployment
60+
61+
Open-Temp-Mail is designed to be deployed effortlessly to Cloudflare.
62+
63+
### One-Click Deployment
64+
For a quick setup, run the automated setup script:
65+
```bash
66+
npm run deploy:setup
67+
```
68+
This script will automate resource creation (D1 User DB), configuration, and initial deployment.
69+
70+
### Manual Deployment
71+
For granular control over the deployment process, please refer to the detailed **[DEPLOY.md](./DEPLOY.md)** guide.
72+
73+
## 📂 Project Structure
74+
75+
```bash
76+
open-temp-mail/
77+
├── 📂 src/ # React Frontend Data & Components
78+
├── 📂 worker/ # Cloudflare Worker Backend Logic
79+
├── 📂 scripts/ # Setup & Utility Scripts
80+
├── 📜 wrangler.toml # Cloudflare Configuration
81+
└── 📄 package.json # Project Dependencies
82+
```
83+
84+
---
85+
86+
<p align="center">
87+
Built with ❤️ by the Open Source Community
88+
</p>

0 commit comments

Comments
 (0)