Architecture

High-Level System Diagram

                          ┌──────────────┐
                          │   X (Twitter) │
                          │   Like API    │
                          └──────┬───────┘
                                 │ poll likes (every 5-8s)

┌─────────────┐         ┌──────────────────┐         ┌─────────────┐
│  Next.js    │◄───────►│   Express.js     │◄───────►│  PostgreSQL │
│  Frontend   │  REST   │   Backend        │  Prisma │  (Neon)     │
│  (Vercel)   │  + WS   │   (Render)       │         └─────────────┘
└─────────────┘         │                  │
                        │  ┌────────────┐  │         ┌─────────────┐
                        │  │ Trade Queue│  │◄───────►│ Upstash     │
                        │  │ (in-memory)│  │  REST   │ Redis       │
                        │  └─────┬──────┘  │         └─────────────┘
                        │        │         │
                        │        ▼         │         ┌─────────────┐
                        │  ┌────────────┐  │◄───────►│ Privy       │
                        │  │ Swap Engine│  │  HTTPS  │ (Wallets)   │
                        │  └─────┬──────┘  │         └─────────────┘
                        │        │         │
                        └────────┼─────────┘         ┌─────────────┐
                                 │                    │ Grammy Bot  │
                                 ▼                    │ (Telegram)  │
                  ┌──────────────────────────┐        └─────────────┘
                  │     DEX Aggregators      │
                  ├──────────┬───────────────┤
                  │ Base     │ Solana        │
                  │ 0x / 0x  │ Jupiter       │
                  │ Gasless  │ PumpFun       │
                  │ KyberSwap│               │
                  │ Odos     │               │
                  └──────────┴───────────────┘

Backend File Structure


Frontend File Structure


Database Schema (Key Models)


Middleware Stack (order matters)

Last updated

Was this helpful?