[object Object]

← back to Costa Rica

initial scaffold: CR multi-vertical directory (tourism + rentals + services), basic-auth gate, PG schema, seeded 33 regions

253365f3f1c210dfd09f616574ecf31a961aa61d · 2026-05-07 23:22:40 -0700 · Steve

Files touched

Diff

commit 253365f3f1c210dfd09f616574ecf31a961aa61d
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu May 7 23:22:40 2026 -0700

    initial scaffold: CR multi-vertical directory (tourism + rentals + services), basic-auth gate, PG schema, seeded 33 regions
---
 .env.example      |    7 +
 .gitignore        |   12 +
 package-lock.json | 1030 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 package.json      |   18 +
 public/index.html |  256 +++++++++++++
 schema.sql        |   73 ++++
 scripts/seed.sql  |   58 +++
 server.js         |  197 ++++++++++
 8 files changed, 1651 insertions(+)

diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..d461296
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,7 @@
+PORT=9791
+DATABASE_URL=postgresql://stevestudio2@localhost:5432/costa_rica_directory
+BASIC_AUTH_USER=costarica@agentabrams.com
+BASIC_AUTH_PASS=__set_in_local_env__
+SITE_NAME=Costa Rica Directory
+SITE_DOMAIN=costarica.agentabrams.com
+INFO_EMAIL=info@agentabrams.com
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fa8614d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+node_modules/
+.env
+.env.*
+!.env.example
+tmp/
+*.log
+.DS_Store
+dist/
+build/
+.next/
+data/raw/
+data/cache/
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..ffc7edb
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,1030 @@
+{
+  "name": "costa-rica",
+  "version": "0.1.0",
+  "lockfileVersion": 3,
+  "requires": true,
+  "packages": {
+    "": {
+      "name": "costa-rica",
+      "version": "0.1.0",
+      "dependencies": {
+        "dotenv": "^16.4.5",
+        "express": "^4.21.2",
+        "express-basic-auth": "^1.2.1",
+        "pg": "^8.13.1"
+      }
+    },
+    "node_modules/accepts": {
+      "version": "1.3.8",
+      "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
+      "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
+      "license": "MIT",
+      "dependencies": {
+        "mime-types": "~2.1.34",
+        "negotiator": "0.6.3"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/array-flatten": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
+      "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
+      "license": "MIT"
+    },
+    "node_modules/basic-auth": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
+      "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
+      "license": "MIT",
+      "dependencies": {
+        "safe-buffer": "5.1.2"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/basic-auth/node_modules/safe-buffer": {
+      "version": "5.1.2",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+      "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+      "license": "MIT"
+    },
+    "node_modules/body-parser": {
+      "version": "1.20.5",
+      "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz",
+      "integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==",
+      "license": "MIT",
+      "dependencies": {
+        "bytes": "~3.1.2",
+        "content-type": "~1.0.5",
+        "debug": "2.6.9",
+        "depd": "2.0.0",
+        "destroy": "~1.2.0",
+        "http-errors": "~2.0.1",
+        "iconv-lite": "~0.4.24",
+        "on-finished": "~2.4.1",
+        "qs": "~6.15.1",
+        "raw-body": "~2.5.3",
+        "type-is": "~1.6.18",
+        "unpipe": "~1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8",
+        "npm": "1.2.8000 || >= 1.4.16"
+      }
+    },
+    "node_modules/body-parser/node_modules/qs": {
+      "version": "6.15.1",
+      "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.1.tgz",
+      "integrity": "sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg==",
+      "license": "BSD-3-Clause",
+      "dependencies": {
+        "side-channel": "^1.1.0"
+      },
+      "engines": {
+        "node": ">=0.6"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/bytes": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+      "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/call-bind-apply-helpers": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+      "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+      "license": "MIT",
+      "dependencies": {
+        "es-errors": "^1.3.0",
+        "function-bind": "^1.1.2"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/call-bound": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
+      "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bind-apply-helpers": "^1.0.2",
+        "get-intrinsic": "^1.3.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/content-disposition": {
+      "version": "0.5.4",
+      "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
+      "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
+      "license": "MIT",
+      "dependencies": {
+        "safe-buffer": "5.2.1"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/content-type": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+      "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/cookie": {
+      "version": "0.7.2",
+      "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+      "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/cookie-signature": {
+      "version": "1.0.7",
+      "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
+      "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
+      "license": "MIT"
+    },
+    "node_modules/debug": {
+      "version": "2.6.9",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+      "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+      "license": "MIT",
+      "dependencies": {
+        "ms": "2.0.0"
+      }
+    },
+    "node_modules/depd": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+      "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/destroy": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
+      "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8",
+        "npm": "1.2.8000 || >= 1.4.16"
+      }
+    },
+    "node_modules/dotenv": {
+      "version": "16.6.1",
+      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
+      "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
+      "license": "BSD-2-Clause",
+      "engines": {
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://dotenvx.com"
+      }
+    },
+    "node_modules/dunder-proto": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+      "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bind-apply-helpers": "^1.0.1",
+        "es-errors": "^1.3.0",
+        "gopd": "^1.2.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/ee-first": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+      "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+      "license": "MIT"
+    },
+    "node_modules/encodeurl": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+      "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/es-define-property": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+      "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/es-errors": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+      "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/es-object-atoms": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
+      "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
+      "license": "MIT",
+      "dependencies": {
+        "es-errors": "^1.3.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/escape-html": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+      "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+      "license": "MIT"
+    },
+    "node_modules/etag": {
+      "version": "1.8.1",
+      "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+      "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/express": {
+      "version": "4.22.1",
+      "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",
+      "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",
+      "license": "MIT",
+      "dependencies": {
+        "accepts": "~1.3.8",
+        "array-flatten": "1.1.1",
+        "body-parser": "~1.20.3",
+        "content-disposition": "~0.5.4",
+        "content-type": "~1.0.4",
+        "cookie": "~0.7.1",
+        "cookie-signature": "~1.0.6",
+        "debug": "2.6.9",
+        "depd": "2.0.0",
+        "encodeurl": "~2.0.0",
+        "escape-html": "~1.0.3",
+        "etag": "~1.8.1",
+        "finalhandler": "~1.3.1",
+        "fresh": "~0.5.2",
+        "http-errors": "~2.0.0",
+        "merge-descriptors": "1.0.3",
+        "methods": "~1.1.2",
+        "on-finished": "~2.4.1",
+        "parseurl": "~1.3.3",
+        "path-to-regexp": "~0.1.12",
+        "proxy-addr": "~2.0.7",
+        "qs": "~6.14.0",
+        "range-parser": "~1.2.1",
+        "safe-buffer": "5.2.1",
+        "send": "~0.19.0",
+        "serve-static": "~1.16.2",
+        "setprototypeof": "1.2.0",
+        "statuses": "~2.0.1",
+        "type-is": "~1.6.18",
+        "utils-merge": "1.0.1",
+        "vary": "~1.1.2"
+      },
+      "engines": {
+        "node": ">= 0.10.0"
+      },
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/express"
+      }
+    },
+    "node_modules/express-basic-auth": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/express-basic-auth/-/express-basic-auth-1.2.1.tgz",
+      "integrity": "sha512-L6YQ1wQ/mNjVLAmK3AG1RK6VkokA1BIY6wmiH304Xtt/cLTps40EusZsU1Uop+v9lTDPxdtzbFmdXfFO3KEnwA==",
+      "license": "MIT",
+      "dependencies": {
+        "basic-auth": "^2.0.1"
+      }
+    },
+    "node_modules/finalhandler": {
+      "version": "1.3.2",
+      "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
+      "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
+      "license": "MIT",
+      "dependencies": {
+        "debug": "2.6.9",
+        "encodeurl": "~2.0.0",
+        "escape-html": "~1.0.3",
+        "on-finished": "~2.4.1",
+        "parseurl": "~1.3.3",
+        "statuses": "~2.0.2",
+        "unpipe": "~1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/forwarded": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
+      "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/fresh": {
+      "version": "0.5.2",
+      "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+      "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/function-bind": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+      "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+      "license": "MIT",
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/get-intrinsic": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+      "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bind-apply-helpers": "^1.0.2",
+        "es-define-property": "^1.0.1",
+        "es-errors": "^1.3.0",
+        "es-object-atoms": "^1.1.1",
+        "function-bind": "^1.1.2",
+        "get-proto": "^1.0.1",
+        "gopd": "^1.2.0",
+        "has-symbols": "^1.1.0",
+        "hasown": "^2.0.2",
+        "math-intrinsics": "^1.1.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/get-proto": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+      "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+      "license": "MIT",
+      "dependencies": {
+        "dunder-proto": "^1.0.1",
+        "es-object-atoms": "^1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/gopd": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+      "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/has-symbols": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+      "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/hasown": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz",
+      "integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==",
+      "license": "MIT",
+      "dependencies": {
+        "function-bind": "^1.1.2"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/http-errors": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
+      "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
+      "license": "MIT",
+      "dependencies": {
+        "depd": "~2.0.0",
+        "inherits": "~2.0.4",
+        "setprototypeof": "~1.2.0",
+        "statuses": "~2.0.2",
+        "toidentifier": "~1.0.1"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      },
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/express"
+      }
+    },
+    "node_modules/iconv-lite": {
+      "version": "0.4.24",
+      "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+      "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+      "license": "MIT",
+      "dependencies": {
+        "safer-buffer": ">= 2.1.2 < 3"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/inherits": {
+      "version": "2.0.4",
+      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+      "license": "ISC"
+    },
+    "node_modules/ipaddr.js": {
+      "version": "1.9.1",
+      "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+      "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.10"
+      }
+    },
+    "node_modules/math-intrinsics": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+      "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/media-typer": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+      "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/merge-descriptors": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
+      "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
+      "license": "MIT",
+      "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==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/mime": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
+      "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+      "license": "MIT",
+      "bin": {
+        "mime": "cli.js"
+      },
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/mime-db": {
+      "version": "1.52.0",
+      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/mime-types": {
+      "version": "2.1.35",
+      "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+      "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+      "license": "MIT",
+      "dependencies": {
+        "mime-db": "1.52.0"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/ms": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+      "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+      "license": "MIT"
+    },
+    "node_modules/negotiator": {
+      "version": "0.6.3",
+      "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
+      "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/object-inspect": {
+      "version": "1.13.4",
+      "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+      "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/on-finished": {
+      "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+      "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+      "license": "MIT",
+      "dependencies": {
+        "ee-first": "1.1.1"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/parseurl": {
+      "version": "1.3.3",
+      "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+      "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/path-to-regexp": {
+      "version": "0.1.13",
+      "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
+      "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
+      "license": "MIT"
+    },
+    "node_modules/pg": {
+      "version": "8.20.0",
+      "resolved": "https://registry.npmjs.org/pg/-/pg-8.20.0.tgz",
+      "integrity": "sha512-ldhMxz2r8fl/6QkXnBD3CR9/xg694oT6DZQ2s6c/RI28OjtSOpxnPrUCGOBJ46RCUxcWdx3p6kw/xnDHjKvaRA==",
+      "license": "MIT",
+      "dependencies": {
+        "pg-connection-string": "^2.12.0",
+        "pg-pool": "^3.13.0",
+        "pg-protocol": "^1.13.0",
+        "pg-types": "2.2.0",
+        "pgpass": "1.0.5"
+      },
+      "engines": {
+        "node": ">= 16.0.0"
+      },
+      "optionalDependencies": {
+        "pg-cloudflare": "^1.3.0"
+      },
+      "peerDependencies": {
+        "pg-native": ">=3.0.1"
+      },
+      "peerDependenciesMeta": {
+        "pg-native": {
+          "optional": true
+        }
+      }
+    },
+    "node_modules/pg-cloudflare": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.3.0.tgz",
+      "integrity": "sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/pg-connection-string": {
+      "version": "2.12.0",
+      "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.12.0.tgz",
+      "integrity": "sha512-U7qg+bpswf3Cs5xLzRqbXbQl85ng0mfSV/J0nnA31MCLgvEaAo7CIhmeyrmJpOr7o+zm0rXK+hNnT5l9RHkCkQ==",
+      "license": "MIT"
+    },
+    "node_modules/pg-int8": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
+      "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
+      "license": "ISC",
+      "engines": {
+        "node": ">=4.0.0"
+      }
+    },
+    "node_modules/pg-pool": {
+      "version": "3.13.0",
+      "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.13.0.tgz",
+      "integrity": "sha512-gB+R+Xud1gLFuRD/QgOIgGOBE2KCQPaPwkzBBGC9oG69pHTkhQeIuejVIk3/cnDyX39av2AxomQiyPT13WKHQA==",
+      "license": "MIT",
+      "peerDependencies": {
+        "pg": ">=8.0"
+      }
+    },
+    "node_modules/pg-protocol": {
+      "version": "1.13.0",
+      "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.13.0.tgz",
+      "integrity": "sha512-zzdvXfS6v89r6v7OcFCHfHlyG/wvry1ALxZo4LqgUoy7W9xhBDMaqOuMiF3qEV45VqsN6rdlcehHrfDtlCPc8w==",
+      "license": "MIT"
+    },
+    "node_modules/pg-types": {
+      "version": "2.2.0",
+      "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
+      "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
+      "license": "MIT",
+      "dependencies": {
+        "pg-int8": "1.0.1",
+        "postgres-array": "~2.0.0",
+        "postgres-bytea": "~1.0.0",
+        "postgres-date": "~1.0.4",
+        "postgres-interval": "^1.1.0"
+      },
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/pgpass": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
+      "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
+      "license": "MIT",
+      "dependencies": {
+        "split2": "^4.1.0"
+      }
+    },
+    "node_modules/postgres-array": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
+      "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/postgres-bytea": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz",
+      "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/postgres-date": {
+      "version": "1.0.7",
+      "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
+      "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/postgres-interval": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
+      "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
+      "license": "MIT",
+      "dependencies": {
+        "xtend": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/proxy-addr": {
+      "version": "2.0.7",
+      "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
+      "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
+      "license": "MIT",
+      "dependencies": {
+        "forwarded": "0.2.0",
+        "ipaddr.js": "1.9.1"
+      },
+      "engines": {
+        "node": ">= 0.10"
+      }
+    },
+    "node_modules/qs": {
+      "version": "6.14.2",
+      "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz",
+      "integrity": "sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==",
+      "license": "BSD-3-Clause",
+      "dependencies": {
+        "side-channel": "^1.1.0"
+      },
+      "engines": {
+        "node": ">=0.6"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/range-parser": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+      "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/raw-body": {
+      "version": "2.5.3",
+      "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
+      "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
+      "license": "MIT",
+      "dependencies": {
+        "bytes": "~3.1.2",
+        "http-errors": "~2.0.1",
+        "iconv-lite": "~0.4.24",
+        "unpipe": "~1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/safe-buffer": {
+      "version": "5.2.1",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+      "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
+      "license": "MIT"
+    },
+    "node_modules/safer-buffer": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+      "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+      "license": "MIT"
+    },
+    "node_modules/send": {
+      "version": "0.19.2",
+      "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
+      "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
+      "license": "MIT",
+      "dependencies": {
+        "debug": "2.6.9",
+        "depd": "2.0.0",
+        "destroy": "1.2.0",
+        "encodeurl": "~2.0.0",
+        "escape-html": "~1.0.3",
+        "etag": "~1.8.1",
+        "fresh": "~0.5.2",
+        "http-errors": "~2.0.1",
+        "mime": "1.6.0",
+        "ms": "2.1.3",
+        "on-finished": "~2.4.1",
+        "range-parser": "~1.2.1",
+        "statuses": "~2.0.2"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/send/node_modules/ms": {
+      "version": "2.1.3",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+      "license": "MIT"
+    },
+    "node_modules/serve-static": {
+      "version": "1.16.3",
+      "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
+      "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
+      "license": "MIT",
+      "dependencies": {
+        "encodeurl": "~2.0.0",
+        "escape-html": "~1.0.3",
+        "parseurl": "~1.3.3",
+        "send": "~0.19.1"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/setprototypeof": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+      "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+      "license": "ISC"
+    },
+    "node_modules/side-channel": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
+      "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
+      "license": "MIT",
+      "dependencies": {
+        "es-errors": "^1.3.0",
+        "object-inspect": "^1.13.3",
+        "side-channel-list": "^1.0.0",
+        "side-channel-map": "^1.0.1",
+        "side-channel-weakmap": "^1.0.2"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/side-channel-list": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
+      "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
+      "license": "MIT",
+      "dependencies": {
+        "es-errors": "^1.3.0",
+        "object-inspect": "^1.13.4"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/side-channel-map": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
+      "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bound": "^1.0.2",
+        "es-errors": "^1.3.0",
+        "get-intrinsic": "^1.2.5",
+        "object-inspect": "^1.13.3"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/side-channel-weakmap": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
+      "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bound": "^1.0.2",
+        "es-errors": "^1.3.0",
+        "get-intrinsic": "^1.2.5",
+        "object-inspect": "^1.13.3",
+        "side-channel-map": "^1.0.1"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/split2": {
+      "version": "4.2.0",
+      "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
+      "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
+      "license": "ISC",
+      "engines": {
+        "node": ">= 10.x"
+      }
+    },
+    "node_modules/statuses": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
+      "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/toidentifier": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+      "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=0.6"
+      }
+    },
+    "node_modules/type-is": {
+      "version": "1.6.18",
+      "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
+      "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+      "license": "MIT",
+      "dependencies": {
+        "media-typer": "0.3.0",
+        "mime-types": "~2.1.24"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/unpipe": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+      "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/utils-merge": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+      "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4.0"
+      }
+    },
+    "node_modules/vary": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+      "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/xtend": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
+      "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=0.4"
+      }
+    }
+  }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..3ee1e57
--- /dev/null
+++ b/package.json
@@ -0,0 +1,18 @@
+{
+  "name": "costa-rica",
+  "version": "0.1.0",
+  "private": true,
+  "description": "Costa Rica multi-vertical directory — tourism, rentals, local services. Ventura-Corridor pattern.",
+  "main": "server.js",
+  "scripts": {
+    "start": "node server.js",
+    "schema": "psql costa_rica_directory -f schema.sql",
+    "seed": "psql costa_rica_directory -f scripts/seed.sql"
+  },
+  "dependencies": {
+    "dotenv": "^16.4.5",
+    "express": "^4.21.2",
+    "express-basic-auth": "^1.2.1",
+    "pg": "^8.13.1"
+  }
+}
diff --git a/public/index.html b/public/index.html
new file mode 100644
index 0000000..735387a
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,256 @@
+<!doctype html>
+<html lang="en" data-theme="light">
+<head>
+  <meta charset="utf-8" />
+  <meta name="viewport" content="width=device-width, initial-scale=1" />
+  <title>Costa Rica Directory — tourism · rentals · local services</title>
+  <meta name="description" content="A working directory of Costa Rica businesses across tourism, rentals, and local services. Aggregated from government registries (Hacienda, MEIC, ICT) and local listings." />
+  <script>
+    (function(){ try{ var t=localStorage.getItem('cr-theme'); if(t) document.documentElement.setAttribute('data-theme',t);}catch(e){} })();
+  </script>
+  <style>
+    :root {
+      --bg:#fafaf7; --fg:#0e1015; --muted:#5a6270; --line:#e3e0d6;
+      --card:#fff; --card-line:#ebe7da; --accent:#0a7a3a; --accent-2:#c2a85a;
+      --shadow: 0 1px 2px rgba(20,20,20,.04), 0 8px 24px rgba(20,20,20,.05);
+      --cols: 4;
+    }
+    [data-theme="dark"] {
+      --bg:#0e1015; --fg:#f3f1ea; --muted:#9aa3b2; --line:#23262d;
+      --card:#15181f; --card-line:#262932; --accent:#3ec07a; --accent-2:#d8c074;
+      --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.5);
+    }
+    *{box-sizing:border-box}
+    html,body{margin:0;padding:0;background:var(--bg);color:var(--fg);font-family:-apple-system,BlinkMacSystemFont,'Inter','Segoe UI',Roboto,sans-serif;font-size:15px;line-height:1.55;-webkit-font-smoothing:antialiased}
+    a{color:inherit;text-decoration:none} a:hover{text-decoration:underline}
+    .nav{position:sticky;top:0;z-index:30;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(160%) blur(10px);border-bottom:1px solid var(--line)}
+    .nav-in{max-width:1320px;margin:0 auto;padding:14px 22px;display:flex;align-items:center;gap:18px;flex-wrap:wrap}
+    .brand{font-weight:700;letter-spacing:-.01em;font-size:18px}
+    .brand .pin{color:var(--accent)}
+    .nav-links{display:flex;gap:14px;flex-wrap:wrap;color:var(--muted);font-size:14px}
+    .nav-links a.active{color:var(--fg);font-weight:600}
+    .ml-auto{margin-left:auto}
+    .icon-btn{appearance:none;background:transparent;color:inherit;border:1px solid var(--line);border-radius:999px;width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
+    .icon-btn:hover{background:color-mix(in srgb,var(--fg) 6%,transparent)}
+    .hero{max-width:1320px;margin:0 auto;padding:32px 22px 18px}
+    h1{font-size:clamp(28px,4vw,44px);letter-spacing:-.02em;margin:0 0 8px;font-weight:700}
+    .lede{color:var(--muted);max-width:780px;margin:0 0 22px}
+    .filter-bar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:18px 0 8px}
+    .pill{display:inline-flex;align-items:center;gap:6px;padding:7px 13px;border:1px solid var(--line);border-radius:999px;background:var(--card);color:var(--fg);font-size:13px;cursor:pointer}
+    .pill.active{background:var(--fg);color:var(--bg);border-color:var(--fg)}
+    .pill .n{font-variant-numeric:tabular-nums;color:var(--muted);font-size:12px;margin-left:4px}
+    .pill.active .n{color:color-mix(in srgb,var(--bg) 70%, transparent)}
+    .controls{display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin:14px 0 6px}
+    .search{flex:1;min-width:240px;display:flex;align-items:center;gap:10px;padding:10px 14px;border:1px solid var(--line);border-radius:12px;background:var(--card)}
+    .search input{flex:1;border:0;outline:0;background:transparent;color:inherit;font-size:15px}
+    .ctrl{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted)}
+    .ctrl select, .ctrl input[type=range]{appearance:none;background:var(--card);color:var(--fg);border:1px solid var(--line);border-radius:8px;padding:6px 10px;font-size:13px}
+    .ctrl input[type=range]{padding:0;width:140px}
+    main{max-width:1320px;margin:0 auto;padding:0 22px 60px}
+    .meta{color:var(--muted);font-size:13px;margin:8px 0 14px}
+    .grid{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:18px}
+    .card{background:var(--card);border:1px solid var(--card-line);border-radius:14px;overflow:hidden;display:flex;flex-direction:column;transition:transform .15s ease, box-shadow .15s ease}
+    .card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}
+    .card .img{aspect-ratio:16/10;background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 35%, var(--card)), color-mix(in srgb, var(--accent-2) 30%, var(--card)));display:flex;align-items:center;justify-content:center;font-size:32px;color:color-mix(in srgb,var(--fg) 35%,transparent)}
+    .card .img img{width:100%;height:100%;object-fit:cover;display:block}
+    .card .body{padding:14px 14px 16px;display:flex;flex-direction:column;gap:6px;flex:1}
+    .cat{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--accent);font-weight:600}
+    .name{font-weight:600;letter-spacing:-.01em}
+    .where{font-size:13px;color:var(--muted)}
+    .desc{font-size:13px;color:color-mix(in srgb,var(--fg) 80%,transparent);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
+    .row{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:auto;padding-top:6px}
+    .badge{font-size:11px;padding:2px 7px;border-radius:999px;background:color-mix(in srgb,var(--fg) 6%,transparent);color:var(--muted)}
+    .badge.verified{background:color-mix(in srgb,var(--accent) 18%,transparent);color:var(--accent)}
+    footer{max-width:1320px;margin:0 auto;padding:30px 22px 60px;color:var(--muted);font-size:13px;border-top:1px solid var(--line);margin-top:30px}
+    footer a{color:var(--accent)}
+    .empty{padding:60px 0;text-align:center;color:var(--muted)}
+  </style>
+</head>
+<body>
+  <header class="nav">
+    <div class="nav-in">
+      <div class="brand"><span class="pin">●</span>&nbsp;Costa&nbsp;Rica&nbsp;Directory</div>
+      <nav class="nav-links">
+        <a href="#" data-cat="" class="active">All</a>
+        <a href="#" data-cat="tourism">Tourism</a>
+        <a href="#" data-cat="rentals">Rentals</a>
+        <a href="#" data-cat="service">Local services</a>
+      </nav>
+      <div class="ml-auto" style="display:flex;gap:8px;align-items:center">
+        <span id="stat-total" class="badge">—</span>
+        <button class="icon-btn" id="theme-toggle" title="Toggle theme" aria-label="Toggle theme">
+          <svg id="i-sun" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
+          <svg id="i-moon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="display:none"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
+        </button>
+      </div>
+    </div>
+  </header>
+
+  <section class="hero">
+    <h1>Every business in Costa Rica, in one searchable directory.</h1>
+    <p class="lede">Tourism · rentals · local services across all 84 cantones. Aggregated from Hacienda, MEIC, ICT, municipal patente registries, and local web directories.</p>
+
+    <div class="filter-bar" id="region-bar"></div>
+
+    <div class="controls">
+      <div class="search">
+        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>
+        <input id="q" placeholder="Search by name, address, town, keyword…" autocomplete="off" />
+      </div>
+      <div class="ctrl">
+        <label for="sort">Sort</label>
+        <select id="sort">
+          <option value="newest">Newest</option>
+          <option value="name">Name A→Z</option>
+          <option value="name-desc">Name Z→A</option>
+          <option value="rating">Rating</option>
+          <option value="verified">Verified first</option>
+          <option value="oldest">Oldest</option>
+        </select>
+      </div>
+      <div class="ctrl">
+        <label for="cols">Density</label>
+        <input id="cols" type="range" min="2" max="6" step="1" value="4" />
+      </div>
+    </div>
+
+    <div class="meta" id="meta">Loading…</div>
+  </section>
+
+  <main>
+    <div class="grid" id="grid"></div>
+    <div class="empty" id="empty" style="display:none">No matches yet — try clearing filters or pulling more data.</div>
+  </main>
+
+  <footer>
+    <div>© Costa Rica Directory. Aggregated public-record data; we do not host owner-operated content without permission. Owner of a listing? <a href="mailto:info@agentabrams.com">info@agentabrams.com</a>.</div>
+  </footer>
+
+  <script>
+    const $ = (s,r=document)=>r.querySelector(s);
+    const $$ = (s,r=document)=>[...r.querySelectorAll(s)];
+    const grid = $('#grid'); const meta = $('#meta'); const empty = $('#empty');
+
+    const state = {
+      q: localStorage.getItem('cr-q') || '',
+      cat: '',
+      region: '',
+      sort: localStorage.getItem('cr-sort') || 'newest',
+      cols: parseInt(localStorage.getItem('cr-cols') || '4', 10),
+    };
+
+    function applyTheme(){
+      const cur = document.documentElement.getAttribute('data-theme') || 'light';
+      $('#i-sun').style.display  = cur === 'dark' ? '' : 'none';
+      $('#i-moon').style.display = cur === 'dark' ? 'none' : '';
+    }
+    $('#theme-toggle').addEventListener('click', () => {
+      const cur = document.documentElement.getAttribute('data-theme') || 'light';
+      const nxt = cur === 'dark' ? 'light' : 'dark';
+      document.documentElement.setAttribute('data-theme', nxt);
+      try { localStorage.setItem('cr-theme', nxt); } catch(e){}
+      applyTheme();
+    });
+    applyTheme();
+
+    document.documentElement.style.setProperty('--cols', state.cols);
+    $('#cols').value = state.cols;
+    $('#cols').addEventListener('input', e => {
+      state.cols = parseInt(e.target.value, 10);
+      document.documentElement.style.setProperty('--cols', state.cols);
+      try { localStorage.setItem('cr-cols', String(state.cols)); } catch(e){}
+    });
+
+    $('#sort').value = state.sort;
+    $('#sort').addEventListener('change', e => { state.sort = e.target.value; localStorage.setItem('cr-sort', state.sort); load(); });
+
+    $('#q').value = state.q;
+    let qDebounce;
+    $('#q').addEventListener('input', e => {
+      clearTimeout(qDebounce);
+      qDebounce = setTimeout(() => { state.q = e.target.value.trim(); localStorage.setItem('cr-q', state.q); load(); }, 220);
+    });
+
+    $$('.nav-links a').forEach(a => a.addEventListener('click', e => {
+      e.preventDefault();
+      $$('.nav-links a').forEach(x => x.classList.remove('active'));
+      a.classList.add('active');
+      state.cat = a.dataset.cat || '';
+      load();
+    }));
+
+    function regionPill(slug, name, n, active){
+      const a = document.createElement('button');
+      a.className = 'pill' + (active ? ' active' : '');
+      a.innerHTML = `${name}<span class="n">${n||0}</span>`;
+      a.addEventListener('click', () => { state.region = active ? '' : slug; renderRegions(window.__regions__); load(); });
+      return a;
+    }
+
+    function renderRegions(regs){
+      const bar = $('#region-bar'); bar.innerHTML = '';
+      bar.appendChild(regionPill('', 'All regions', regs.reduce((s,r)=>s+(r.place_count||0),0), state.region===''));
+      regs.filter(r => (r.place_count||0) > 0 || ['nosara','tamarindo','manuel-antonio','la-fortuna','san-jose','santa-teresa','jaco','monteverde','puerto-viejo'].includes(r.slug))
+          .slice(0, 18)
+          .forEach(r => bar.appendChild(regionPill(r.slug, r.name, r.place_count, state.region===r.slug)));
+    }
+
+    async function loadRegions(){
+      try {
+        const j = await (await fetch('/api/regions')).json();
+        window.__regions__ = j.regions || [];
+        renderRegions(window.__regions__);
+      } catch(e){ console.error(e); }
+    }
+
+    function card(p){
+      const wrap = document.createElement('a');
+      wrap.className = 'card';
+      wrap.href = '#';
+      const verticalLabel = (p.vertical||'').replace(/_/g,' ');
+      const img = p.image_url
+        ? `<div class="img"><img loading="lazy" src="${p.image_url}" alt=""></div>`
+        : `<div class="img">⛰</div>`;
+      const region = p.region_name ? `${p.region_name}${p.province?', '+p.province:''}` : (p.address || '');
+      wrap.innerHTML = `
+        ${img}
+        <div class="body">
+          <div class="cat">${verticalLabel}</div>
+          <div class="name">${p.name}</div>
+          <div class="where">${region}</div>
+          <div class="desc">${p.description||''}</div>
+          <div class="row">
+            <span class="badge ${p.verified?'verified':''}">${p.verified?'verified':p.source||'pending'}</span>
+            ${p.rating?`<span class="badge">★ ${(+p.rating).toFixed(1)}</span>`:''}
+          </div>
+        </div>`;
+      return wrap;
+    }
+
+    async function load(){
+      const params = new URLSearchParams();
+      if (state.q)      params.set('q', state.q);
+      if (state.cat)    params.set('category', state.cat);
+      if (state.region) params.set('region', state.region);
+      if (state.sort)   params.set('sort', state.sort);
+      params.set('limit','120');
+      meta.textContent = 'Loading…';
+      try {
+        const j = await (await fetch('/api/places?'+params)).json();
+        $('#stat-total').textContent = (j.total||0).toLocaleString() + ' listings';
+        meta.textContent = `${(j.total||0).toLocaleString()} matches`
+          + (state.region ? ` · ${state.region}` : '')
+          + (state.cat ? ` · ${state.cat}` : '');
+        grid.innerHTML = '';
+        if (!j.places || !j.places.length){ empty.style.display=''; return; }
+        empty.style.display='none';
+        j.places.forEach(p => grid.appendChild(card(p)));
+      } catch(e){
+        meta.textContent = 'error: ' + e.message;
+      }
+    }
+
+    loadRegions().then(load);
+  </script>
+</body>
+</html>
diff --git a/schema.sql b/schema.sql
new file mode 100644
index 0000000..f224a4f
--- /dev/null
+++ b/schema.sql
@@ -0,0 +1,73 @@
+-- Costa Rica multi-vertical directory schema
+-- Ventura-Corridor pattern: tourism + rentals + local services
+
+CREATE TABLE IF NOT EXISTS regions (
+  id           SERIAL PRIMARY KEY,
+  slug         TEXT UNIQUE NOT NULL,
+  name         TEXT NOT NULL,
+  province     TEXT NOT NULL,
+  region_type  TEXT NOT NULL DEFAULT 'town',
+  description  TEXT,
+  lat          NUMERIC(9,6),
+  lng          NUMERIC(9,6)
+);
+
+CREATE TABLE IF NOT EXISTS places (
+  id            SERIAL PRIMARY KEY,
+  slug          TEXT UNIQUE NOT NULL,
+  name          TEXT NOT NULL,
+  category      TEXT NOT NULL CHECK (category IN ('tourism','rentals','service')),
+  vertical      TEXT NOT NULL,
+  region_id     INTEGER REFERENCES regions(id),
+  description   TEXT,
+  address       TEXT,
+  phone         TEXT,
+  email         TEXT,
+  website       TEXT,
+  price_range   TEXT,
+  rating        NUMERIC(2,1),
+  image_url     TEXT,
+  tags          TEXT[],
+  lat           NUMERIC(9,6),
+  lng           NUMERIC(9,6),
+  cedula_juridica TEXT,
+  source        TEXT,
+  source_url    TEXT,
+  verified      BOOLEAN DEFAULT FALSE,
+  status        TEXT DEFAULT 'active',
+  created_at    TIMESTAMPTZ DEFAULT NOW(),
+  updated_at    TIMESTAMPTZ DEFAULT NOW()
+);
+
+CREATE INDEX IF NOT EXISTS idx_places_vertical    ON places(vertical);
+CREATE INDEX IF NOT EXISTS idx_places_category    ON places(category);
+CREATE INDEX IF NOT EXISTS idx_places_region      ON places(region_id);
+CREATE INDEX IF NOT EXISTS idx_places_name_lower  ON places(LOWER(name));
+CREATE INDEX IF NOT EXISTS idx_places_status      ON places(status);
+
+CREATE TABLE IF NOT EXISTS leads (
+  id           SERIAL PRIMARY KEY,
+  place_id     INTEGER REFERENCES places(id),
+  name         TEXT,
+  email        TEXT,
+  phone        TEXT,
+  message      TEXT,
+  meta         JSONB,
+  ip           TEXT,
+  user_agent   TEXT,
+  created_at   TIMESTAMPTZ DEFAULT NOW()
+);
+
+CREATE INDEX IF NOT EXISTS idx_leads_place ON leads(place_id);
+
+CREATE TABLE IF NOT EXISTS ingest_runs (
+  id            SERIAL PRIMARY KEY,
+  source        TEXT NOT NULL,
+  started_at    TIMESTAMPTZ DEFAULT NOW(),
+  finished_at   TIMESTAMPTZ,
+  rows_in       INTEGER,
+  rows_added    INTEGER,
+  rows_updated  INTEGER,
+  status        TEXT,
+  notes         TEXT
+);
diff --git a/scripts/seed.sql b/scripts/seed.sql
new file mode 100644
index 0000000..bda5320
--- /dev/null
+++ b/scripts/seed.sql
@@ -0,0 +1,58 @@
+-- Seed CR regions (provinces + tourism cantones/towns)
+-- Multi-vertical directory: tourism + rentals + local services
+
+INSERT INTO regions (slug, name, province, region_type, lat, lng, description) VALUES
+  ('san-jose',         'San José',           'San José',     'city',    9.9281, -84.0907, 'Capital. Business + cultural hub.'),
+  ('escazu',           'Escazú',             'San José',     'town',    9.9189, -84.1395, 'Affluent suburb west of San José.'),
+  ('santa-ana',        'Santa Ana',          'San José',     'town',    9.9325, -84.1843, 'Suburban / corporate west of San José.'),
+  ('alajuela',         'Alajuela',           'Alajuela',     'city',   10.0162, -84.2117, 'SJO airport hub.'),
+  ('atenas',           'Atenas',             'Alajuela',     'town',    9.9783, -84.3754, 'Coffee + retiree-favored climate.'),
+  ('grecia',           'Grecia',             'Alajuela',     'town',   10.0717, -84.3148, 'Highland coffee town.'),
+  ('la-fortuna',       'La Fortuna / Arenal','Alajuela',     'town',   10.4673, -84.6435, 'Volcano Arenal — adventure tourism.'),
+  ('heredia',          'Heredia',            'Heredia',      'city',   10.0023, -84.1162, 'Coffee + university.'),
+  ('cartago',          'Cartago',            'Cartago',      'city',    9.8638, -83.9203, 'Former colonial capital.'),
+  ('liberia',          'Liberia',            'Guanacaste',   'city',   10.6333, -85.4382, 'Northwest gateway, LIR airport.'),
+  ('tamarindo',        'Tamarindo',          'Guanacaste',   'town',   10.2992, -85.8401, 'Pacific surf town.'),
+  ('nosara',           'Nosara',             'Guanacaste',   'town',    9.9744, -85.6512, 'Yoga + surf + wellness.'),
+  ('santa-teresa',     'Santa Teresa',       'Puntarenas',   'town',    9.6411, -85.1711, 'Surf + wellness on Nicoya tip.'),
+  ('montezuma',        'Montezuma',          'Puntarenas',   'town',    9.6553, -85.0717, 'Bohemian Nicoya village.'),
+  ('jaco',             'Jacó',               'Puntarenas',   'town',    9.6189, -84.6285, 'Central Pacific surf + nightlife.'),
+  ('manuel-antonio',   'Manuel Antonio',     'Puntarenas',   'town',    9.3919, -84.1374, 'National park + beach.'),
+  ('quepos',           'Quepos',             'Puntarenas',   'town',    9.4329, -84.1612, 'Sportfishing + Manuel Antonio gateway.'),
+  ('uvita',            'Uvita',              'Puntarenas',   'town',    9.1622, -83.7472, 'Whale tail + Marino Ballena.'),
+  ('dominical',        'Dominical',          'Puntarenas',   'town',    9.2536, -83.8569, 'Surf town between Uvita + Quepos.'),
+  ('puerto-viejo',     'Puerto Viejo',       'Limón',        'town',    9.6552, -82.7551, 'Caribbean + reggae + reef.'),
+  ('cahuita',          'Cahuita',            'Limón',        'town',    9.7406, -82.8419, 'Caribbean national park town.'),
+  ('monteverde',       'Monteverde',         'Puntarenas',   'town',   10.3009, -84.8259, 'Cloud forest + zip-lines.'),
+  ('santa-elena',      'Santa Elena',        'Puntarenas',   'town',   10.3198, -84.8253, 'Monteverde gateway.'),
+  ('limon',            'Limón',              'Limón',        'city',    9.9907, -83.0359, 'Caribbean port city.'),
+  ('puntarenas',       'Puntarenas',         'Puntarenas',   'city',    9.9762, -84.8384, 'Pacific port + ferry to Nicoya.'),
+  ('papagayo',         'Península Papagayo', 'Guanacaste',   'town',   10.6276, -85.6775, 'Luxury resort enclave.'),
+  ('playas-coco',      'Playas del Coco',    'Guanacaste',   'town',   10.5532, -85.6996, 'Diving + nightlife on Gulf of Papagayo.'),
+  ('flamingo',         'Playa Flamingo',     'Guanacaste',   'town',   10.4338, -85.7833, 'White-sand beach + sportfishing.'),
+  ('samara',           'Sámara',             'Guanacaste',   'town',    9.8814, -85.5295, 'Family-friendly Nicoya beach.'),
+  ('nicoya',           'Nicoya',             'Guanacaste',   'city',   10.1487, -85.4525, 'Blue-zone hub + cantón seat.'),
+  ('guanacaste-other', 'Guanacaste — other', 'Guanacaste',   'region', 10.4500, -85.6000, 'Other Guanacaste locations.'),
+  ('puntarenas-other', 'Puntarenas — other', 'Puntarenas',   'region',  9.6000, -84.5000, 'Other Puntarenas locations.'),
+  ('cr-other',         'Costa Rica — other', 'CR',           'region', 10.0000, -84.0000, 'Unassigned.')
+ON CONFLICT (slug) DO NOTHING;
+
+-- Demo places (placeholders so UI renders something before scrape lands real data)
+INSERT INTO places (slug, name, category, vertical, region_id, description, address, source) VALUES
+  ('nosara-yoga-institute', 'Nosara Yoga Institute', 'tourism',  'tourism_tour',
+    (SELECT id FROM regions WHERE slug='nosara'),
+    'Yoga teacher training + retreats above Playa Guiones.',
+    'Playa Guiones, Nosara', 'seed-demo'),
+  ('tamarindo-surf-school', 'Tamarindo Surf School', 'tourism',  'tourism_surf',
+    (SELECT id FROM regions WHERE slug='tamarindo'),
+    'Beginner-to-advanced surf lessons on Playa Tamarindo.',
+    'Playa Tamarindo, Tamarindo', 'seed-demo'),
+  ('arenal-volcano-tour',   'Arenal Volcano Hike',   'tourism',  'tourism_tour',
+    (SELECT id FROM regions WHERE slug='la-fortuna'),
+    'Guided lava-flow hike at Arenal National Park.',
+    'Parque Nacional Arenal, La Fortuna', 'seed-demo'),
+  ('manuel-antonio-rental', 'Casa Manuel Antonio',   'rentals',  'rentals_short',
+    (SELECT id FROM regions WHERE slug='manuel-antonio'),
+    'Three-bedroom ocean-view villa near Manuel Antonio.',
+    'Manuel Antonio', 'seed-demo')
+ON CONFLICT (slug) DO NOTHING;
diff --git a/server.js b/server.js
new file mode 100644
index 0000000..d67e685
--- /dev/null
+++ b/server.js
@@ -0,0 +1,197 @@
+'use strict';
+
+require('dotenv').config();
+const express = require('express');
+const basicAuth = require('express-basic-auth');
+const { Pool } = require('pg');
+const path = require('path');
+
+const PORT = parseInt(process.env.PORT || '9791', 10);
+const SITE_NAME = process.env.SITE_NAME || 'Costa Rica Directory';
+const SITE_DOMAIN = process.env.SITE_DOMAIN || 'costarica.agentabrams.com';
+
+const pool = new Pool({ connectionString: process.env.DATABASE_URL });
+
+const app = express();
+app.set('trust proxy', true);
+app.use(express.json({ limit: '1mb' }));
+app.use(express.urlencoded({ extended: true }));
+
+// Cloudflare HTML caching guard (per MEMORY.md)
+app.use((req, res, next) => {
+  if (req.path === '/' || req.path.endsWith('.html')) {
+    res.set('Cache-Control', 'no-store, must-revalidate');
+  }
+  next();
+});
+
+// Whole-site Basic Auth gate (in-development; remove when ready for public)
+const BA_USER = process.env.BASIC_AUTH_USER;
+const BA_PASS = process.env.BASIC_AUTH_PASS;
+if (BA_USER && BA_PASS) {
+  app.use(basicAuth({
+    users: { [BA_USER]: BA_PASS },
+    challenge: true,
+    realm: 'CR-Directory',
+  }));
+} else {
+  console.warn('[boot] BASIC_AUTH_USER/PASS not set — site is OPEN');
+}
+
+app.get('/health', (_req, res) => res.json({ ok: true, site: SITE_NAME, ts: new Date().toISOString() }));
+
+const VERTICALS = {
+  tourism: ['tourism_hotel','tourism_tour','tourism_beach','tourism_restaurant','tourism_surf'],
+  rentals: ['rentals_short','rentals_long','rentals_realestate'],
+  service: ['service_food','service_beauty','service_retail','service_fitness','service_pet','service_auto','service_cleaning','service_creative'],
+};
+
+function sortClause(sort) {
+  switch ((sort || '').toLowerCase()) {
+    case 'name':       return 'ORDER BY LOWER(p.name) ASC';
+    case 'name-desc':  return 'ORDER BY LOWER(p.name) DESC';
+    case 'rating':     return 'ORDER BY p.rating DESC NULLS LAST, p.id DESC';
+    case 'verified':   return 'ORDER BY p.verified DESC, p.id DESC';
+    case 'newest':     return 'ORDER BY p.id DESC';
+    case 'oldest':     return 'ORDER BY p.id ASC';
+    default:           return 'ORDER BY p.id DESC';
+  }
+}
+
+app.get('/api/regions', async (_req, res) => {
+  try {
+    const { rows } = await pool.query(`
+      SELECT r.id, r.slug, r.name, r.province, r.region_type, r.lat, r.lng,
+             COUNT(p.id)::int AS place_count
+        FROM regions r
+   LEFT JOIN places p ON p.region_id = r.id AND p.status = 'active'
+    GROUP BY r.id
+    ORDER BY r.name ASC
+    `);
+    res.json({ regions: rows });
+  } catch (e) {
+    res.status(500).json({ error: e.message });
+  }
+});
+
+app.get('/api/places', async (req, res) => {
+  try {
+    const limit  = Math.min(parseInt(req.query.limit  || '60', 10) || 60, 250);
+    const offset = Math.max(parseInt(req.query.offset || '0',  10) || 0, 0);
+    const sort   = sortClause(req.query.sort);
+    const where  = ["p.status = 'active'"];
+    const args   = [];
+
+    if (req.query.category) {
+      args.push(req.query.category);
+      where.push(`p.category = $${args.length}`);
+    }
+    if (req.query.vertical) {
+      args.push(req.query.vertical);
+      where.push(`p.vertical = $${args.length}`);
+    }
+    if (req.query.region) {
+      args.push(req.query.region);
+      where.push(`r.slug = $${args.length}`);
+    }
+    if (req.query.q) {
+      args.push(`%${req.query.q.toLowerCase()}%`);
+      where.push(`(LOWER(p.name) LIKE $${args.length} OR LOWER(p.description) LIKE $${args.length} OR LOWER(p.address) LIKE $${args.length})`);
+    }
+
+    const sql = `
+      SELECT p.id, p.slug, p.name, p.category, p.vertical, p.description, p.address,
+             p.phone, p.email, p.website, p.price_range, p.rating, p.image_url, p.tags,
+             p.lat, p.lng, p.verified, p.source, p.source_url, p.created_at,
+             r.slug AS region_slug, r.name AS region_name, r.province
+        FROM places p
+   LEFT JOIN regions r ON p.region_id = r.id
+       WHERE ${where.join(' AND ')}
+       ${sort}
+       LIMIT ${limit} OFFSET ${offset}
+    `;
+    const { rows } = await pool.query(sql, args);
+
+    const countArgs = args.slice();
+    const countSql = `
+      SELECT COUNT(*)::int AS total
+        FROM places p
+   LEFT JOIN regions r ON p.region_id = r.id
+       WHERE ${where.join(' AND ')}
+    `;
+    const { rows: [{ total }] } = await pool.query(countSql, countArgs);
+
+    res.json({ total, limit, offset, places: rows });
+  } catch (e) {
+    res.status(500).json({ error: e.message });
+  }
+});
+
+app.get('/api/places/:slug', async (req, res) => {
+  try {
+    const { rows } = await pool.query(`
+      SELECT p.*, r.slug AS region_slug, r.name AS region_name, r.province
+        FROM places p
+   LEFT JOIN regions r ON p.region_id = r.id
+       WHERE p.slug = $1
+    `, [req.params.slug]);
+    if (!rows.length) return res.status(404).json({ error: 'not_found' });
+    res.json(rows[0]);
+  } catch (e) {
+    res.status(500).json({ error: e.message });
+  }
+});
+
+app.get('/api/stats', async (_req, res) => {
+  try {
+    const { rows: byCat } = await pool.query(
+      `SELECT category, COUNT(*)::int AS n FROM places WHERE status='active' GROUP BY category ORDER BY n DESC`
+    );
+    const { rows: byVert } = await pool.query(
+      `SELECT vertical, COUNT(*)::int AS n FROM places WHERE status='active' GROUP BY vertical ORDER BY n DESC`
+    );
+    const { rows: byRegion } = await pool.query(`
+      SELECT r.slug, r.name, COUNT(p.id)::int AS n
+        FROM regions r
+   LEFT JOIN places p ON p.region_id = r.id AND p.status='active'
+    GROUP BY r.id ORDER BY n DESC, r.name ASC
+    `);
+    const { rows: [{ total }] } = await pool.query(
+      `SELECT COUNT(*)::int AS total FROM places WHERE status='active'`
+    );
+    res.json({ total, by_category: byCat, by_vertical: byVert, by_region: byRegion, verticals: VERTICALS });
+  } catch (e) {
+    res.status(500).json({ error: e.message });
+  }
+});
+
+app.post('/api/leads', async (req, res) => {
+  try {
+    const { place_id, name, email, phone, message, meta } = req.body || {};
+    const { rows } = await pool.query(`
+      INSERT INTO leads (place_id, name, email, phone, message, meta, ip, user_agent)
+      VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
+    `, [place_id || null, name, email, phone, message, meta || {}, req.ip, req.get('user-agent') || '']);
+    res.json({ ok: true, id: rows[0].id });
+  } catch (e) {
+    res.status(500).json({ error: e.message });
+  }
+});
+
+app.get('/api/ingest/runs', async (_req, res) => {
+  try {
+    const { rows } = await pool.query(
+      `SELECT id, source, started_at, finished_at, rows_in, rows_added, rows_updated, status, notes
+         FROM ingest_runs ORDER BY started_at DESC LIMIT 50`
+    );
+    res.json({ runs: rows });
+  } catch (e) {
+    res.status(500).json({ error: e.message });
+  }
+});
+
+app.use(express.static(path.join(__dirname, 'public')));
+
+app.listen(PORT, '0.0.0.0', () => {
+  console.log(`[${SITE_NAME}] listening on :${PORT} — gated as ${BA_USER || 'OPEN'} — domain ${SITE_DOMAIN}`);
+});

(oldest)  ·  back to Costa Rica  ·  ingest pipeline: ict-cst + local-portals + meic-pymes + goog e517d11 →