A small Node.js/Fastify service to check if an email is already subscribed to a newsletter. Supports Brevo, ActiveCampaign, and local hash DB backends.
Requires Node.js 24+ (use nvm use to activate the pinned version).
git clone <repo-url>
cd lookup
nvm use
npm installCreate a .env file (see Environment Variables below).
npm run dev # start with .env
npm run dev -- --org_name # start with .env.org_name
npm run dev -- --env=.env.org_name # start with explicit pathRequired in every .env:
TYPE— backend:brevo,activecampaign, orlocalPORT— port to listen on
Brevo (TYPE=brevo):
BREVO_KEY— Brevo API keyBREVO_LIST_ID— numeric list ID to check membership against
ActiveCampaign (TYPE=activecampaign):
API_KEY— ActiveCampaign API tokenAPI_URL— account URL (e.g.https://account.api-us1.com)API_LIST_ID— (optional) list ID; if omitted, only contact existence is checked
Local hash DB (TYPE=local):
FETCH_METHOD— how to fetch hashes:ftpFTP_HOST— FTP server hostnameFTP_USER— FTP usernameFTP_PASS— FTP passwordDB_PATH— (optional) path to SQLite file; defaults to./hashes.dbWORKER_CRON— (optional) sync schedule; defaults to0 10 * * *(daily at 10am)
Optional:
SENTRY_DSN— Sentry error reporting (production only)NODE_ENV—developmentenables pretty logging;productionenables Sentry
POST /lookup?email=<email> or GET /lookup?email=<email>
Subscribed:
{
"customer": { "emailStatus": "already_subscribed" },
"action": {
"customFields": { "isSubscribed": true },
"privacy": { "optIn": true }
}
}Not subscribed / not found:
{}Start the server with one of the pre-configured env files:
npm run dev -- --orgnameThen in another terminal, use curl or the included test script (reads PORT from the env file automatically):
curl -X POST "http://localhost:<port>/lookup?email=user@example.com"
node src/test.ts user@example.com --orgnameTo trigger a one-off hash sync without starting the server:
./src/worker/run.ts --orgnamenpm run build # bundles to dist/server.js
npm run start:prod # runs with NODE_ENV=production