Skip to content

🚀 BacMR Postman Collections

This folder contains Postman collections and environments for testing the BacMR Backend.

📂 Contents

✨ Version 2 (Complete Architecture - Phases A-F)

  • collection_v2.json - Complete API with all Phase A-F implementations ← USE THIS
  • environment_local.json - Local development environment (v2)
  • environment_staging.json - Staging environment (v2)
  • environment_production.json - Production environment (v2)
  • README_v2.md - Complete setup guide for v2 collection
  • TESTING_WORKFLOWS.md - Step-by-step testing workflows

Version 1 (Legacy)

  • collection.json - Original collection (backward compatibility)
  • environment.json - Original environment template
  • render-environment.json - Render deployment environment

→ Use v2 files for complete architecture testing!

🛠️ Getting Started

1. Import to Postman

  1. Open Postman.
  2. Click Import.
  3. Drag and drop both collection.json and environment.json.

2. Configure Environment

  1. Select the BacMR Local environment in the top-right corner.
  2. Click the Environment Quick Look (eye icon) and set your variables:
  3. baseUrl: http://localhost:8000 (Local) or https://your-app.onrender.com (Production).
  4. adminKey: The ADMIN_API_KEY from your .env file.
  5. bacmr_jwt: A valid Supabase Access Token.

3. How to get a JWT

Since BacMR uses Supabase Auth, you can get a token by: 1. Logging in through your frontend. 2. Inspecting the Browser Console: localStorage.getItem('sb-XYZ-auth-token'). 3. Copying the access_token string.


📋 Endpoint Checklist

Endpoint Auth Required Type
GET /health No Utility
POST /auth/signin No Auth
GET /me Yes (Bearer) User
POST /chat Yes (Bearer) AI
GET /admin/users Yes (Admin JWT) Admin
GET /wallet/balance Yes (Bearer) Account

🔄 JWT Auto-Capture

The POST /auth/signin request includes a test script that automatically saves the access_token into your bacmr_jwt environment variable. You don't need to copy-paste it manually!


🔄 Maintenance & Updates

Adding a new endpoint

  1. Add the request to the Postman App.
  2. Set the URL to {{baseUrl}}/your-path.
  3. If protected, go to the Auth tab, select Inherit auth from parent, or manually use Bearer {{bacmr_jwt}}.
  4. Export the collection and overwrite postman/collection.json.

Validation Script

You can use newman to validate these locally:

npm install -g newman
newman run postman/collection.json -e postman/environment.json