Open Source School Marketplace

Build with Trade Buddy

A fully typed TypeScript SDK, REST API, and open source codebase. Build integrations for the school marketplace.

$ npm install @tradebuddy/sdk Click to copy
Quick Start API Reference GitHub

Quick Start
Up and running in 60 seconds
Install the SDK, authenticate, and start fetching listings in just a few lines of TypeScript.
1

Install the SDK

Add the Trade Buddy SDK to your project with npm or yarn.

2

Authenticate

Sign in with email and password to get a session token.

3

Fetch listings

Query the marketplace for products, donations, or wanted items.

4

Create a listing

Post a new item to the marketplace programmatically.

index.ts
// Step 1: Install
// Run in your terminal:

npm install @tradebuddy/sdk

// or with yarn:
yarn add @tradebuddy/sdk

// TypeScript types are included out of the box.
// No @types package needed.
import { TradeBuddy } from '@tradebuddy/sdk';

// Create a client instance
const client = new TradeBuddy();

// Authenticate with email and password
const session = await client.signIn({
  email: 'jane@school.edu',
  password: 'your-password',
});

console.log(session.user.name); // "Jane Doe"
console.log(session.token);     // "eyJhbG..."
// Fetch all listings from the marketplace
const listings = await client.getListings();

// Each listing is fully typed
listings.forEach((item: Listing) => {
  console.log(item.title);      // "School Blazer"
  console.log(item.type);       // "Sell" | "Donate" | "Wanted"
  console.log(item.price);      // 25
  console.log(item.category);   // "School Uniform"
});

// Filter by type
const donations = listings.filter(
  l => l.type === 'Donate'
);
// Create a new listing
const newListing = await client.createListing({
  title: 'Graphing Calculator',
  type: 'Sell',
  price: 35,
  category: 'Electronics',
  condition: 'Like New',
  description: 'TI-84 Plus, barely used',
});

console.log(newListing.id);  // "sell_42"

// Delete your account (careful!)
await client.deleteAccount();

API Reference
REST API
Authenticate users, manage listings, and interact with the marketplace.
API Operational
Authentication
POST Sign Up
POST Sign In
POST Sign Out
DEL Delete Account
Listings
GET All Listings
POST Create Listing
Sign Up
Create a new user account. Returns a Bearer token for authenticated requests.
No auth required
POSThttps://mytradebuddy.com/api/auth.php?action=signup
ParameterTypeDescription
name requiredstringFull name of the user
email requiredstringUser's email address
password requiredstringAccount password
import { TradeBuddy } from '@tradebuddy/sdk';

const client = new TradeBuddy();

const session = await client.signUp({
  name: 'Jane Doe',
  email: 'jane@school.edu',
  password: 'secure-password',
});

console.log(session.user);  // { id: 42, name: "Jane Doe", ... }
console.log(session.token); // Bearer token
curl -X POST https://mytradebuddy.com/api/auth.php?action=signup \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Doe",
    "email": "jane@school.edu",
    "password": "secure-password"
  }'
{
  "success": true,
  "user": {
    "id": 42,
    "name": "Jane Doe",
    "email": "jane@school.edu"
  },
  "token": "eyJhbGciOiJIUzI1NiJ9..."
}
Sign In
Authenticate an existing user and receive a Bearer token.
No auth required
POSThttps://mytradebuddy.com/api/auth.php?action=login
ParameterTypeDescription
email requiredstringRegistered email address
password requiredstringAccount password
const session = await client.signIn({
  email: 'jane@school.edu',
  password: 'secure-password',
});

// Session is now active
console.log(session.user.name); // "Jane Doe"
curl -X POST https://mytradebuddy.com/api/auth.php?action=login \
  -H "Content-Type: application/json" \
  -d '{ "email": "jane@school.edu", "password": "secure-password" }'
{
  "success": true,
  "user": { "id": 42, "name": "Jane Doe", "email": "jane@school.edu" },
  "token": "eyJhbGciOiJIUzI1NiJ9..."
}

Try it live

Connected
Response
Sign Out
Invalidate the current session token.
Bearer token required
POSThttps://mytradebuddy.com/api/auth.php?action=logout
await client.signOut();
// Token is now invalidated on the server
curl -X POST https://mytradebuddy.com/api/auth.php?action=logout \
  -H "Authorization: Bearer YOUR_TOKEN"
Delete Account
Permanently delete a user account and all associated listings. Cannot be undone.
Bearer token required
DELhttps://mytradebuddy.com/api/account.php?action=delete
// Permanently deletes account + all listings
await client.deleteAccount();
// All user data removed from database
curl -X POST https://mytradebuddy.com/api/account.php?action=delete \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "success": true,
  "message": "Account deleted successfully"
}
Get All Listings
Retrieve all marketplace listings. Returns products, donations, and wanted items.
No auth required
GEThttps://mytradebuddy.com/api/listings.php
const listings = await client.getListings();

listings.forEach((item: Listing) => {
  console.log(`${item.title} — $${item.price}`);
  console.log(`${item.category} | ${item.condition}`);
  console.log(`Seller: ${item.sellerName}`);
});
curl https://mytradebuddy.com/api/listings.php
{
  "success": true,
  "listings": [
    {
      "id": "sell_17",
      "type": "Sell",
      "title": "Sixth Form Uniform",
      "price": 40,
      "category": "School Uniform",
      "condition": "Good",
      "sellerName": "Arhan Harchandani",
      "createdAt": 1773280792000
    }
  ]
}

Try it live

Response
Create Listing
Post a new item to the marketplace.
Bearer token required
POSThttps://mytradebuddy.com/api/listings.php
ParameterTypeDescription
title requiredstringItem title
type required"Sell" | "Donate" | "Wanted"Listing type
price optionalnumberPrice (Sell only)
category requiredstringOne of 12 categories
condition requiredstringNew, Like New, Good, Fair
description optionalstringAdditional details
const listing = await client.createListing({
  title: 'Graphing Calculator',
  type: 'Sell',
  price: 35,
  category: 'Electronics',
  condition: 'Like New',
  description: 'TI-84 Plus, barely used.',
});

console.log(listing.id); // "sell_42"
curl -X POST https://mytradebuddy.com/api/listings.php \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Graphing Calculator",
    "type": "Sell",
    "price": 35,
    "category": "Electronics",
    "condition": "Like New"
  }'
{
  "success": true,
  "id": "sell_42"
}

TypeScript SDK
@tradebuddy/sdk
A fully typed TypeScript client for the Trade Buddy API. Zero dependencies, tree-shakeable, works everywhere.
types.ts
interface TradeBuddyConfig {
  baseUrl?: string;   // default: "https://mytradebuddy.com/api"
  token?: string;     // optional: resume a session
}

interface User {
  id: number;
  name: string;
  email: string;
}

interface Session {
  user: User;
  token: string;
}

interface Listing {
  id: string;
  type: 'Sell' | 'Donate' | 'Wanted';
  title: string;
  price: number;
  category: Category;
  condition: Condition;
  description?: string;
  imageUri?: string;
  sellerName: string;
  sellerEmail: string;
  createdAt: number;
}

type Category =
  | 'Books' | 'Electronics' | 'Clothing & Accessories'
  | 'School Uniform' | 'Sports Equipment' | 'Toys'
  | 'Video Games' | 'Board Games' | 'Furniture'
  | 'Kitchen Items' | 'Household Items'
  | 'Jewelry & Watches';

type Condition = 'New' | 'Like New' | 'Good' | 'Fair';

Fully Typed

TypeScript types for every request and response

Zero Dependencies

Uses native fetch — Node, Deno, Bun, browsers

Token Management

Handles Bearer tokens automatically after sign in

Tree-Shakeable

Import only what you need — minimal bundle


Roadmap
What we're building
Everything planned for the Trade Buddy developer platform.
Live

TypeScript SDK

Fully typed client for the Trade Buddy API. Install with npm, get autocomplete and type safety out of the box.

Building

Webhooks

Subscribe to real-time events — new listings, sales, account changes. Get HTTP POST notifications to your endpoint.

Planned

Developer API Keys

Dedicated API keys for third-party apps. Rate limiting, usage analytics, and scoped permissions per key.

Planned

Embeddable Widget

Drop a <script> tag on any school website to display Trade Buddy listings. Customizable themes and filters.

Planned

CLI Tool

Interact with Trade Buddy from your terminal. Browse listings, post items, manage your account with npx tradebuddy.

Planned

Status Page

Real-time API uptime monitoring at status.tradebuddy.dev. Incident history and response time metrics.

Planned

Changelog

Track every API change with versioned release notes. Never be surprised by breaking changes.


Architecture
What powers Trade Buddy
A full-stack architecture connecting parents across web and mobile with a shared database.

Website

Server-rendered PHP with MySQL. 12 category pages, admin panel, messaging, donations, wanted items.

PHPMySQLHTML/CSSJavaScript

Mobile App

Cross-platform React Native app built with Expo. Shares the same database and user accounts as the website.

React NativeExpoJavaScript

REST API

PHP endpoints with Bearer token auth. Powers the mobile app and the TypeScript SDK.

RESTJSONBearer Auth

Database

Shared MySQL database. Single source of truth for users, listings, messages, and sessions.

MySQLShared State
tradebuddyhq/site
mytradebuddy.com
PHPPrivate
tradebuddyhq/app
React Native mobile app for iOS
JavaScriptPublic
tradebuddyhq/sdk
TypeScript SDK. npm: @tradebuddy/sdk
TypeScriptPublic

Open Source
Contribute to Trade Buddy
Whether you're a student learning to code or an experienced developer, there's a place for you.
1

Fork the repo

Clone the app or SDK repository and set up your local dev environment.

git clone https://github.com/tradebuddyhq/app.git
2

Pick an issue

Check out open issues. Look for good first issue labels to get started.

gh issue list --repo tradebuddyhq/app
3

Submit a PR

Make your changes, test locally, and open a pull request. We review within 48 hours.

git checkout -b feature/your-feature

Team
Built by
The people behind Trade Buddy.

From Trade Buddy
Other open source tools by the Trade Buddy team.

Start building today

Install the SDK, explore the API, and help make school essentials accessible for every family.