Skip to content

Commit 713aed4

Browse files
updated documentation
1 parent 7dab33e commit 713aed4

2 files changed

Lines changed: 49 additions & 28 deletions

File tree

DEPLOY.md

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ We provide a script to automate the entire setup process.
2323
```
2424
2. **Run Setup**:
2525
```bash
26-
cd "version 2"
2726
npm run deploy:setup
2827
```
2928
Follow the interactive prompts to set up your database, secrets, and deploy.
@@ -69,10 +68,12 @@ Connect your local environment to your Cloudflare account.
6968

7069
Navigate to the project directory and install dependencies.
7170

72-
1. Open your terminal in the `version 2` folder of your project:
71+
1. Open your terminal in the project folder:
7372
```bash
7473
cd "path/to/open-temp-mail"
7574
```
75+
*(Navigate to where you cloned the repository)*
76+
7677
2. Install project dependencies:
7778
```bash
7879
npm install
@@ -93,45 +94,53 @@ You need two main resources: a **D1 Database** (for storing user/mailbox data) a
9394
2. **Copy the output!** You will see something like this:
9495
```toml
9596
[[d1_databases]]
96-
binding = "DB" # i.e. available in your Worker on env.DB
97+
binding = "TEMP_MAIL_DB" # IMPORTANT: Must be TEMP_MAIL_DB
9798
database_name = "maill_free_db"
9899
database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
99100
```
100101
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
102+
4. Replace the `[[d1_databases]]` section with the output from **Step 2**.
103+
* **CRITICAL**: Ensure `binding = "TEMP_MAIL_DB"`. If the output says "DB", change it to "TEMP_MAIL_DB".
105104

106-
Apply the database structure (tables) to your new D1 database.
105+
### 4.2 Create R2 Bucket
107106

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:
107+
1. Run the creation command:
117108
```bash
118109
wrangler r2 bucket create mail-eml
119110
```
120-
2. Confirm it matches the `bucket_name` in your `wrangler.toml` (default is `mail-eml`).
111+
2. Open `wrangler.toml` and verify the `[[r2_buckets]]` section:
112+
```toml
113+
[[r2_buckets]]
114+
binding = "MAIL_EML"
115+
bucket_name = "mail-eml"
116+
```
121117

122118
---
123119

124-
## Step 5: Configure Secrets
120+
## Step 5: Configure Environment Variables
121+
122+
Open `wrangler.toml` and configure the `[vars]` section.
123+
124+
### Essential Variables
125+
126+
* **MAIL_DOMAIN**: Your email domain(s), separated by commas.
127+
* Example: `"example.com, temp.example.com"`
128+
* **ADMIN_NAME**: The username for the admin dashboard.
129+
* Default: `"admin"`
130+
131+
### Secrets (Set via Wrangler CLI)
132+
133+
Do **NOT** put passwords in `wrangler.toml`. Set them securely using `wrangler secret put`.
125134

126-
Set up secure environment variables for your application.
135+
Run the following commands in your terminal:
127136

128-
1. **Strict Admin Password** (Required):
137+
1. **Admin Password**:
129138
```bash
130139
wrangler secret put ADMIN_PASSWORD
131-
# Enter your desired rigorous password when prompted
132140
```
141+
*Enter your desired strong password when prompted.*
133142

134-
2. **JWT Signing Token** (Required):
143+
2. **JWT Token Secret** (for session security):
135144
```bash
136145
wrangler secret put JWT_TOKEN
137146
# Enter a long, random string (e.g., generated via `openssl rand -hex 32`)

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
### Prerequisites
3737
- **Node.js** 18+
3838
- **Cloudflare Account** (for Workers & D1)
39+
- **Wrangler CLI** (`npm install -g wrangler`)
3940

4041
### Installation
4142

@@ -56,19 +57,30 @@
5657
```
5758
Visit `http://localhost:5173` to view the app.
5859

59-
## 📦 Deployment
60+
## ⚙️ Configuration
61+
62+
Open-Temp-Mail uses `wrangler.toml` for configuration.
63+
64+
| Variable | Description | Example |
65+
| :--- | :--- | :--- |
66+
| `MAIL_DOMAIN` | Your email domain(s), comma-separated | `"example.com, temp.io"` |
67+
| `ADMIN_NAME` | Username for the admin dashboard | `"admin"` |
6068

61-
Open-Temp-Mail is designed to be deployed effortlessly to Cloudflare.
69+
**Secrets** (Set via `wrangler secret put`):
70+
- `ADMIN_PASSWORD`: Secure password for admin access.
71+
- `JWT_TOKEN`: Random string for session security.
72+
- `RESEND_API_KEY`: (Optional) For sending emails via Resend.
73+
74+
## 📦 Deployment
6275

6376
### One-Click Deployment
64-
For a quick setup, run the automated setup script:
77+
Run the automated setup script to create resources and deploy:
6578
```bash
6679
npm run deploy:setup
6780
```
68-
This script will automate resource creation (D1 User DB), configuration, and initial deployment.
6981

7082
### Manual Deployment
71-
For granular control over the deployment process, please refer to the detailed **[DEPLOY.md](./DEPLOY.md)** guide.
83+
For detailed steps on manually configuring Cloudflare D1, R2, and Secrets, please refer to our **[Deployment Guide](./DEPLOY.md)**.
7284

7385
## 📂 Project Structure
7486

0 commit comments

Comments
 (0)