Skip to content
View bags-swarm-cli's full-sized avatar

Block or report bags-swarm-cli

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. Markdown is supported. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
Bags-swarm-CLI/README.md

🐝 Bags Swarm Model

A real-time Web3 trading dashboard powered by the Bags.fm API on Solana.

Bags Swarm Model

Features

  • πŸ”΄ Live Token Feed β€” Real-time token launches from Bags.fm, auto-refreshing every 15 seconds
  • πŸ“Š Trade Quotes β€” Instant swap quotes with price impact, slippage control, and route plans
  • πŸ” Token Analytics β€” Lifetime fees, creator breakdown, claim stats per token
  • 🌐 Swarm Visualization β€” Animated particle network background
  • πŸ”‘ API Key Manager β€” Secure browser-side key storage with live validation
  • πŸ“± Responsive β€” Works on mobile, tablet, and desktop

Tech Stack

  • Next.js 14 (Pages Router)
  • TypeScript
  • Tailwind CSS
  • Recharts (charts)
  • Lucide React (icons)
  • Bags.fm REST API

Getting Started Locally

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/bags-swarm-model.git
cd bags-swarm-model

2. Install dependencies

npm install

3. Set up environment variables

cp .env.example .env.local

Edit .env.local and add your Bags API key (optional β€” users can also enter it in the UI):

BAGS_API_KEY=your_bags_api_key_here

Get your API key at dev.bags.fm

4. Run the development server

npm run dev

Open http://localhost:3000 in your browser.


Deploy to GitHub + Vercel

Step 1 β€” Create a GitHub Repository

  1. Go to github.com/new
  2. Name it bags-swarm-model
  3. Set it to Public (required for free Vercel hobby plan)
  4. Do NOT initialize with README (your local repo already has one)
  5. Click Create repository

Step 2 β€” Push to GitHub

In your project directory, run:

git init
git add .
git commit -m "feat: initial Bags Swarm Model dashboard"
git branch -M main
git remote add origin https://github.com/YOUR_USERNAME/bags-swarm-model.git
git push -u origin main

Replace YOUR_USERNAME with your actual GitHub username.

Step 3 β€” Deploy to Vercel

Option A: Vercel Dashboard (Recommended)

  1. Go to vercel.com and sign in (use GitHub OAuth)
  2. Click "Add New β†’ Project"
  3. Click "Import" next to your bags-swarm-model repository
  4. Vercel will auto-detect it as a Next.js project
  5. Under Environment Variables, optionally add:
    • BAGS_API_KEY β†’ your Bags API key
  6. Click "Deploy"
  7. Wait ~60 seconds β€” your app is live! πŸŽ‰

Your URL will be: https://bags-swarm-model.vercel.app

Option B: Vercel CLI

# Install Vercel CLI
npm i -g vercel

# Login
vercel login

# Deploy (from your project directory)
vercel

# Follow the prompts:
# - Set up and deploy? Y
# - Which scope? (your account)
# - Link to existing project? N
# - Project name: bags-swarm-model
# - In which directory is your code? ./
# - Override settings? N

# For production deploy:
vercel --prod

Project Structure

bags-swarm-model/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ ApiKeyModal.tsx      # API key connect modal
β”‚   β”‚   β”œβ”€β”€ StatsBar.tsx         # Live stats overview cards
β”‚   β”‚   β”œβ”€β”€ SwarmBackground.tsx  # Animated particle canvas
β”‚   β”‚   β”œβ”€β”€ TokenCard.tsx        # Token feed card
β”‚   β”‚   β”œβ”€β”€ TokenDetailPanel.tsx # Token analytics panel
β”‚   β”‚   └── TradePanel.tsx       # Buy/Sell quote panel
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   └── useBags.ts           # React hooks for Bags API
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   └── bags-api.ts          # Bags API client & types
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ _app.tsx
β”‚   β”‚   β”œβ”€β”€ _document.tsx
β”‚   β”‚   └── index.tsx            # Main dashboard page
β”‚   └── styles/
β”‚       └── globals.css
β”œβ”€β”€ public/
β”‚   └── favicon.svg
β”œβ”€β”€ .env.example
β”œβ”€β”€ .gitignore
β”œβ”€β”€ next.config.js
β”œβ”€β”€ package.json
β”œβ”€β”€ postcss.config.js
β”œβ”€β”€ tailwind.config.js
β”œβ”€β”€ tsconfig.json
└── vercel.json

API Endpoints Used

Endpoint Description
GET /auth/me Validate API key & get user info
GET /token-launch/feed Live token launch feed
GET /trade/quote Swap quote with price impact
GET /analytics/token-lifetime-fees Total fees earned per token
GET /analytics/token-launch-creators Creator breakdown
GET /analytics/token-claim-stats Claim statistics
GET /state/pools All Bags liquidity pools

Full API docs: docs.bags.fm


Adding Wallet Integration (Next Steps)

To enable actual on-chain trading, integrate a Solana wallet adapter:

npm install @solana/wallet-adapter-react @solana/wallet-adapter-wallets @solana/web3.js

Then call POST /trade/swap with the quote requestId and your wallet's public key to get a transaction, sign it with the wallet adapter, and submit via POST /solana/send-transaction.


License

MIT β€” build freely, trade responsibly.


Built with ❀️ using Bags.fm API · Powered by Solana

Popular repositories Loading

  1. Bags-swarm-CLI Bags-swarm-CLI Public

    TypeScript

  2. bags-swarm-v2 bags-swarm-v2 Public

    TypeScript

  3. bags-swarm-fresh bags-swarm-fresh Public

    TypeScript