cloudfrontize 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +65 -22
  2. package/dist/cli.js +36 -32
  3. package/dist/ui/app.js +399 -0
  4. package/dist/ui/favicons/android-icon-144x144.png +0 -0
  5. package/dist/ui/favicons/android-icon-192x192.png +0 -0
  6. package/dist/ui/favicons/android-icon-36x36.png +0 -0
  7. package/dist/ui/favicons/android-icon-48x48.png +0 -0
  8. package/dist/ui/favicons/android-icon-72x72.png +0 -0
  9. package/dist/ui/favicons/android-icon-96x96.png +0 -0
  10. package/dist/ui/favicons/apple-icon-114x114.png +0 -0
  11. package/dist/ui/favicons/apple-icon-120x120.png +0 -0
  12. package/dist/ui/favicons/apple-icon-144x144.png +0 -0
  13. package/dist/ui/favicons/apple-icon-152x152.png +0 -0
  14. package/dist/ui/favicons/apple-icon-180x180.png +0 -0
  15. package/dist/ui/favicons/apple-icon-57x57.png +0 -0
  16. package/dist/ui/favicons/apple-icon-60x60.png +0 -0
  17. package/dist/ui/favicons/apple-icon-72x72.png +0 -0
  18. package/dist/ui/favicons/apple-icon-76x76.png +0 -0
  19. package/dist/ui/favicons/apple-icon-precomposed.png +0 -0
  20. package/dist/ui/favicons/apple-icon.png +0 -0
  21. package/dist/ui/favicons/browserconfig.xml +11 -0
  22. package/dist/ui/favicons/favicon-16x16.png +0 -0
  23. package/dist/ui/favicons/favicon-32x32.png +0 -0
  24. package/dist/ui/favicons/favicon-96x96.png +0 -0
  25. package/dist/ui/favicons/favicon.ico +0 -0
  26. package/dist/ui/favicons/manifest.json +41 -0
  27. package/dist/ui/favicons/ms-icon-144x144.png +0 -0
  28. package/dist/ui/favicons/ms-icon-150x150.png +0 -0
  29. package/dist/ui/favicons/ms-icon-310x310.png +0 -0
  30. package/dist/ui/favicons/ms-icon-70x70.png +0 -0
  31. package/dist/ui/index.html +102 -0
  32. package/dist/ui/style.css +639 -0
  33. package/package.json +1 -1
package/README.md CHANGED
@@ -8,35 +8,67 @@
8
8
 
9
9
  ---
10
10
 
11
- #### A high-performance, high-fidelity local emulator for AWS Lambda@Edge and CloudFront Functions.
11
+ #### A high-fidelity local development server for AWS Lambda@Edge and CloudFront Functions.
12
12
 
13
+ Test your Edge logic locally in milliseconds instead of waiting 15 minutes for CloudFront deployments.
14
+
15
+ <div style="display: flex; justify-content: space-around; align-items: center;">
16
+ <img alt="Cloudfrontize Banner" src="https://raw.githubusercontent.com/felipecarrillo100/cloudfrontize/main/assets/cloudfrontize.png" width="45%" />
17
+ <img alt="Cloudfrontize Web UI" src="https://raw.githubusercontent.com/felipecarrillo100/cloudfrontize/main/assets/cloudfrontize-webui.jpg" width="45%" />
18
+ </div>
13
19
 
14
20
  ---
15
21
  ## 📦 Getting started
16
22
  Get up and running in seconds. No complex AWS IAM roles, no stack traces—just your code, running locally.
17
23
 
18
- ### Install it **Globally:**
24
+ ### Install **globally:**
19
25
 
20
26
  ```bash
21
27
  npm install -g cloudfrontize
22
28
  ```
23
- Once installed, you can rule the Edge from any directory by simply typing `cloudfrontize ./www` (specifying your static folder).
29
+ Once installed, you can run CloudFrontize from any directory: by simply typing `cloudfrontize ./www` (specifying your static folder).
24
30
 
25
- Point it at your static files folder (`./www`, `./dist` or `./public`) and point to your Lambda@Edge `.js` file. CloudFrontize handles the rest.
31
+ Point it at your static files folder (`./www`, `./dist` or `./public`) and point to your Lambda@Edge `.js` file. CloudFrontize handles the rest.
26
32
 
27
- ```bash
28
- cloudfrontize ./folder --edge ./lambda-at-age-logic.js
33
+ ## ⚡ Quick Example
34
+
35
+ 1️⃣ Create a simple Lambda@Edge function, for instance: `viewer-request-rewrite.js`
36
+
37
+ ```javascript
38
+ exports.hookType = 'viewer-request';
39
+
40
+ exports.handler = (event, context, callback) => {
41
+ const request = event.Records[0].cf.request;
42
+ console.log("Original request", request.uri);
43
+ request.uri = "/index-alt.html";
44
+ callback(null, request);
45
+ };
29
46
  ```
30
- OR
31
- ```bash
32
- npx cloudfrontize ./folder --edge ./lambda-at-age-logic.js
47
+
48
+ 2️⃣ Run CloudFrontize
49
+
50
+ ```
51
+ cloudfrontize ./www --edge ./viewer-request-rewrite.js --debug
52
+ ```
53
+ For this sample, place two HTML files inside the `www` folder: `index.html` and `index-alt.html`.
54
+
55
+ 3️⃣ Open
56
+
57
+ Open your browser and navigate to: http://localhost:3000
58
+
59
+ Because the `viewer-request` hook is active, every request is rewritten to `/index-alt.html`. As a result, the browser will display the contents of that file regardless of the requested path.
60
+
61
+ Check the CloudFrontize terminal output. You should see a log entry confirming the internal URI rewrite:
62
+ ```text
63
+ 2026-03-16T22:18:51.465Z [44ff0e42] [viewer-request] Original request /
64
+ [Debug] Mode: rest, isRestMode: true, URL: /index-alt.html, FullPath: C:\tmp\www\index-alt.html
33
65
  ```
34
66
 
35
67
  ---
36
68
 
37
- ## 📣 Stop bowing to the deployment bar!
69
+ ## 📣 Stop waiting for CloudFront deployments!
38
70
 
39
- **Rule the Edge** and become the Hero of the Cloud. **Escape the "Deploy-and-Pray" cycle.** We’ve all been there: you tweak one security header, hit "Deploy," and... **you wait.** For 15 agonizing minutes, you watch a spinning "In Progress" status as AWS propagates your code globally. If there’s a tiny typo? You won't know until you hit a **502 Bad Gateway** and go hunting through CloudWatch logs buried in a random region.
71
+ **Take control** of your Edge development workflow. **Escape the "Deploy-and-Pray" cycle.** We’ve all been there: you tweak one security header, hit "Deploy," and... **you wait.** For 15 agonizing minutes, you watch a spinning "In Progress" status as AWS propagates your code globally. If there’s a tiny typo? You won't know until you hit a **502 Bad Gateway** and go hunting through CloudWatch logs buried in a random region.
40
72
 
41
73
  It’s a workflow that kills momentum and turns "quick fixes" into afternoon-long ordeals.
42
74
 
@@ -58,7 +90,7 @@ The CloudFront/Lambda@Edge development loop is notoriously painful. Propagation
58
90
 
59
91
  **CloudFrontize** eliminates the wait and the risk:
60
92
 
61
- * **Zero-Config Integration:** If you know how to use Vercel's [serve](https://www.npmjs.com/package/serve)) package, you already know how to use `cloudfrontize`.
93
+ * **Zero-Config Integration:** If you know how to use Vercel's [serve](https://www.npmjs.com/package/serve) package, you already know how to use `cloudfrontize`.
62
94
  * **Real-Time Hot Reloading:** Tweak your URI rewrites or security headers and see the results instantly on browser refresh. No packaging, no uploading, no waiting for the "In Progress" spinner.
63
95
  * **Debug directly to the console:** Stop hunting for logs in hidden CloudWatch streams across random regions. See your console.log outputs and execution errors live **in your terminal**.
64
96
  * **Production Fidelity:** Emulates in detail CloudFront-specific features & quirks, like the **10MB auto-compression limit**, header blacklisting, and URI normalization.
@@ -100,6 +132,7 @@ While tools like `serverless-offline` or `SAM CLI` are great for standard Lambda
100
132
  | **`-o, --output <path>`**| Output the baked `.js` file(s) for production deployment | `null` |
101
133
  | **`-p, --port <number>`** | Port to listen on | `3000` |
102
134
  | **`-l, --listen <uri>`** | Listen URI (overrides `--port`) | `3000` |
135
+ | **`--webui <port>`** | Enable the visual control plane for real-time traffic inspection and header debugging | `disabled` |
103
136
  | **`-s, --single`** | SPA mode — rewrite all 404s to `index.html` | `off` |
104
137
  | **`-C, --cors`** | Enable `Access-Control-Allow-Origin: *` | `off` |
105
138
  | **`-d, --debug`** | Show Lambda execution logs and URI rewrites | `off` |
@@ -111,6 +144,16 @@ While tools like `serverless-offline` or `SAM CLI` are great for standard Lambda
111
144
 
112
145
  ---
113
146
 
147
+ ## 🖥️ Visual Control Plane (Web UI)
148
+
149
+ CloudFrontize includes an optional, browser-based UI to help you visualize your edge logic in real-time. Inspect headers, track URI rewrites, and debug Lambda@Edge execution without leaving your browser.
150
+
151
+ Using the **Header Intelligence** panel, you can inject or override headers on-the-fly to test Geo-routing, Auth tokens, or Security policies without changing a single line of code.
152
+
153
+ **[👉 Learn how to use the Web UI](docs/web-ui.md)**
154
+
155
+ ---
156
+
114
157
 
115
158
  ## 🚀 Lambda@Edge Integration
116
159
 
@@ -208,13 +251,13 @@ Then run
208
251
  cloudfrontize ./www -e ./samples/medium/lambda-edge-authorization.js -d -C
209
252
  ```
210
253
  * The `www` folder contains the sample files (html, js, css, etc.)
211
- * The `lambda-edge-authorization.js` contains the lambda@edge logic
254
+ * The `lambda-edge-authorization.js` file contains the lambda@edge logic
212
255
  * The `-d` option enables debug messages while `-C` enables CORS
213
256
  * Default port is 3000, you can now open your browser at http://localhost:3000/
214
- * The user: admin and the password: password as you see in the Lambda@Edge logic.
257
+ * The username is `admin` and the password is `password`, as defined in the Lambda@Edge logic.
215
258
 
216
259
  ### A CFF Example
217
- Your file must start with `viewer-request` or `viewer-response` to let the simulator know the type of CFF we want to execute. In this case we have called it:`viewer-request-redirect.js`
260
+ Your file must start with `viewer-request` or `viewer-response` to let the simulator know the type of CFF we want to execute. In this case we have called it: `viewer-request-redirect.js`
218
261
  ```javascript
219
262
  function handler(event) {
220
263
  var request = event.request;
@@ -239,21 +282,21 @@ Run with:
239
282
  ```bash
240
283
  cloudfrontize ./www --cff ./samples/cff/viewer-request-redirect.js -d --mode website
241
284
  ```
242
- * `-d` Enabled debug, and `--mode website` takes care of appending `index.html` to folders
285
+ * `-d` Enables debug, and `--mode website` takes care of appending `index.html` to folders
243
286
  * Open in browser http://localhost:3000/promo
244
- * You will be redirected tot http://localhost:3000/summer-sale
287
+ * You will be redirected to http://localhost:3000/summer-sale
245
288
  ---
246
289
 
247
290
  ## 🎓 CloudFrontize Academy (Tutorial)
248
291
 
249
292
  New to Lambda@Edge? We've built a comprehensive, hands-on tutorial to take you from **Newbie to Production Pro**.
250
293
 
251
- Our **[CloudFrontize Academy](./tutorial/README.md)** includes 10 thematic exercises covering:
294
+ Our **[CloudFrontize Academy](./tutorial/README.md)** includes 20+ thematic exercises covering:
252
295
  * **Module 1: Foundations** (Security Headers, Redirects, Normalization)
253
296
  * **Module 2: Origin Intelligence** (A/B Testing, Geo-Localization, Header Cleaning)
254
297
  * **Module 3: Edge Computing** (Custom Auth, Maintenance Pages, Payload Inspection)
255
298
  * **Module 4: Production Workflows** (Variable Baking & Deployment)
256
- * **Module 5: Cloud Front Functions** (CFF)
299
+ * **Module 5: CloudFront Functions** (CFF)
257
300
 
258
301
  Each exercise comes with a **Business Scenario**, **Starter Template**, and **Full Solution**.
259
302
 
@@ -261,10 +304,10 @@ Each exercise comes with a **Business Scenario**, **Starter Template**, and **Fu
261
304
 
262
305
  ### License
263
306
 
264
- **CloudFrontize** is licensed under the **[PolyForm Noncommercial 1.0.0](https://www.google.com/search?q=https://polyformproject.org/licenses/noncommercial/1.0.0/)**. For the full legal text and specific terms, please refer to the [LICENSE](https://www.google.com/search?q=./LICENSE) file in this package.
307
+ **CloudFrontize** is licensed under the **[PolyForm Noncommercial 1.0.0](https://polyformproject.org/licenses/noncommercial/1.0.0/)**. For the full legal text and specific terms, please refer to the [LICENSE](https://polyformproject.org/licenses/noncommercial/1.0.0/) file in this package.
265
308
 
266
309
  * **✅ Free for Individuals & Education:** 100% free for personal projects, open-source contributions, students, and researchers. This includes full access to the **CloudFrontize Academy**.
267
- * **💼 Requires a Commercial License:** Use by for-profit organizations, or for work performed on behalf of a for-profit entity, requires a paid Commercial License.
310
+ * **💼 Requires a Commercial License:** Use by for-profit organizations, or work performed on behalf of a for-profit entity, requires a commercial license.
268
311
  * **⏳ 30-Day Business Trial:** We offer a one-month free evaluation period for professional teams. Integrate CloudFrontize into your workflow, experience the "Zero-Wait" deployment cycle, and measure your team's productivity gains before committing.
269
312
 
270
313
 
@@ -279,7 +322,7 @@ Maintaining high-fidelity AWS emulation takes significant time. If your company
279
322
  **THE SOFTWARE IS PROVIDED "AS IS"**, WITHOUT WARRANTY OF ANY KIND. Testing on CloudFrontize does not guarantee success on live AWS infrastructure. The author is not liable for any production downtime, data loss, or financial damages resulting from the use of this tool. Always validate your logic in an AWS staging environment before a full production rollout.
280
323
 
281
324
  ---
282
- # Donations & Sponsoring
325
+ # Support the Project
283
326
  [<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" name="buy-me-a-coffee" alt="Buy Me A Coffee" width="180">](https://buymeacoffee.com/felipecarrillo100)
284
327
 
285
328
  Creating and maintaining open-source libraries is a passion of mine. If you find this `cloudfrontize` useful and it saves you time, please consider supporting its development. Your contributions help keep the project active and motivated!