[object Object]

← back to Stars of Design

starsofdesign: gzip compression middleware (threshold 1KB) — mirrors asim. JSON-LD-heavy /firms /designers /clients pages drop over the wire. Smoke 42/42.

13a504cdae267909684e705a2fe3bc10a533a73c · 2026-05-12 21:14:36 -0700 · Steve Abrams

Files touched

Diff

commit 13a504cdae267909684e705a2fe3bc10a533a73c
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue May 12 21:14:36 2026 -0700

    starsofdesign: gzip compression middleware (threshold 1KB) — mirrors asim. JSON-LD-heavy /firms /designers /clients pages drop over the wire. Smoke 42/42.
---
 package-lock.json | 40 ++++++++++++++++++++++++++++++++++++++++
 package.json      |  1 +
 server.js         |  5 +++++
 3 files changed, 46 insertions(+)

diff --git a/package-lock.json b/package-lock.json
index b93b82d..fa3fcba 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,6 +8,7 @@
       "name": "starsofdesign",
       "version": "0.1.0",
       "dependencies": {
+        "compression": "^1.8.1",
         "cookie-parser": "^1.4.7",
         "dotenv": "^16.6.1",
         "ejs": "^3.1.10",
@@ -156,6 +157,45 @@
         "url": "https://github.com/sponsors/ljharb"
       }
     },
+    "node_modules/compressible": {
+      "version": "2.0.18",
+      "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
+      "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==",
+      "license": "MIT",
+      "dependencies": {
+        "mime-db": ">= 1.43.0 < 2"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/compression": {
+      "version": "1.8.1",
+      "resolved": "https://registry.npmjs.org/compression/-/compression-1.8.1.tgz",
+      "integrity": "sha512-9mAqGPHLakhCLeNyxPkK4xVo746zQ/czLH1Ky+vkitMnWfWZps8r0qXuwhwizagCRttsL4lfG4pIOvaWLpAP0w==",
+      "license": "MIT",
+      "dependencies": {
+        "bytes": "3.1.2",
+        "compressible": "~2.0.18",
+        "debug": "2.6.9",
+        "negotiator": "~0.6.4",
+        "on-headers": "~1.1.0",
+        "safe-buffer": "5.2.1",
+        "vary": "~1.1.2"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/compression/node_modules/negotiator": {
+      "version": "0.6.4",
+      "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz",
+      "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
     "node_modules/content-disposition": {
       "version": "0.5.4",
       "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
diff --git a/package.json b/package.json
index 5894655..8cbca2b 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
     "smoke": "node test/smoke.js"
   },
   "dependencies": {
+    "compression": "^1.8.1",
     "cookie-parser": "^1.4.7",
     "dotenv": "^16.6.1",
     "ejs": "^3.1.10",
diff --git a/server.js b/server.js
index d665f1b..a474c9f 100644
--- a/server.js
+++ b/server.js
@@ -4,6 +4,7 @@ const express = require('express');
 const path = require('path');
 const morgan = require('morgan');
 const helmet = require('helmet');
+const compression = require('compression');
 const rateLimit = require('express-rate-limit');
 const cookieParser = require('cookie-parser');
 
@@ -19,6 +20,10 @@ app.set('view engine', 'ejs');
 app.set('views', path.join(__dirname, 'views'));
 app.disable('x-powered-by');
 
+// gzip compression for all responses ≥ 1KB. Mirror asim — JSON-LD-heavy
+// HTML pages drop significantly over the wire.
+app.use(compression({ threshold: 1024 }));
+
 // Security headers (HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy)
 app.use(helmet({
   contentSecurityPolicy: {

← a32feca starsofdesign: smoke — add /api discovery doc check (+2 asse  ·  back to Stars of Design  ·  starsofdesign: Cache-Control public max-age=3600 on /sitemap 0954ae8 →