@@ -23,7 +23,6 @@ We provide a script to automate the entire setup process.
2323 ```
24242. ** 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
7069Navigate 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+
76772. 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
93942. ** 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 ` ` `
1001013. 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`)
0 commit comments