Quick Start Guide

Build your first Based Terminal MiniApp in 5 minutes! This guide will walk you through creating a simple trading bot that monitors ETH prices and places orders.

Prerequisites

  • Node.js 16+ installed

  • Basic knowledge of JavaScript/TypeScript

  • Text editor or IDE

Step 1: Create Your Project

Option A: Vanilla JavaScript/TypeScript

# Create a new directory
mkdir my-first-miniapp
cd my-first-miniapp

# Initialize project
npm init -y

# Install the MiniApp SDK
npm install @basedone/miniapp-sdk

# Install development dependencies
npm install --save-dev vite typescript

Create index.html:

Create src/main.ts:

Add to package.json:

Run the dev server:

Option B: React Application

Replace src/App.tsx:

Run the app:

Step 2: Understanding the Code

Core Concepts

1. SDK Initialization

2. Connection Handling

3. Permissions

4. Market Data Subscription

5. Placing Orders

Step 3: Adding More Features

Add Price Alerts

Add Stop Loss

Add Position Tracking

Add Order History

Step 4: Testing Your MiniApp

Development Testing

  1. Run your development server (npm run dev or npm start)

  2. Open the Based Terminal

  3. Load your MiniApp from http://localhost:3000 (or your dev URL)

Testing Checklist

Common Issues and Solutions

Issue: Not Connecting

Solution: Ensure you're running inside the Based Terminal iframe context.

Issue: Permission Denied

Solution: Request permissions explicitly:

Issue: Market Data Not Updating

Solution: Check subscription and event listeners:

Next Steps

Now that you have a working MiniApp, explore more advanced features:

Batch Operations

Real-time Position Updates

Wallet Address

Resources

  • Architecture Guide - Deep dive into how MiniApps work at a High level

  • API Reference - Complete SDK documentation

  • Sample App - Working code examples

Last updated