The StrayCare backend is a TypeScript API built with Express. It provides authentication, profiles, rescue workflows, community features, donations, file uploads, notifications, and real-time chat and calls through Socket.IO.
- Node.js 20 LTS (supported range:
>=20 <23) - MongoDB, or the repository's test database setup
npm install
copy .env.example .envFill in .env before starting the server. MESSAGE_ENCRYPTION_KEY must be a 64-character hexadecimal value. MONGO_URI is required for normal development; the server can fall back to an in-memory database when it is absent.
| Command | Purpose |
|---|---|
npm run dev |
Start the TypeScript server with watch mode |
npm run build |
Compile TypeScript to dist/ |
npm start |
Run the compiled server |
npm test |
Run Jest tests |
npm run test:coverage |
Generate a Jest coverage report |
npm run kill-port |
Free the configured development port |
The server uses port 5000 by default and automatically tries the next available ports. Check the health endpoint at http://localhost:5000/ping.
src/routes- Express route modulessrc/controllers- Request handlerssrc/services- Application and integration servicessrc/models- Mongoose modelssrc/sockets- Socket.IO event handlerstests- Integration and end-to-end tests
Run the test suite with:
npm testKeep credentials, Firebase service-account files, and production secrets out of version control.