gauge-highQuick 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

Start the dev server with npm run dev or npm start.

2

Open the Based Terminal

Navigate to the Based Terminal in your browser.

3

Load your MiniApp

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

Testing Checklist

Common Issues and Solutions

Issue: Not Connecting

circle-info

Ensure you are running inside the Based Terminal iframe context.

Issue: Permission Denied

circle-info

Request permissions explicitly before attempting restricted operations.

Issue: Market Data Not Updating

circle-info

Verify that the subscription succeeded and that event listeners are registered.

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