From aa7b8938f990f249fd1efc6dc3b00056b5ae8f55 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 24 Jul 2026 22:42:11 -0400 Subject: [PATCH 01/35] Add Redis service configuration to docker-compose.yml --- docker-compose.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index a2e6510..18dcd2a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,13 @@ services: + redis: + image: redis:7-alpine + container_name: redis_cache + restart: unless-stopped + ports: + - "6379:6379" + command: redis-server --appendonly yes --requirepass "geogallery-redis" + volumes: + - redis_data:/data backend: container_name: globe-pin-backend build: @@ -17,3 +26,7 @@ services: - backend ports: - "8080:80" + +volumes: + redis_data: + driver: local From b2c34df6d812a38d76fddd30833c7176995359dd Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 24 Jul 2026 22:55:07 -0400 Subject: [PATCH 02/35] edited redis password and saved it privately --- docker-compose.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 18dcd2a..0e8263e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,9 @@ services: restart: unless-stopped ports: - "6379:6379" - command: redis-server --appendonly yes --requirepass "geogallery-redis" + environment: + - REDIS_PASSWORD=${REDIS_PASSWORD} + command: sh -c "redis-server --appendonly yes --requirepass \"$$REDIS_PASSWORD\"" volumes: - redis_data:/data backend: From 7218be165675af6ee773c56f6e16b14472281f4b Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Sat, 25 Jul 2026 20:19:12 -0400 Subject: [PATCH 03/35] Add Redis dependency to package.json and package-lock.json --- backend/package-lock.json | 100 +++++++++++++++++++++++++++++++++++++- backend/package.json | 3 +- 2 files changed, 101 insertions(+), 2 deletions(-) diff --git a/backend/package-lock.json b/backend/package-lock.json index a6dbcc2..4189a06 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -17,7 +17,8 @@ "dotenv": "^17.2.3", "express": "^5.2.1", "multer": "^2.0.2", - "pg": "^8.16.3" + "pg": "^8.16.3", + "redis": "^6.1.0" }, "devDependencies": { "@types/cors": "^2.8.19", @@ -596,6 +597,78 @@ ], "license": "MIT" }, + "node_modules/@redis/bloom": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-6.1.0.tgz", + "integrity": "sha512-Rzascjd9J9bJsM45T/Z9CTg1QY/B63B6YO8QorLVMeXnbBDsKiSCVR/+GQ061hYPk8FpTzWmPY8tAv2sT+JEtQ==", + "license": "MIT", + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@redis/client": "^6.1.0" + } + }, + "node_modules/@redis/client": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@redis/client/-/client-6.1.0.tgz", + "integrity": "sha512-7u1LefkezJF0HESlhO7ZFLEPfyY+NejP3SGv+Z4pGaT3oM5GVVLa0u3f4rDLUrcw+SRo8IlX9Y8JAONeDdg1Ag==", + "license": "MIT", + "dependencies": { + "cluster-key-slot": "1.1.2" + }, + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@node-rs/xxhash": "^1.1.0", + "@opentelemetry/api": ">=1 <2" + }, + "peerDependenciesMeta": { + "@node-rs/xxhash": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + } + } + }, + "node_modules/@redis/json": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@redis/json/-/json-6.1.0.tgz", + "integrity": "sha512-/GFjQA6bu5pG9ClCJAI5Xx4bNXe7UTpxBBlIupBNTrn1+nY860apGnYJuaSCDV2BmEbTidpa7O2qa28oxKx+rg==", + "license": "MIT", + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@redis/client": "^6.1.0" + } + }, + "node_modules/@redis/search": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@redis/search/-/search-6.1.0.tgz", + "integrity": "sha512-kS5agg+3yZbrdrt8omrew7FLCD8eOm7tarG1CROekPBRe+QGDR9aOpnHIQaYsYi6wPRTH70nQiF06AIjgURefQ==", + "license": "MIT", + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@redis/client": "^6.1.0" + } + }, + "node_modules/@redis/time-series": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-6.1.0.tgz", + "integrity": "sha512-uIDBtV8MmG/xpJsRqbGSO4iX6ryj37MLMP82lRpFvI7ykAVe5GyqgxigEbU+uZNv9kDPNMKw3dvI/S/J1BNBzA==", + "license": "MIT", + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@redis/client": "^6.1.0" + } + }, "node_modules/@smithy/core": { "version": "3.24.4", "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.24.4.tgz", @@ -1219,6 +1292,15 @@ "fsevents": "~2.3.2" } }, + "node_modules/cluster-key-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", + "integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -2453,6 +2535,22 @@ "node": ">=8.10.0" } }, + "node_modules/redis": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/redis/-/redis-6.1.0.tgz", + "integrity": "sha512-0kvUPM8RHP/ZMa0xYaDTcG5e8tIGW6kz6MToVT0V8iOnk6bkXp2jncGRGe2bZEk41lZwiDspUqjZCSk5ohjcKw==", + "license": "MIT", + "dependencies": { + "@redis/bloom": "6.1.0", + "@redis/client": "6.1.0", + "@redis/json": "6.1.0", + "@redis/search": "6.1.0", + "@redis/time-series": "6.1.0" + }, + "engines": { + "node": ">= 20.0.0" + } + }, "node_modules/resolve": { "version": "1.22.11", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", diff --git a/backend/package.json b/backend/package.json index 8e30a48..659a7b9 100644 --- a/backend/package.json +++ b/backend/package.json @@ -22,7 +22,8 @@ "dotenv": "^17.2.3", "express": "^5.2.1", "multer": "^2.0.2", - "pg": "^8.16.3" + "pg": "^8.16.3", + "redis": "^6.1.0" }, "devDependencies": { "@types/cors": "^2.8.19", From 86a54c29c5e99896f648d60bd312f5ce45afe077 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 31 Jul 2026 19:48:26 -0400 Subject: [PATCH 04/35] Add Redis client implementation and connection logic --- backend/src/redis.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 backend/src/redis.ts diff --git a/backend/src/redis.ts b/backend/src/redis.ts new file mode 100644 index 0000000..677649c --- /dev/null +++ b/backend/src/redis.ts @@ -0,0 +1,17 @@ +import { createClient } from "redis"; + +const redisUrl = process.env.REDIS_URL; + +export const redisClient = createClient({ + url: redisUrl, +}); + +redisClient.on("error", (error) => { + console.error("Redis client error:", error); +}); + +export const connectRedis = async () => { + if (!redisClient.isOpen) { + await redisClient.connect(); + } +}; \ No newline at end of file From ee415611d115a0759fd5c3a7c1899d010a333bbd Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 31 Jul 2026 20:42:09 -0400 Subject: [PATCH 05/35] Refactor server startup to include Redis connection and update docker-compose.yml to comment out Redis password configuration --- backend/src/index.ts | 16 +++++++++++++--- docker-compose.yml | 8 +++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 08e9df8..1339270 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1,7 +1,17 @@ +import { start } from "node:repl"; import app from "./app"; +import { connectRedis } from "./redis"; const PORT = Number(process.env.PORT) || 3001; -app.listen(PORT, () => { - console.log(`Server is running on http://localhost:${PORT}`); -}); \ No newline at end of file +const startServer = async () => { + await connectRedis(); + app.listen(PORT, () => { + console.log(`Server is running on http://localhost:${PORT}`); + }); +}; + +startServer().catch((error) => { + console.error("Failed to start server", error); + process.exit(1) +}) diff --git a/docker-compose.yml b/docker-compose.yml index 0e8263e..510b621 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,9 +5,9 @@ services: restart: unless-stopped ports: - "6379:6379" - environment: - - REDIS_PASSWORD=${REDIS_PASSWORD} - command: sh -c "redis-server --appendonly yes --requirepass \"$$REDIS_PASSWORD\"" + # environment: + # - REDIS_PASSWORD=${REDIS_URL} + # command: sh -c "redis-server --appendonly yes --requirepass \"$$REDIS_PASSWORD\"" volumes: - redis_data:/data backend: @@ -17,6 +17,8 @@ services: dockerfile: Dockerfile env_file: - ./backend/.env + depends_on: + - redis ports: - "3001:3001" From e972d3050edea54fd3f5a39e3c44d705bf1a9a2c Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 31 Jul 2026 22:47:48 -0400 Subject: [PATCH 06/35] Add comment to clarify Redis connection in server startup --- backend/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/index.ts b/backend/src/index.ts index 1339270..203d5f1 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -5,6 +5,7 @@ import { connectRedis } from "./redis"; const PORT = Number(process.env.PORT) || 3001; const startServer = async () => { + // Connect to Redis await connectRedis(); app.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); From ac7e2c19e7e7ecb0d9a912e2400a0e20b7c7b330 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 4 Aug 2026 13:15:51 -0400 Subject: [PATCH 07/35] Fixed backend connection to redis container issue --- backend/src/index.ts | 12 ++++++------ backend/src/routes/geocode.ts | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 203d5f1..73e0585 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1,18 +1,18 @@ -import { start } from "node:repl"; import app from "./app"; -import { connectRedis } from "./redis"; +import {connectRedis} from "./redis"; const PORT = Number(process.env.PORT) || 3001; const startServer = async () => { - // Connect to Redis await connectRedis(); + console.log("Connected to Redis"); + app.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); }); }; startServer().catch((error) => { - console.error("Failed to start server", error); - process.exit(1) -}) + console.error("Failed to start server:", error); + process.exit(1); +}); diff --git a/backend/src/routes/geocode.ts b/backend/src/routes/geocode.ts index 8a52efc..f69543e 100644 --- a/backend/src/routes/geocode.ts +++ b/backend/src/routes/geocode.ts @@ -23,6 +23,7 @@ router.get("/", async (req, res) => { const response = await axios.get(url); const place = response.data.features[0]?.place_name || "Unknown location"; + console.log("Geocode response:", place); res.json({ address: place }); }catch(error){ From 48d07b2de87ba53afc7cb5ce65c5fc6e01132322 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 4 Aug 2026 17:39:28 -0400 Subject: [PATCH 08/35] initial full redis cache implementation for reverse geocode results --- backend/src/routes/geocode.ts | 72 ++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/backend/src/routes/geocode.ts b/backend/src/routes/geocode.ts index f69543e..b9b09b6 100644 --- a/backend/src/routes/geocode.ts +++ b/backend/src/routes/geocode.ts @@ -1,35 +1,55 @@ -import axios from 'axios'; -import {Router} from 'express'; -import dotenv from 'dotenv'; +import axios from "axios"; +import { Router } from "express"; +import dotenv from "dotenv"; +import { redisClient } from "../redis"; dotenv.config(); const router = Router(); router.get("/", async (req, res) => { - // console.log("Geocode route called"); - const { latitude, longitude } = req.query; - - if (!latitude || !longitude) { - return res.status(400).json({ error: "Latitude and longitude are required" }); + // console.log("Geocode route called"); + const { latitude, longitude } = req.query; + + if (!latitude || !longitude) { + return res + .status(400) + .json({ error: "Latitude and longitude are required" }); + } + const lat = Number(latitude); + const lng = Number(longitude); + + if (!Number.isFinite(lat) || !Number.isFinite(lng)) { + return res + .status(400) + .json({ error: "Latitude and longitude must be valid numbers" }); + } + + const cacheKey = `geocode:v1:${lat.toFixed(5)}:${lng.toFixed(5)}`; + try { + // const response = await fetch(url); + // const data = await response.json(); + const cachedData = await redisClient.get(cacheKey); + if (cachedData) { + console.log("Cache hit for geocode data", cachedData); + return res.json(JSON.parse(cachedData)); } + console.log("Cache miss for geocode data, fetching from Mapbox API"); const MAPBOX_TOKEN = process.env.VITE_MAPBOX_TOKEN; - const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${longitude},${latitude}.json?access_token=${MAPBOX_TOKEN}`; - - try{ - // const response = await fetch(url); - // const data = await response.json(); - - const response = await axios.get(url); - const place = response.data.features[0]?.place_name || "Unknown location"; - console.log("Geocode response:", place); - res.json({ address: place }); - - }catch(error){ - console.error("Error fetching geocode data:", error); - res.status(500).json({ error: "Internal server error" }); - } -}) - -export default router; \ No newline at end of file + const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${lng},${lat}.json?access_token=${MAPBOX_TOKEN}`; + + const response = await axios.get(url); + const place = response.data.features[0]?.place_name || "Unknown location"; + console.log("Geocode response:", place); + await redisClient.set(cacheKey, JSON.stringify({ address: place }), { + EX: 60 * 5, + }); + return res.json({ address: place }); + } catch (error) { + console.error("Error fetching geocode data:", error); + res.status(500).json({ error: "Internal server error" }); + } +}); + +export default router; From fed879341c0c98c46486d7537a4903b750b2198e Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 4 Aug 2026 19:35:45 -0400 Subject: [PATCH 09/35] Add timing logs for cache hits and misses in geocode route --- backend/src/routes/geocode.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/routes/geocode.ts b/backend/src/routes/geocode.ts index b9b09b6..10eed73 100644 --- a/backend/src/routes/geocode.ts +++ b/backend/src/routes/geocode.ts @@ -9,6 +9,8 @@ const router = Router(); router.get("/", async (req, res) => { // console.log("Geocode route called"); + const start = Date.now(); + const { latitude, longitude } = req.query; if (!latitude || !longitude) { @@ -31,6 +33,7 @@ router.get("/", async (req, res) => { // const data = await response.json(); const cachedData = await redisClient.get(cacheKey); if (cachedData) { + console.log(`Cache hit took ${Date.now() - start}ms`); console.log("Cache hit for geocode data", cachedData); return res.json(JSON.parse(cachedData)); } @@ -45,6 +48,7 @@ router.get("/", async (req, res) => { await redisClient.set(cacheKey, JSON.stringify({ address: place }), { EX: 60 * 5, }); + console.log(`Cache miss took ${Date.now() - start}ms`); return res.json({ address: place }); } catch (error) { console.error("Error fetching geocode data:", error); From 1e28f72bccc013fc9b09dc30a6fd2e9ea248360a Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 4 Aug 2026 19:54:33 -0400 Subject: [PATCH 10/35] chore: update dependencies in package.json - Added @types/supertest and supertest for improved testing capabilities. - Introduced vitest for enhanced testing framework support. --- backend/package-lock.json | 1362 ++++++++++++++++++++++++++++++++++++- backend/package.json | 5 +- 2 files changed, 1357 insertions(+), 10 deletions(-) diff --git a/backend/package-lock.json b/backend/package-lock.json index 4189a06..f40efa5 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -26,8 +26,11 @@ "@types/multer": "^2.0.0", "@types/node": "^25.0.3", "@types/pg": "^8.16.0", + "@types/supertest": "^7.2.1", + "supertest": "^7.2.2", "ts-node-dev": "^2.0.0", - "typescript": "^5.9.3" + "typescript": "^5.9.3", + "vitest": "^4.1.10" } }, "node_modules/@aws-crypto/crc32": { @@ -585,6 +588,19 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@nodable/entities": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.1.0.tgz", @@ -597,6 +613,26 @@ ], "license": "MIT" }, + "node_modules/@oxc-project/types": { + "version": "0.142.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.142.0.tgz", + "integrity": "sha512-7W+2q5AKQVU36fkaryontrHn3YDt1RyUYXatw9i5H8ocYe2sPKSFB6eS8WNPeRKiN1qAWWZUPm7gwFzJGrccqQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + } + }, + "node_modules/@paralleldrive/cuid2": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.3.1.tgz", + "integrity": "sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "^1.1.5" + } + }, "node_modules/@redis/bloom": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-6.1.0.tgz", @@ -669,6 +705,251 @@ "@redis/client": "^6.1.0" } }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.2.tgz", + "integrity": "sha512-l7x215OGvo1s52JWmR8U/DAVzEDWBCIbTm28aeJV/WDTSHgcKXaZTuBT0hJMs5NggilfJTW3clZVvd24yfKJxA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.2.tgz", + "integrity": "sha512-9u9Xv6c1AJZT0FfwH5vrMG5Jjcwhc1MlyrPu0XfTqkzsmqfks2M6W/o5XwAJgVVN/jHpqqngC1WevHKKTIUtIA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.2.tgz", + "integrity": "sha512-9W1mbGZAfW3oqd85bhBkmpyHCCzL1TeG/zFFP3vg7b0rlly8cxOcre5nXwz+LHazCwac2MNWgPdPCHndABjpWQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.2.tgz", + "integrity": "sha512-0p1lhiCSCyaerFwtrdZQUx7NqGk6LQnaRKWX7tFQqwQgvX0rjM15cIkm3pax1UpEakK14C4mOxx/jSqCBdBRqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.2.tgz", + "integrity": "sha512-e+cOJXrJ2L3zx6YzqPg+f6Wbk3V1cKB8bOhbaYdVYN3DdquzNdRAmrbETz1qnt5yp/c7JNlNjmITiA2cVneQ7w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.2.tgz", + "integrity": "sha512-JsSMsj6sNat/MuhG5fnBD7QgbtpHKVe30x5/bAVirDHdhoQRXJkF6xc0Jqk8O4fiCUQAzMOoH9wZi3m60c8wtg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.2.tgz", + "integrity": "sha512-B5G/zJdHaoJn9vD50eGHWkiWfmq8Uhi3IiLPJTzmZTrAalk1bztUikSXo0qga18ibE0IXboyeMUnhPjhAJ45wQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.2.tgz", + "integrity": "sha512-6mC/awzKka8W6EoekjegpfGkjz8jXWDX63pqu/HYVpyKtZfu65Jsh4QAH3Kej3CAv/c1oGX7psTmFEbr0mDxLA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.2.tgz", + "integrity": "sha512-412MX9fJLdA1IK28EZnc8jYv2HRTleOZgfLQumJ5zy7OeJLZlg/CETwFaXjNmGVxG51cFHpKLqb5LKvBC+HsHA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.2.tgz", + "integrity": "sha512-Q/+HI/ToJafZ1iCqGgVQXUEkIjufHCTF0gBQ2a5o3cg7GJ2h0qyq3nvvSmU+bGda2/7ygXpTY4TM6gO9OhQ0ZA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.2.tgz", + "integrity": "sha512-ZKp/w41n6wCvxzxQHtQSbuphfX3Y4cCvbjkKHusrLx4lh+JWLTU7StSltO/DKARISzbj368d+qUaCjI8K2wzXw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.2.tgz", + "integrity": "sha512-pxE6xD4KS3eAROkKK5yrhB9/3+vhlhVGMvlQLbdpzrBGDbKrnzx3RLwPaHvasLo6jgaiBLn7e04Df9C4tYhjmA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.2.tgz", + "integrity": "sha512-4MqEue5re+xIZzAWsB8sj0P1kqZySWqIuN4t6QaIO/YA6SFwySOLruvWQFzfmqk8LBK2P30KCSJwf6mJCZZ5/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.2.tgz", + "integrity": "sha512-NweNxxD0Nf9t8v7kodun45Ijp3EIwYY+uydPP6qBEYvfBqhIjN6dZMzlQja3tqX/aLs3F3Uz+AxDpKgRhpOZQg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, "node_modules/@smithy/core": { "version": "3.24.4", "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.24.4.tgz", @@ -789,6 +1070,13 @@ "node": ">=14.0.0" } }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, "node_modules/@supabase/auth-js": { "version": "2.91.1", "resolved": "https://registry.npmjs.org/@supabase/auth-js/-/auth-js-2.91.1.tgz", @@ -908,6 +1196,17 @@ "@types/node": "*" } }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, "node_modules/@types/connect": { "version": "3.4.38", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", @@ -918,6 +1217,13 @@ "@types/node": "*" } }, + "node_modules/@types/cookiejar": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.5.tgz", + "integrity": "sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/cors": { "version": "2.8.19", "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", @@ -928,6 +1234,20 @@ "@types/node": "*" } }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/express": { "version": "5.0.6", "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.6.tgz", @@ -960,6 +1280,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/methods": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@types/methods/-/methods-1.1.4.tgz", + "integrity": "sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/multer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@types/multer/-/multer-2.0.0.tgz", @@ -1046,6 +1373,30 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/superagent": { + "version": "8.1.11", + "resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-8.1.11.tgz", + "integrity": "sha512-KA7srSW/HENDtOw9DOqaFLgWuMqN9WgjEw62lh9dpvRaZDkhdOkazASd7X7i2eMUYLHa1U37ZttnePsH5zTDHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/cookiejar": "^2.1.5", + "@types/methods": "^1.1.4", + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "node_modules/@types/supertest": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/@types/supertest/-/supertest-7.2.1.tgz", + "integrity": "sha512-4CbBvoYVLHL7+yhbYrZET0vsvuyXTC05aRe7dNQkwMzm56auceoy6Yu3K50uZmwfHna1os3CMSgM/3QVkUtPTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/methods": "^1.1.4", + "@types/superagent": "^8.1.0" + } + }, "node_modules/@types/ws": { "version": "8.18.1", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", @@ -1055,6 +1406,119 @@ "@types/node": "*" } }, + "node_modules/@vitest/expect": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.10.tgz", + "integrity": "sha512-YsCn+qAk1GWjQOWFEsEcL2gNQ0zmVmQu3T03qP6UyjhtmdtwtbuI+DASn/7iQB3HGTXkdBwGddzxPlmiql5vlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.10", + "@vitest/utils": "4.1.10", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.10.tgz", + "integrity": "sha512-v0xaezt+DKEmKfaxg133ldzADrwLGd7Ze1MfQQTYfvs8OqZIwbxyxaYURivwV7sWy5fqn3rH5uOrSp07bp44Ow==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.1.10", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.10.tgz", + "integrity": "sha512-W1HsjSH4MXQ9YfmmhLAoIYf1HRfekQCGngeIgcei6MP5QQGWUe0gkopdZQaVCFO+JDJMrAJGwa5pRpNpvy4P8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.10.tgz", + "integrity": "sha512-IKI6kpIH+LmpROplyLwBBaCfMgOZOMsygVa6BARD6ahA04VRuJSa6OaVG7kRvSEMD870Vd91rSSw0eegtWyLGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.1.10", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.10.tgz", + "integrity": "sha512-xRkfOT1qpTAi/Ti4Y1LtfRc3kEuqxGw59eN2jN9pRWMtS/XDevekhcFSqvQqjUNGksfjMJu3Y+oJ+4Ypn2OaJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.10", + "@vitest/utils": "4.1.10", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.10.tgz", + "integrity": "sha512-PLf/Ugvoq5wO/b4rwYCR1h2PSIdXz7wnkQFMiUpLdtM7l6pqVFcQIBEHyT1+l+cj7mNwAfZHzqXqDyjvOuwbDw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.10.tgz", + "integrity": "sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.10", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, "node_modules/accepts": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", @@ -1121,6 +1585,23 @@ "dev": true, "license": "MIT" }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true, + "license": "MIT" + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1267,6 +1748,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -1313,6 +1804,16 @@ "node": ">= 0.8" } }, + "node_modules/component-emitter": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz", + "integrity": "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1357,6 +1858,13 @@ "node": ">= 0.6" } }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, "node_modules/cookie": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", @@ -1375,6 +1883,13 @@ "node": ">=6.6.0" } }, + "node_modules/cookiejar": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", + "dev": true, + "license": "MIT" + }, "node_modules/cors": { "version": "2.8.5", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", @@ -1430,6 +1945,27 @@ "node": ">= 0.8" } }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/dezalgo": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", + "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", + "dev": true, + "license": "ISC", + "dependencies": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -1509,6 +2045,13 @@ "node": ">= 0.4" } }, + "node_modules/es-module-lexer": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.1.tgz", + "integrity": "sha512-shc1dbU90Yl/xq1QrC7QRtfcwURZuVRfPhZbDoldJ1cn1gzDvBaBWlv0eFolj5+0znnPJz5TXLxsN77X/12KTA==", + "dev": true, + "license": "MIT" + }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", @@ -1542,6 +2085,16 @@ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", "license": "MIT" }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -1551,6 +2104,16 @@ "node": ">= 0.6" } }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/express": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", @@ -1594,6 +2157,13 @@ "url": "https://opencollective.com/express" } }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-xml-builder": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.2.0.tgz", @@ -1722,6 +2292,24 @@ "node": ">= 0.6" } }, + "node_modules/formidable": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.4.tgz", + "integrity": "sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@paralleldrive/cuid2": "^2.2.2", + "dezalgo": "^1.0.4", + "once": "^1.4.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "url": "https://ko-fi.com/tunnckoCore/commissions" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -2034,6 +2622,277 @@ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", "license": "MIT" }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -2059,16 +2918,39 @@ "node": ">= 0.8" } }, - "node_modules/merge-descriptors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", - "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "dev": true, "license": "MIT", - "engines": { - "node": ">=18" + "bin": { + "mime": "cli.js" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">=4.0.0" } }, "node_modules/mime-db": { @@ -2197,6 +3079,25 @@ "node": ">= 0.6" } }, + "node_modules/nanoid": { + "version": "3.3.17", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.17.tgz", + "integrity": "sha512-xQLf0A3HOMlgHq0n247/LRuAOYmB7dXJ/DvAxGvsSBij45XtBSmQycu+F8ODbHwns/XyFZagyL1+J0Offw1E0g==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/negotiator": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", @@ -2237,6 +3138,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/obug": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.4.tgz", + "integrity": "sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -2309,6 +3224,13 @@ "url": "https://opencollective.com/express" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, "node_modules/pg": { "version": "8.16.3", "resolved": "https://registry.npmjs.org/pg/-/pg-8.16.3.tgz", @@ -2398,6 +3320,13 @@ "split2": "^4.1.0" } }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -2411,6 +3340,35 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/postcss": { + "version": "8.5.25", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.25.tgz", + "integrity": "sha512-DTPx3RWSSnWyzLxQnlH0rJP+EW5ekl16ZU4/psbIhA0e53kJfdgaN5vKM+xP7yJtXVu+nfdVFmlgFDEKAe4Pyw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.16", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/postgres-array": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", @@ -2586,6 +3544,39 @@ "rimraf": "bin.js" } }, + "node_modules/rolldown": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.2.tgz", + "integrity": "sha512-opwpo1tQBAcpSUJDt94B7hhLNGOKjCdE//XXjeLrnx9b83bjnw45tXdg1b09yEw/VLFBJGZpwRULMmOZo7ol+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.142.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm64": "1.2.2", + "@rolldown/binding-darwin-arm64": "1.2.2", + "@rolldown/binding-darwin-x64": "1.2.2", + "@rolldown/binding-freebsd-x64": "1.2.2", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.2", + "@rolldown/binding-linux-arm64-gnu": "1.2.2", + "@rolldown/binding-linux-arm64-musl": "1.2.2", + "@rolldown/binding-linux-ppc64-gnu": "1.2.2", + "@rolldown/binding-linux-s390x-gnu": "1.2.2", + "@rolldown/binding-linux-x64-gnu": "1.2.2", + "@rolldown/binding-linux-x64-musl": "1.2.2", + "@rolldown/binding-openharmony-arm64": "1.2.2", + "@rolldown/binding-win32-arm64-msvc": "1.2.2", + "@rolldown/binding-win32-x64-msvc": "1.2.2" + } + }, "node_modules/router": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", @@ -2751,6 +3742,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -2761,6 +3759,16 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -2781,6 +3789,13 @@ "node": ">= 10.x" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, "node_modules/statuses": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", @@ -2790,6 +3805,13 @@ "node": ">= 0.8" } }, + "node_modules/std-env": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz", + "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==", + "dev": true, + "license": "MIT" + }, "node_modules/streamsearch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", @@ -2839,6 +3861,42 @@ ], "license": "MIT" }, + "node_modules/superagent": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-10.3.0.tgz", + "integrity": "sha512-B+4Ik7ROgVKrQsXTV0Jwp2u+PXYLSlqtDAhYnkkD+zn3yg8s/zjA2MeGayPoY/KICrbitwneDHrjSotxKL+0XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "component-emitter": "^1.3.1", + "cookiejar": "^2.1.4", + "debug": "^4.3.7", + "fast-safe-stringify": "^2.1.1", + "form-data": "^4.0.5", + "formidable": "^3.5.4", + "methods": "^1.1.2", + "mime": "2.6.0", + "qs": "^6.14.1" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/supertest": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/supertest/-/supertest-7.2.2.tgz", + "integrity": "sha512-oK8WG9diS3DlhdUkcFn4tkNIiIbBx9lI2ClF8K+b2/m8Eyv47LSawxUzZQSNKUrVb2KsqeTDCcjAAVPYaSLVTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cookie-signature": "^1.2.2", + "methods": "^1.1.2", + "superagent": "^10.3.0" + }, + "engines": { + "node": ">=14.18.0" + } + }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -2852,6 +3910,81 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.0.tgz", + "integrity": "sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/tinyrainbow": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.1.tgz", + "integrity": "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -3066,6 +4199,217 @@ "node": ">= 0.8" } }, + "node_modules/vite": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.0.tgz", + "integrity": "sha512-pn+CFpM0lwDeKwmOq1ZaBK/9sjorZcgqxki6MbY/jPEVd9vichIlmlD4HmQ5wdP5EgqQCFRaACBxMC7uEGc6lQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.5", + "postcss": "^8.5.23", + "rolldown": "~1.2.0", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.4.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/vitest": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.10.tgz", + "integrity": "sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.1.10", + "@vitest/mocker": "4.1.10", + "@vitest/pretty-format": "4.1.10", + "@vitest/runner": "4.1.10", + "@vitest/snapshot": "4.1.10", + "@vitest/spy": "4.1.10", + "@vitest/utils": "4.1.10", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.1.10", + "@vitest/browser-preview": "4.1.10", + "@vitest/browser-webdriverio": "4.1.10", + "@vitest/coverage-istanbul": "4.1.10", + "@vitest/coverage-v8": "4.1.10", + "@vitest/ui": "4.1.10", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/vitest/node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/backend/package.json b/backend/package.json index 659a7b9..96d9f17 100644 --- a/backend/package.json +++ b/backend/package.json @@ -31,7 +31,10 @@ "@types/multer": "^2.0.0", "@types/node": "^25.0.3", "@types/pg": "^8.16.0", + "@types/supertest": "^7.2.1", + "supertest": "^7.2.2", "ts-node-dev": "^2.0.0", - "typescript": "^5.9.3" + "typescript": "^5.9.3", + "vitest": "^4.1.10" } } From f2462f6346e061c3c157255e2283d8bbcc7e54da Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Wed, 5 Aug 2026 22:18:46 -0400 Subject: [PATCH 11/35] Add tests for geocode route with caching logic --- backend/package.json | 3 +- backend/src/__tests__/geocode.test.ts | 87 +++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 backend/src/__tests__/geocode.test.ts diff --git a/backend/package.json b/backend/package.json index 96d9f17..abef840 100644 --- a/backend/package.json +++ b/backend/package.json @@ -5,7 +5,8 @@ "scripts": { "build": "tsc -p tsconfig.json", "start": "node dist/index.js", - "test": "echo \"Error: no test specified\" && exit 1", + "test": "vitest run", + "test:watch": "vitest", "dev": "ts-node-dev src/index.ts", "migrate:s3": "ts-node-dev --exit-child --transpile-only src/scripts/migrateSupabaseImagesToS3.ts" }, diff --git a/backend/src/__tests__/geocode.test.ts b/backend/src/__tests__/geocode.test.ts new file mode 100644 index 0000000..3e5e738 --- /dev/null +++ b/backend/src/__tests__/geocode.test.ts @@ -0,0 +1,87 @@ +import express from "express"; +import request from "supertest"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import axios from "axios"; +import geocodeRoutes from "../routes/geocode"; +import { redisClient } from "../redis"; + +vi.mock("axios"); + +vi.mock("../redis", () => ({ + redisClient: { + get: vi.fn(), + set: vi.fn(), + }, +})); + +const mockedAxios = vi.mocked(axios); + +const createTestApp = () => { + const app = express(); + app.use("/geocode", geocodeRoutes); + return app; +}; + +describe("GET /geocode", () => { + beforeEach(() => { + vi.clearAllMocks(); + process.env.VITE_MAPBOX_TOKEN = "test-mapbox-token"; + }); + + it("fetches from Mapbox and caches the result on a cache miss", async () => { + vi.mocked(redisClient.get).mockResolvedValue(null); + + mockedAxios.get.mockResolvedValue({ + data: { + features: [ + { + place_name: "New York, New York, United States", + }, + ], + }, + }); + + const app = createTestApp(); + + const response = await request(app) + .get("/geocode") + .query({ latitude: "40.7128", longitude: "-74.0060" }); + + expect(response.status).toBe(200); + expect(response.body).toEqual({ + address: "New York, New York, United States", + }); + + expect(redisClient.get).toHaveBeenCalledWith( + "geocode:v1:40.71280:-74.00600", + ); + + expect(mockedAxios.get).toHaveBeenCalledTimes(1); + + expect(redisClient.set).toHaveBeenCalledWith( + "geocode:v1:40.71280:-74.00600", + JSON.stringify({ address: "New York, New York, United States" }), + { EX: 60 * 5 }, + ); + }); + + it("returns cached data without calling Mapbox on a cache hit", async () => { + vi.mocked(redisClient.get).mockResolvedValue( + JSON.stringify({ address: "Cached New York Address" }), + ); + + const app = createTestApp(); + + const response = await request(app) + .get("/geocode") + .query({ latitude: "40.7128", longitude: "-74.0060" }); + + expect(response.status).toBe(200); + expect(response.body).toEqual({ + address: "Cached New York Address", + }); + + expect(mockedAxios.get).not.toHaveBeenCalled(); + expect(redisClient.set).not.toHaveBeenCalled(); + }); +}); \ No newline at end of file From 51fc7bb3d4c1a3adcb87833d89724e8ec4cf190e Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Wed, 5 Aug 2026 23:55:06 -0400 Subject: [PATCH 12/35] Update README to include Redis caching details for reverse geocoding --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 96acb07..0320c1e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ interactive global map. The project was originally developed as Globe Pin and combines a React frontend with an Express API, Supabase authentication and data storage, Amazon -S3 image storage, and Mapbox mapping services. +S3 image storage, Redis caching, and Mapbox mapping services. ## Features @@ -39,11 +39,13 @@ S3 image storage, and Mapbox mapping services. - TypeScript - Multer for image uploads - AWS SDK for S3 +- Redis for backend caching ### Services - Supabase Auth and Postgres - Amazon S3 +- Redis / Render Key Value - Mapbox - Google Maps Platform - Vercel for the frontend @@ -60,6 +62,7 @@ Browser `-- Express API |-- Supabase Postgres |-- Amazon S3 + |-- Redis cache `-- Mapbox Geocoding API ``` @@ -68,6 +71,12 @@ the Express API. The API uploads the image to S3 and stores its object key with the post data in Supabase. When posts are requested, the API generates signed S3 URLs and returns them to the frontend. +Reverse geocoding requests are cached with Redis. When the frontend asks for a +readable address from latitude and longitude coordinates, the API first checks +Redis using a rounded coordinate cache key. Cache hits return immediately from +Redis, while cache misses call the Mapbox Geocoding API, store the result in +Redis with a TTL, and then return it to the frontend. + ## Project Structure ```text @@ -79,6 +88,7 @@ Globe-Pin/ | | |-- scripts/ # Data migration utilities | | |-- app.ts # Express application | | |-- db.ts # Supabase server client +| | |-- redis.ts # Redis client | | `-- s3.ts # Amazon S3 client | |-- Dockerfile | `-- package.json @@ -111,12 +121,19 @@ AWS_ACCESS_KEY_ID=your_aws_access_key_id AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key AWS_REGION=your_aws_region AWS_S3_BUCKET=your_s3_bucket_name +REDIS_URL=redis://redis:6379 FRONTEND_URL=http://localhost:8080 ``` Do not commit either `.env` file. The Supabase service-role key and AWS credentials must only be used by the backend. +Use `REDIS_URL=redis://redis:6379` when the backend runs inside Docker Compose. +Use `REDIS_URL=redis://localhost:6379` when the backend runs locally with +`npm run dev --prefix backend` and only the Redis container is running in +Docker. In production on Render, use the internal URL from the Render Key Value +instance. + ## Run With Docker Docker is the recommended way to run the complete application. @@ -127,7 +144,7 @@ Docker is the recommended way to run the complete application. - Supabase, AWS, Mapbox, and Google Maps credentials - The two environment files described above -From the project root, build and start both services: +From the project root, build and start all services: ```bash docker compose up --build @@ -138,6 +155,7 @@ Open: ```text Frontend: http://localhost:8080 Backend: http://localhost:3001 +Redis: localhost:6379 ``` The Docker images install their own npm dependencies, so a local @@ -181,6 +199,14 @@ npm run dev The frontend development server is available at `http://localhost:5173`. When using this mode, set `FRONTEND_URL=http://localhost:5173` in `backend/.env`. +If Redis is running through Docker while the backend runs locally, set +`REDIS_URL=redis://localhost:6379`. + +To run only Redis through Docker for local backend development: + +```bash +docker compose up redis +``` ## Available Commands @@ -218,5 +244,28 @@ The script: - Downloads missing images from Supabase Storage - Uploads them to the configured S3 bucket -n Vercel and -Render. Local `.env` files are not uploaded to either platform. +## Reverse Geocoding Cache + +The `/geocode` route uses Redis to cache Mapbox reverse-geocoding responses. +The cache key is based on rounded coordinates: + +```text +geocode:v1:: +``` + +Example: + +```text +geocode:v1:40.71280:-74.00600 +``` + +The first request for a coordinate pair is a cache miss, so the API calls +Mapbox and stores the address in Redis. Later requests for the same rounded +coordinates are cache hits, so the API returns the cached address without +calling Mapbox again. + +This improves response time for frequently viewed posts, reduces repeated +external API calls, and lowers the chance of hitting Mapbox rate limits. + +Deployment is handled by Vercel and Render. Local `.env` files are not uploaded +to either platform. From f383cfecf73164b3ab9094518b9823f3b7eea22c Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 11 Aug 2026 19:53:14 -0400 Subject: [PATCH 13/35] Implement Redis caching for S3 signed URLs in image retrieval --- backend/src/routes/posts.ts | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/backend/src/routes/posts.ts b/backend/src/routes/posts.ts index 9e29088..843156e 100644 --- a/backend/src/routes/posts.ts +++ b/backend/src/routes/posts.ts @@ -2,6 +2,7 @@ import { Router } from "express"; import multer from "multer"; import { supabase } from "../db"; +import { redisClient } from "../redis"; const router = Router(); const upload = multer(); // For parsing multipart/form-data @@ -15,11 +16,25 @@ import { import { getSignedUrl } from "@aws-sdk/s3-request-presigner"; import { s3, bucketName } from "../s3"; +const SIGNED_URL_EXPIRES_IN_SECONDS = 60 * 60 * 24 * 7; // 7 days +const SIGNED_URL_CACHE_TTL_SECONDS = 60 * 60 * 24 * 6; // 6 days + const getImageUrl = async (imagePath: string | null) => { if (!imagePath) { return null; } + const cacheKey = `s3:signed-url:v1:${imagePath}`; + + const cachedUrl = await redisClient.get(cacheKey); + + if (cachedUrl) { + console.log("S3 signed URL cache hit:", cacheKey); + return cachedUrl; + } + + console.log("S3 signed URL cache miss:", cacheKey); + await s3.send( new HeadObjectCommand({ Bucket: bucketName, @@ -27,16 +42,21 @@ const getImageUrl = async (imagePath: string | null) => { }), ); - return getSignedUrl( + const signedUrl = await getSignedUrl( s3, new GetObjectCommand({ Bucket: bucketName, Key: imagePath, }), - { expiresIn: 604800 }, + { expiresIn: SIGNED_URL_EXPIRES_IN_SECONDS }, ); -}; + await redisClient.set(cacheKey, signedUrl, { + EX: SIGNED_URL_CACHE_TTL_SECONDS, + }); + + return signedUrl; +}; router.get("/", async (req, res) => { const { user_id } = req.query; From 5d679e4402f75e23fc7cf00e553b3a8c786d7db6 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 11 Aug 2026 22:13:36 -0400 Subject: [PATCH 14/35] Remove signed URL from Redis cache upon image deletion --- backend/src/routes/posts.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/routes/posts.ts b/backend/src/routes/posts.ts index 843156e..5ca91be 100644 --- a/backend/src/routes/posts.ts +++ b/backend/src/routes/posts.ts @@ -178,6 +178,7 @@ router.delete("/:id", async (req, res) => { Key: postData.image_url, }), ); + await redisClient.del(`s3:signed-url:v1:${postData.image_url}`); } catch (error) { console.error("Error removing image from storage:", error); } From b9b3b6f9eedce8620758fd1bcd0e64a340f9db97 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 11 Aug 2026 22:22:44 -0400 Subject: [PATCH 15/35] Refactor comments for clarity and consistency in posts route --- backend/src/routes/posts.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/backend/src/routes/posts.ts b/backend/src/routes/posts.ts index 5ca91be..f643a3f 100644 --- a/backend/src/routes/posts.ts +++ b/backend/src/routes/posts.ts @@ -1,4 +1,4 @@ -// Upload, Delete and Image Retrieval logic +// Upload, delete, and image retrieval logic. import { Router } from "express"; import multer from "multer"; import { supabase } from "../db"; @@ -17,6 +17,7 @@ import { getSignedUrl } from "@aws-sdk/s3-request-presigner"; import { s3, bucketName } from "../s3"; const SIGNED_URL_EXPIRES_IN_SECONDS = 60 * 60 * 24 * 7; // 7 days +// Keep Redis shorter than the S3 URL lifetime so cached URLs expire first. const SIGNED_URL_CACHE_TTL_SECONDS = 60 * 60 * 24 * 6; // 6 days const getImageUrl = async (imagePath: string | null) => { @@ -26,6 +27,7 @@ const getImageUrl = async (imagePath: string | null) => { const cacheKey = `s3:signed-url:v1:${imagePath}`; + // Reuse signed URLs while they are still safely inside their expiration window. const cachedUrl = await redisClient.get(cacheKey); if (cachedUrl) { @@ -35,6 +37,7 @@ const getImageUrl = async (imagePath: string | null) => { console.log("S3 signed URL cache miss:", cacheKey); + // Verify the object exists before generating a URL that the frontend will use. await s3.send( new HeadObjectCommand({ Bucket: bucketName, @@ -51,6 +54,7 @@ const getImageUrl = async (imagePath: string | null) => { { expiresIn: SIGNED_URL_EXPIRES_IN_SECONDS }, ); + // Store the generated access URL so future post fetches can skip signing work. await redisClient.set(cacheKey, signedUrl, { EX: SIGNED_URL_CACHE_TTL_SECONDS, }); @@ -100,7 +104,8 @@ router.post("/", upload.single("image"), async (req, res) => { const fileExtension = imageFile.originalname.split(".").pop(); const fileName = `${user_id}-${Date.now()}.${fileExtension}`; - // Upload image FIRST + // Upload the image before inserting the post so the database never points + // at an object that failed to upload. try { await s3.send( new PutObjectCommand({ @@ -115,7 +120,7 @@ router.post("/", upload.single("image"), async (req, res) => { return res.status(500).json({ error: "Failed to upload image" }); } - // ONLY if image succeeds, insert into database + // Only after the S3 upload succeeds do we persist the post metadata. const createdAt = new Date().toISOString(); const { error: insertError } = await supabase.from("posts").insert({ user_id, @@ -129,7 +134,7 @@ router.post("/", upload.single("image"), async (req, res) => { if (insertError) { console.error("Database insert error:", insertError); - // Delete image if database fails + // Roll back the uploaded object if the database insert fails. await s3 .send( new DeleteObjectCommand({ @@ -155,7 +160,7 @@ router.delete("/:id", async (req, res) => { return res.status(400).json({ error: "Invalid post ID" }); } - // 1. Fetch the post to get the image_url + // Fetch the S3 object key before deleting the row so storage can be cleaned up. const { data: postData, error: fetchError } = await supabase .from("posts") .select("image_url") @@ -169,7 +174,7 @@ router.delete("/:id", async (req, res) => { return res.status(404).json({ error: "Post not found" }); } - // 2. Remove the image from S3 + // Remove the image and invalidate its cached signed URL. if (postData.image_url) { try { await s3.send( @@ -184,7 +189,7 @@ router.delete("/:id", async (req, res) => { } } - // 3. Delete the post + // Delete the database row after storage cleanup has been attempted. const { data, error } = await supabase .from("posts") .delete() From eda03535e5d301fb84cbeff86d7a63823c364e7b Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Wed, 12 Aug 2026 21:11:24 -0400 Subject: [PATCH 16/35] Update README to enhance Redis caching documentation for S3 signed URLs and reverse geocoding --- README.md | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0320c1e..6a4ac10 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,9 @@ Browser When a user creates a post, the frontend sends the photo and post details to the Express API. The API uploads the image to S3 and stores its object key with the post data in Supabase. When posts are requested, the API generates signed -S3 URLs and returns them to the frontend. +S3 URLs and returns them to the frontend. Signed S3 URLs are cached in Redis so +repeated post fetches can reuse valid access URLs instead of regenerating them +for every image. Reverse geocoding requests are cached with Redis. When the frontend asks for a readable address from latitude and longitude coordinates, the API first checks @@ -244,7 +246,11 @@ The script: - Downloads missing images from Supabase Storage - Uploads them to the configured S3 bucket -## Reverse Geocoding Cache +## Redis Caching + +Redis is used for backend caches that avoid repeated external service work. + +### Reverse Geocoding The `/geocode` route uses Redis to cache Mapbox reverse-geocoding responses. The cache key is based on rounded coordinates: @@ -267,5 +273,33 @@ calling Mapbox again. This improves response time for frequently viewed posts, reduces repeated external API calls, and lowers the chance of hitting Mapbox rate limits. +### S3 Signed URLs + +The `/api/posts` route uses Redis to cache signed S3 URLs for post images. +Supabase stores the S3 object key for each post, and the backend turns that key +into a temporary signed URL that the frontend can use in image tags. + +The cache key is based on the S3 object key: + +```text +s3:signed-url:v1: +``` + +Example: + +```text +s3:signed-url:v1:user-id-1720000000000.jpg +``` + +On a cache miss, the API verifies the object exists in S3, generates a signed +URL, stores it in Redis, and returns it with the post data. On a cache hit, the +API returns the cached signed URL and skips the S3 object check and signing +work. + +Signed URLs are generated with a seven-day expiration, while Redis stores them +for six days. The shorter Redis TTL prevents the API from returning a cached URL +after the S3 URL has expired. When a post is deleted, the API also removes that +image's cached signed URL from Redis. + Deployment is handled by Vercel and Render. Local `.env` files are not uploaded to either platform. From e4085b38f9636f2b455b8d2dee453794dd676d32 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Thu, 13 Aug 2026 18:12:02 -0400 Subject: [PATCH 17/35] initial commit for rate limiting middleware implementation --- backend/src/middleware/rateLimit.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 backend/src/middleware/rateLimit.ts diff --git a/backend/src/middleware/rateLimit.ts b/backend/src/middleware/rateLimit.ts new file mode 100644 index 0000000..e69de29 From 11ab1dbb7bc0c9194af79210a4ec459c23ae0566 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Thu, 13 Aug 2026 18:46:55 -0400 Subject: [PATCH 18/35] Add express-rate-limit and rate-limit-redis dependencies for rate limiting --- backend/package-lock.json | 42 +++++++++++++++++++++++++++++++++++++++ backend/package.json | 2 ++ 2 files changed, 44 insertions(+) diff --git a/backend/package-lock.json b/backend/package-lock.json index f40efa5..f84db06 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -16,8 +16,10 @@ "cors": "^2.8.5", "dotenv": "^17.2.3", "express": "^5.2.1", + "express-rate-limit": "^8.6.2", "multer": "^2.0.2", "pg": "^8.16.3", + "rate-limit-redis": "^6.0.1", "redis": "^6.1.0" }, "devDependencies": { @@ -2157,6 +2159,25 @@ "url": "https://opencollective.com/express" } }, + "node_modules/express-rate-limit": { + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.6.2.tgz", + "integrity": "sha512-YH4ru+eOJxQABscKFfRCy9R7x9QFGdezclVMwwgFFndzS2Xnm0uo6B0ABZsLhcpeptGv2qvuJVWlQr9gQZoC3A==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "ip-address": "^10.2.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, "node_modules/fast-safe-stringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", @@ -2545,6 +2566,15 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, + "node_modules/ip-address": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.5.0.tgz", + "integrity": "sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -3451,6 +3481,18 @@ "node": ">= 0.6" } }, + "node_modules/rate-limit-redis": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/rate-limit-redis/-/rate-limit-redis-6.0.1.tgz", + "integrity": "sha512-qys7ulbh5X4Bohfjm6BXFWBiyzK6r5eGdFghPWZfJwggnDFTDwCIRq1u7tmN50vLTp4Kbe1h/ZAuBOn/hVpjtQ==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "express-rate-limit": ">= 8.6.0" + } + }, "node_modules/raw-body": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", diff --git a/backend/package.json b/backend/package.json index abef840..e26778a 100644 --- a/backend/package.json +++ b/backend/package.json @@ -22,8 +22,10 @@ "cors": "^2.8.5", "dotenv": "^17.2.3", "express": "^5.2.1", + "express-rate-limit": "^8.6.2", "multer": "^2.0.2", "pg": "^8.16.3", + "rate-limit-redis": "^6.0.1", "redis": "^6.1.0" }, "devDependencies": { From fed57f1f83fb49eaadad9d11651abc78475d5fa3 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Thu, 13 Aug 2026 21:21:40 -0400 Subject: [PATCH 19/35] Implement geocode rate limiting middleware using express-rate-limit and Redis --- backend/src/middleware/rateLimit.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/backend/src/middleware/rateLimit.ts b/backend/src/middleware/rateLimit.ts index e69de29..1a7e551 100644 --- a/backend/src/middleware/rateLimit.ts +++ b/backend/src/middleware/rateLimit.ts @@ -0,0 +1,22 @@ +import { rateLimit } from "express-rate-limit"; +import { RedisStore } from "rate-limit-redis"; +import { redisClient } from "../redis"; + +const createRedisStore = (prefix: string) => + new RedisStore({ + prefix, + sendCommand: (...args: string[]) => redisClient.sendCommand(args), + }); + + export const geocodeRateLimiter = rateLimit({ + windowMs: 60 * 1000, + limit: 60, + standardHeaders: "draft-8", + legacyHeaders: false, + message: { + error: "Too many geocoding requests. Please try again soon.", + }, + store: createRedisStore("rate-limit:geocode:"), +}); + + From 1a3c4e4f8c4c03e5716a90fc94fdb4406508fcda Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 14 Aug 2026 11:58:24 -0400 Subject: [PATCH 20/35] Refactor upload rate limiter to correct error message and ensure proper configuration --- backend/src/middleware/rateLimit.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/backend/src/middleware/rateLimit.ts b/backend/src/middleware/rateLimit.ts index 1a7e551..19c402a 100644 --- a/backend/src/middleware/rateLimit.ts +++ b/backend/src/middleware/rateLimit.ts @@ -8,15 +8,25 @@ const createRedisStore = (prefix: string) => sendCommand: (...args: string[]) => redisClient.sendCommand(args), }); - export const geocodeRateLimiter = rateLimit({ - windowMs: 60 * 1000, - limit: 60, +export const geocodeRateLimiter = rateLimit({ + windowMs: 60 * 1000, + limit: 60, + standardHeaders: "draft-8", + legacyHeaders: false, + message: { + error: "Too many geocoding requests. Please try again soon.", + }, + store: createRedisStore("rate-limit:geocode:"), +}); + +export const uploadRateLimiter = rateLimit({ + windowMs: 60 * 60 * 1000, + limit: 10, standardHeaders: "draft-8", legacyHeaders: false, message: { - error: "Too many geocoding requests. Please try again soon.", + error: "Too many uploads. Please try again later.", }, - store: createRedisStore("rate-limit:geocode:"), + store: createRedisStore("rate-limit:uploads:"), }); - From e6a95533470d6904489eff85b6795950b527d4df Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 14 Aug 2026 11:59:21 -0400 Subject: [PATCH 21/35] Add comments to clarify rate limiting configurations for geocoding and upload requests --- backend/src/middleware/rateLimit.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/middleware/rateLimit.ts b/backend/src/middleware/rateLimit.ts index 19c402a..b761623 100644 --- a/backend/src/middleware/rateLimit.ts +++ b/backend/src/middleware/rateLimit.ts @@ -8,6 +8,7 @@ const createRedisStore = (prefix: string) => sendCommand: (...args: string[]) => redisClient.sendCommand(args), }); +// 60 Requests per minute for geocoding requests export const geocodeRateLimiter = rateLimit({ windowMs: 60 * 1000, limit: 60, @@ -19,6 +20,7 @@ export const geocodeRateLimiter = rateLimit({ store: createRedisStore("rate-limit:geocode:"), }); +// 10 Requests per hour for upload requests export const uploadRateLimiter = rateLimit({ windowMs: 60 * 60 * 1000, limit: 10, From b45719b255257154ca4094bdf05515504e49e195 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 14 Aug 2026 12:10:07 -0400 Subject: [PATCH 22/35] Update geocode rate limiter to 50 requests per minute and apply middleware to geocode route --- backend/src/middleware/rateLimit.ts | 4 ++-- backend/src/routes/geocode.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/src/middleware/rateLimit.ts b/backend/src/middleware/rateLimit.ts index b761623..5f62d46 100644 --- a/backend/src/middleware/rateLimit.ts +++ b/backend/src/middleware/rateLimit.ts @@ -8,10 +8,10 @@ const createRedisStore = (prefix: string) => sendCommand: (...args: string[]) => redisClient.sendCommand(args), }); -// 60 Requests per minute for geocoding requests +// 50 Requests per minute for geocoding requests export const geocodeRateLimiter = rateLimit({ windowMs: 60 * 1000, - limit: 60, + limit: 50, standardHeaders: "draft-8", legacyHeaders: false, message: { diff --git a/backend/src/routes/geocode.ts b/backend/src/routes/geocode.ts index 10eed73..6e534d4 100644 --- a/backend/src/routes/geocode.ts +++ b/backend/src/routes/geocode.ts @@ -2,12 +2,13 @@ import axios from "axios"; import { Router } from "express"; import dotenv from "dotenv"; import { redisClient } from "../redis"; +import { geocodeRateLimiter } from "../middleware/rateLimit"; dotenv.config(); const router = Router(); -router.get("/", async (req, res) => { +router.get("/", geocodeRateLimiter, async (req, res) => { // console.log("Geocode route called"); const start = Date.now(); From 8175c460ad6e2c1c9d3db299346cb0cf359b8eb6 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 14 Aug 2026 13:09:19 -0400 Subject: [PATCH 23/35] Add upload rate limiter middleware to post route --- backend/src/routes/posts.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/routes/posts.ts b/backend/src/routes/posts.ts index f643a3f..d0add0e 100644 --- a/backend/src/routes/posts.ts +++ b/backend/src/routes/posts.ts @@ -3,6 +3,7 @@ import { Router } from "express"; import multer from "multer"; import { supabase } from "../db"; import { redisClient } from "../redis"; +import { uploadRateLimiter } from "../middleware/rateLimit"; const router = Router(); const upload = multer(); // For parsing multipart/form-data @@ -88,7 +89,7 @@ router.get("/", async (req, res) => { res.json(postsWithImageUrls); }); -router.post("/", upload.single("image"), async (req, res) => { +router.post("/", uploadRateLimiter, upload.single("image"), async (req, res) => { try { const { description, latitude, longitude, user_id, photo_date } = req.body; const imageFile = req.file; From 8a80cf5c24729373c813b8a3a0840f2444ce0974 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 14 Aug 2026 13:59:43 -0400 Subject: [PATCH 24/35] Set trust proxy for rate limiting in Express app configuration --- backend/src/app.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/app.ts b/backend/src/app.ts index e09115a..14de4a4 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -5,6 +5,7 @@ import geocodeRoutes from "./routes/geocode"; import bookmarksRoutes from "./routes/bookmarks"; const app = express(); +app.set("trust proxy", 1); // Trust first proxy for rate limiting const allowedOrigins = [ "https://mygeogallery.com", process.env.FRONTEND_URL, From 47c84e2989c8ae8a941c58d7dfb60d341b296a9d Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 14 Aug 2026 21:30:13 -0400 Subject: [PATCH 25/35] Import app dynamically in server startup to improve module loading --- backend/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 73e0585..2f5e69f 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1,4 +1,3 @@ -import app from "./app"; import {connectRedis} from "./redis"; const PORT = Number(process.env.PORT) || 3001; @@ -7,6 +6,8 @@ const startServer = async () => { await connectRedis(); console.log("Connected to Redis"); + const { default: app } = await import("./app"); + app.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); }); From 68361d0b0945cbb72ea2ea97aa0729310f60f7e5 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 14 Aug 2026 21:46:22 -0400 Subject: [PATCH 26/35] Add handling for 429 status in geocoding function to improve user feedback --- src/utils/geocoding.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/geocoding.ts b/src/utils/geocoding.ts index a847f3c..8f62d9f 100644 --- a/src/utils/geocoding.ts +++ b/src/utils/geocoding.ts @@ -3,8 +3,12 @@ async function getAddressFromCoords(latitude: number, longitude: number) { const response = await fetch( `${import.meta.env.VITE_API_URL}/geocode?latitude=${latitude}&longitude=${longitude}`, ); + if (response.status === 429) { + return "Location lookup paused. Try again shortly."; + } + const data = await response.json(); -// console.log("Received geocode data:", data); + // console.log("Received geocode data:", data); return data.address; } From 1b88c47ff97db5b4bf2f7d4149b2311bf9b391d3 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Fri, 14 Aug 2026 21:51:22 -0400 Subject: [PATCH 27/35] Remove commented console log from geocoding function for cleaner code --- src/utils/geocoding.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/geocoding.ts b/src/utils/geocoding.ts index 8f62d9f..1ae0895 100644 --- a/src/utils/geocoding.ts +++ b/src/utils/geocoding.ts @@ -3,12 +3,12 @@ async function getAddressFromCoords(latitude: number, longitude: number) { const response = await fetch( `${import.meta.env.VITE_API_URL}/geocode?latitude=${latitude}&longitude=${longitude}`, ); + if (response.status === 429) { return "Location lookup paused. Try again shortly."; } const data = await response.json(); - // console.log("Received geocode data:", data); return data.address; } From 406ae10502fa308fb8b9b28640097ddaea6c8459 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Sat, 15 Aug 2026 21:35:02 -0400 Subject: [PATCH 28/35] Refactor MapView component for improved readability and add 429 status handling for upload responses --- src/components/MapView.tsx | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/components/MapView.tsx b/src/components/MapView.tsx index 69114ea..6173f9d 100644 --- a/src/components/MapView.tsx +++ b/src/components/MapView.tsx @@ -66,8 +66,8 @@ const MapView = () => { zoom: isMobile ? 2 : 2.1, }; }); - const [isMobileLayout, setIsMobileLayout] = useState(() => - window.matchMedia("(max-width: 768px)").matches, + const [isMobileLayout, setIsMobileLayout] = useState( + () => window.matchMedia("(max-width: 768px)").matches, ); // Pin Marker State @@ -99,8 +99,9 @@ const MapView = () => { new Set(), ); - const isSelectedPostBookmarked = - selectedPost ? bookmarkedPostIds.has(selectedPost.id) : false; + const isSelectedPostBookmarked = selectedPost + ? bookmarkedPostIds.has(selectedPost.id) + : false; const [confirmatinOpen, setConfirmationOpen] = useState(false); const [postToDelete, setPostToDelete] = useState(null); @@ -456,7 +457,10 @@ const MapView = () => { longitude={selectedLocation.longitude} anchor="bottom" > -
+
@@ -511,7 +515,9 @@ const MapView = () => { {user && (