This project demonstrates a simple Node.js service that stores reservations in Firestore (using the local emulator).
Files added:
src/index.js- Express API with POST /reservationssrc/firebase.js- Firestore client initializationsrc/seed.js- seed sample inventory and user documentsdocker-compose.yml- runs a Firestore emulator and the API service
Quick start (macOS):
- Build and start the emulator + API:
docker-compose up --build- In a new terminal, seed sample data (runs inside host Node):
npm install
npm run seed- Create a reservation:
curl -X POST http://localhost:3000/reservations \
-H 'Content-Type: application/json' \
-d '{"instrument_id":"<instrument-id>","user_id":"<user-id>","start_date":"2025-10-18T10:00:00Z","end_date":"2025-10-19T10:00:00Z"}'Notes:
- The emulator runs at localhost:8080 and the API is configured via
FIRESTORE_EMULATOR_HOSTindocker-compose.ymlso the Admin SDK talks to the emulator. - Collections created:
inventory,user,reservation. IDs are UUIDs.