The cherry backend is a Node.js and TypeScript API built with Express and Firebase. It powers the cherry mobile app and supports a simple, trustworthy donation checkout flow for pre-loved clothing.
- Firebase-backed auth and user lookup
- Product, category, and charity APIs
- Order creation and CSV export
- Stripe payment intent creation and webhook handling
- Sendcloud shipping, pickup-point lookup, and webhook handling
- Swagger docs for local API exploration
For the current MVP, the backend is designed to validate the digital checkout loop safely.
- Use Stripe sandbox only for local development and testing
- Treat real money flows as out of scope for MVP verification
- Default non-production shipping to mocked responses so checkout can be exercised without live logistics
- Keep names optional in checkout payloads unless a later requirement makes them necessary
The fuller rationale is in docs/backend-mvp-boundary.md.
- Node.js 20 or later
- npm
- A Firebase project for non-test local development
- Install dependencies:
npm install- Copy the env template:
cp .env.example .env-
Fill in the values you need for your local setup.
-
Start the API:
npm run start:devThe API runs on http://localhost:3000 by default.
Swagger is available at:
http://localhost:3000/api-docs
Important vars for local work:
STRIPE_SECRET_KEYSTRIPE_PUBLISHABLE_KEYSTRIPE_WEBHOOK_SECRETSENDCLOUD_MODESENDCLOUD_PUBLIC_KEYSENDCLOUD_SECRET_KEYSENDCLOUD_WEBHOOK_SECRETFIREBASE_PROJECT_ID
Recommended defaults:
- Keep Stripe in test mode locally
- Set
SENDCLOUD_MODE=mockoutside production - Only use live Sendcloud credentials when you are deliberately testing the live shipping integration
See .env.example for the full template.
npm run start:dev
npm run build
npm test -- --runInBandThese files are the main entry points for the checkout path:
- Auth:
src/shared/middleware/authMiddleWare.ts,src/modules/auth/ - Orders:
src/modules/order/controllers/orderController.ts,src/modules/order/repositories/OrderRepository.ts - Payments:
src/shared/config/stripeConfig.ts,src/modules/payment/ - Shipping:
src/shared/config/sendcloudConfig.ts,src/modules/shipping/ - App wiring:
src/app.ts
Start with CONTRIBUTING.md. It covers local setup, mock-first workflows, and the files that usually need to change together.