Skip to content

Repository files navigation

PaciPort Logo

⚡ PaciPort

1-Click Perpetual Position Migration

Live DemoGitHubNext.jsReactCCXTSupabaseTypeScript

Live DemoVideo DemoDoraHacksGitHub

Migrate open perpetual positions from any exchange to Pacifica in < 2 seconds. Zero market exposure. Zero price risk.

PaciPort is a delta-neutral position migration engine built for the Pacifica Exchange Hackathon. It enables traders to teleport their open perp positions between exchanges with atomic, slippage-minimized execution — closing on the source and opening on the destination in parallel to maintain continuous market exposure.


📸 See it in Action

PaciPort Migration Demo

Select → Teleport → Done. Positions fly from Binance to Pacifica with atomic delta-neutral execution. Zero market exposure, zero price risk.


🎯 Problem

Moving perpetual positions between crypto exchanges is a nightmare:

  1. Manual close → transfer → re-open takes minutes, exposing traders to price risk
  2. No tooling exists to atomically migrate positions across exchanges
  3. Sticky TVL — exchanges benefit from the friction. Traders pay the cost

💡 Solution

PaciPort executes a delta-neutral swap — simultaneously closing a position on the source exchange and opening an identical position on the destination — achieving zero net market exposure during migration.

Key features:

  • Atomic 2-leg execution — close source + open destination concurrently via Promise.allSettled
  • Automatic rollback — if one leg fails, the other is reversed
  • Live price simulation — real-time PnL updates on all positions
  • Migration receipt — detailed execution report with slippage analysis
  • Fee savings calculator — shows annual savings from lower maker/taker fees
  • Position teleport animation — Framer Motion "teleport" effect as positions move between panels

🏗️ Architecture

Architecture

🛠️ Tech Stack

LayerTechnology
FrameworkNext.js 16.2.2 (App Router)
UIReact 19.2.4
StylingTailwind CSS v4 + CSS custom props
AnimationsFramer Motion 12
ExchangeCCXT 4.5 (unified trading API)
BackendSupabase (auth + credential vault)
FontsInter + JetBrains Mono
LanguageTypeScript 5

🚀 Getting Started

Prerequisites

  • Node.js ≥ 18
  • npm ≥ 9

Installation

git clone https://github.com/edycutjong/paciport.git
cd paciport
npm install

Environment Variables

Create a .env.local file in the project root:

# Supabase (optional — falls back to mock)NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.coNEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

Note for Judges: The app runs fully in demo mode without any environment variables. All exchange credentials are mocked and sandbox mode is enforced. No accounts, API keys, or configuration needed — just npm install && npm run dev.

Run Development Server

npm run dev

Open http://localhost:3000 to see the dashboard.

Build for Production

npm run build
npm start

📁 Project Structure

paciport/
├── app/
│ ├── api/
│ │ ├── migrate/route.ts # POST — execute position migration
│ │ └── positions/route.ts # GET — fetch live positions
│ ├── globals.css # Design tokens + animations
│ ├── layout.tsx # Root layout with metadata
│ └── page.tsx # Main dashboard (3-column layout)
├── components/
│ ├── ExchangeConnector.tsx # Exchange API key connection modal
│ ├── ExchangeLogo.tsx # Dynamic exchange logo renderer
│ ├── FeeSavingsCard.tsx # Annual fee savings calculator
│ ├── HeroSection.tsx # Landing hero with value prop
│ ├── MigrateButton.tsx # Animated migration trigger
│ ├── MigrationReceipt.tsx # Post-migration execution report
│ ├── PositionCard.tsx # Individual position display card
│ ├── PositionTable.tsx # Sortable position data table
│ └── SplitScreenMigration.tsx # Main 3-panel migration dashboard
├── lib/
│ ├── demo-data.ts # Demo positions + price simulator
│ ├── exchange-client.ts # CCXT client factory + caching
│ ├── migration-engine.ts # Core delta-neutral swap engine
│ ├── supabase.ts # Supabase client + credential vault
│ └── types.ts # TypeScript interfaces
├── public/ # Static assets (logo, OpenAPI spec)
├── .env.example # Environment template for judges
├── package.json
├── tsconfig.json
└── next.config.ts

📡 API Reference

POST /api/migrate

Execute a delta-neutral position migration.

Request Body:

{
"positionIds": ["pos-sol-long", "pos-eth-short"],
"sourceExchange": "binance",
"destinationExchange": "pacifica",
"maxSlippage": 0.1,
"dryRun": false
}

Response:

{
"results": [
{
"id": "mig-1712592000000-a1b2c3",
"status": "success",
"position": { "..." },
"sourceLeg": { "status": "filled", "fillPrice": 148.18, "slippage": 0.0135 },
"destinationLeg": { "status": "filled", "fillPrice": 148.22, "slippage": 0.0135 },
"executionTimeMs": 1412,
"netSlippage": 0.0135
}
],
"summary": {
"total": 1,
"successful": 1,
"failed": 0,
"totalExecutionTimeMs": 1412,
"allSuccess": true
}
}

GET /api/positions

Fetch all demo positions with live price updates.


⚙️ How the Migration Engine Works

  1. Select positions on the source exchange panel (Binance)
  2. Click Migrate → triggers POST /api/migrate
  3. Engine executes concurrently:
    • Source leg: Close position on Binance (market sell for longs, market buy for shorts)
    • Destination leg: Open identical position on Pacifica (same size, same side)
  4. Atomic safety:
    • Both legs execute via Promise.allSettled
    • If one leg fails and the other succeeds → automatic rollback
    • If both succeed → migration complete
  5. Receipt generated with execution time, slippage per leg, and net slippage

Demo Mode vs Live Mode

FeatureDemo Mode (demo-user)Live Mode (real userId)
Order executionSimulated (random slippage)Real CCXT market orders
Exchange connectionMocked credentialsDecrypted from Supabase vault
Sandbox modeAlways onBased on API key prefix
RollbackSimulatedReal reverse orders

🎨 Design System

The UI uses a custom dark theme with CSS custom properties:

TokenValueUsage
--bg#09090bPage background
--surface#111113Card backgrounds
--primary#06b6d4Pacifica brand (cyan)
--migrate#3b82f6Migration action (blue)
--success#22c55ePositive PnL
--loss#ef4444Negative PnL
--speed-gold#fbbf24Fee savings highlight
--competitor#f59e0bSource exchange (amber)

Fonts: Inter (UI) + JetBrains Mono (data/numbers)


🏆 Hackathon Context

Competition: Pacifica Exchange Hackathon
Track: DeFi / Exchange Tooling
Core Thesis: Reduce TVL friction by making position migration instant, safe, and free — giving Pacifica a competitive acquisition channel for existing perp traders.

Why Pacifica Should Care

  • TVL acquisition tool — removes the #1 barrier to switching exchanges
  • Network effect — each migration adds liquidity to Pacifica's order books
  • Fee incentive — savings calculator shows traders exactly how much they'd save annually

Sponsor Integration Points

IntegrationFileDescription
CCXT Exchange APIlib/exchange-client.tsUnified trading client supporting Pacifica + 100 exchanges
Migration Enginelib/migration-engine.tsDelta-neutral swap with atomic rollback
Position Fetchingapp/api/positions/route.tsLive position data with real-time PnL
Migration Endpointapp/api/migrate/route.tsPOST handler for executing position swaps
Fee Calculatorcomponents/FeeSavingsCard.tsxAnnual savings comparison vs competitor fees

📄 License

MIT © 2026 Edy Cu

About

Delta-neutral position migration engine enabling traders to teleport open perpetual positions between exchanges with atomic execution.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages