TradeBridge is a full-stack project with a Next.js/TypeScript frontend and a Python backend, designed for seamless deployment and development.
frontend/— Next.js app (TypeScript)backend/— Python backend (Vercel-compatible)
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install
- Start the development server:
npm run dev
- Open http://localhost:3000 in your browser.
- Navigate to the backend directory:
cd backend - (Recommended) Create a Python 3.10 environment using conda or venv:
- Using conda:
conda create -p venv python=3.10 -y conda activate ./venv
- Or using venv:
python3.10 -m venv venv source venv/bin/activate
- Using conda:
- Install dependencies:
pip install -r requirements.txt
- Run the backend server with Uvicorn (runs on http://localhost:8000):
uvicorn main:app --reload
TradeBridge includes a complete Stripe Connect integration for marketplace payments:
- Stripe Connect: Lenders connect their Stripe accounts to receive payments directly
- QR Code Payments: Product QR codes link to instant checkout
- Platform Fees: Automatic 10% platform fee with 90% going to lenders
- Secure Checkout: Full PCI compliance via Stripe
-
Add Stripe keys to
.env.local:STRIPE_SECRET_KEY=sk_test_your_key NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_key NEXT_PUBLIC_ORIGIN=http://localhost:3000
-
Run the database migration:
psql -d your_database -f add_stripe_account_migration.sql
-
As a Lender: Visit Profile → Connect Stripe Account
-
As a Borrower: Scan product QR code → Auto-redirect to checkout
📚 Full Guide: See STRIPE_INTEGRATION_GUIDE.md for detailed setup, testing, and troubleshooting.
TradeBridge includes a secure QR code-based collection system for seamless item handovers:
- Borrow Flow: Lender generates a QR code → Borrower scans to confirm collection
- Return Flow: Borrower generates a QR code → Lender scans to confirm return
-
Add the following environment variable to your
.env.local:QR_SIGNING_SECRET=your-secure-random-secret-key-here -
Run the database migration:
-- Run the contents of add_qr_collection_migration.sql
- In the dashboard, look for "Collection QR" or "Return QR" buttons on active bookings
- QR codes expire after 10 minutes for security
- Each QR code can only be used once
- Successful scans automatically update booking status and send notifications
- JWT tokens signed server-side with HS256
- Single-use tokens stored as SHA-256 hashes
- 10-minute expiry for short-lived access
- Atomic database updates to prevent race conditions
- The backend is configured for Vercel deployment (see
backend/vercel.json). - The frontend can be deployed using Vercel or any platform supporting Next.js.
This project is licensed under the MIT License.