- Node.js 18+
- A MongoDB Atlas cluster (or self-hosted MongoDB)
- Gmail App Password
Copy .env.example to .env.local and fill in the values.
cp .env.example .env.localRequired:
MONGODB_URI: Your MongoDB connection string- In Atlas, click Connect → Drivers → copy the URI (replace username/password)
MONGODB_DB: Database name (defaultmakerspace)NODE_ENV:developmentorproduction
Email :
- Gmail SMTP
EMAIL_USER: your Gmail addressEMAIL_PASSWORD: an App Password from Google (Account → Security → 2‑Step Verification → App passwords)
JWT (required):
JWT_SECRET– strong random string (e.g.,openssl rand -base64 32)JWT_EXPIRES_IN– e.g.30s,10m,1hJWT_REFRESH_SECRET– strong random string (different from access secret)JWT_REFRESH_EXPIRES_IN– e.g.5m,7d
- Install deps
npm install- Seed settings ( creates default availability):
node setup-settings.js- Run locally
npm run devOpen http://localhost:3000.
- Public calendar feed:
GET /prod?action=calendar(ICS download) - Auth is JWT-based; ensure access and refresh secrets are set in env.
Collections used:
-
users- Example document:
{ "key": "alice@example.com", "hash": "<password-hash>", "salt": "<salt>", "token": "<session-token>", "userdata": { "firstname": "Alice", "lastname": "Doe", "user": "admin" // or "user" } }
- Example document:
-
bookings- Example document:
{ "id": 1717771234567, "user": "alice@example.com", "date": "2025-06-01", "start": 10, "end": 12, "npeople": 1, "description": "Optional" }
- Example document:
-
settingsavailabilityconfiguration document:{ "key": "availability", "spotsAvailable": [[/* 24 numbers */], /* 7 arrays total (Sun..Sat) */], "holidays": ["2025-12-25", "2025-01-01"], "recurHolidays": ["12-25", "01-01"] }
-
password_reset_tokens- Example document:
{ "email": "alice@example.com", "token": "<random-reset-token>", "expiresAt": "2025-06-01T12:00:00.000Z", "createdAt": "2025-06-01T11:00:00.000Z", "used": false, "usedAt": null }
- Example document:
Seed script: node setup-settings.js creates/updates the availability document.
- Vercel: push to a repo and import the project. Add the
.env.localvariables in the Vercel dashboard (Project → Settings → Environment Variables).