Smart Courier Box (SCB) — secure, battery-powered delivery box with QR-based access.
Prereqs: Node 18+.
Install dependencies (root + workspaces) and run both apps:
npm install
npm run dev
- frontend/ — React (Vite)
- backend/ — Express API
- vercel.json — routes /api/* to backend and serves frontend/dist
Backend tests:
npm -w backend test
This repo is set up to deploy as:
- Serverless Node backend at /api/* using
backend/server.js. - Static frontend built with Vite from
frontend/dist.
Steps:
- Push the repo to GitHub.
- In Vercel, import the project and select this repository.
- Build command:
npm run vercel-build. - Output directory:
frontend/dist(handled viavercel.json). - Set required environment variables in Vercel (Project Settings → Environment Variables):
- Frontend:
VITE_API_BASE=/api - Backend: any needed from
.env.example(Firebase Admin, notifications, auth flags, rate limits, etc.)
- Frontend:
- Deploy. API routes are served under
/api/*; all other routes serve the SPAindex.html.
Notes:
- The backend will not call
app.listen()on Vercel functions; it only exports the Express app. - Toggle Firestore with
USE_FIRESTORE=1when Firebase Admin is configured.
Copy .env.example files and set values as needed. Never commit real secrets.