A fully typed TypeScript SDK, REST API, and open source codebase. Build integrations for the school marketplace.
Add the Trade Buddy SDK to your project with npm or yarn.
Sign in with email and password to get a session token.
Query the marketplace for products, donations, or wanted items.
Post a new item to the marketplace programmatically.
// 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();
| Parameter | Type | Description |
|---|---|---|
| name required | string | Full name of the user |
| email required | string | User's email address |
| password required | string | Account 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..."
}| Parameter | Type | Description |
|---|---|---|
| email required | string | Registered email address |
| password required | string | Account 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..."
}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"// 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"
}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
}
]
}| Parameter | Type | Description |
|---|---|---|
| title required | string | Item title |
| type required | "Sell" | "Donate" | "Wanted" | Listing type |
| price optional | number | Price (Sell only) |
| category required | string | One of 12 categories |
| condition required | string | New, Like New, Good, Fair |
| description optional | string | Additional 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"
}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';
TypeScript types for every request and response
Uses native fetch — Node, Deno, Bun, browsers
Handles Bearer tokens automatically after sign in
Import only what you need — minimal bundle
Fully typed client for the Trade Buddy API. Install with npm, get autocomplete and type safety out of the box.
Subscribe to real-time events — new listings, sales, account changes. Get HTTP POST notifications to your endpoint.
Dedicated API keys for third-party apps. Rate limiting, usage analytics, and scoped permissions per key.
Drop a <script> tag on any school website to display Trade Buddy listings. Customizable themes and filters.
Interact with Trade Buddy from your terminal. Browse listings, post items, manage your account with npx tradebuddy.
Real-time API uptime monitoring at status.tradebuddy.dev. Incident history and response time metrics.
Track every API change with versioned release notes. Never be surprised by breaking changes.
Server-rendered PHP with MySQL. 12 category pages, admin panel, messaging, donations, wanted items.
Cross-platform React Native app built with Expo. Shares the same database and user accounts as the website.
PHP endpoints with Bearer token auth. Powers the mobile app and the TypeScript SDK.
Shared MySQL database. Single source of truth for users, listings, messages, and sessions.
Clone the app or SDK repository and set up your local dev environment.
git clone https://github.com/tradebuddyhq/app.gitCheck out open issues. Look for good first issue labels to get started.
gh issue list --repo tradebuddyhq/appMake your changes, test locally, and open a pull request. We review within 48 hours.
git checkout -b feature/your-featureInstall the SDK, explore the API, and help make school essentials accessible for every family.