Skip to content

🚀 BacMR Postman Collections

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

📂 Contents

✨ Current Collection

  • collection.json - Complete API collection
  • environment_local.json - Local development environment
  • environment_staging.json - Staging environment
  • environment_production.json - Production environment
  • TESTING_WORKFLOWS.md - Step-by-step testing workflows

🛠️ Getting Started

1. Import to Postman

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

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. 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