How evolify/pumpfun works
Project Type and Purpose
• This is a Next.js 13 full-stack PWA (Progressive Web App) focused on listing, sorting, filtering, and swapping “pump.fun” tokens.
• It uses the new App Router (app/), a small backend API route for pumping data, client-side state management, and a Service Worker for offline support.
File Structure
Top-level directories and roles:
• app/
– app/page.tsx, app/layout.tsx: Root layout and page shells
– app/modules/: Reusable UI modules (list/detail, header, reload button, loading spinner)
– app/api/pump/route.ts: Internal API endpoint to fetch pump token data
– app/store.ts: Client-side state management (e.g., Zustand or Context)
– app/sw.ts, public/sw.js: Service Worker registration and script
– app/~offline/: Offline fallback page
• common/
– common/api/, common/hooks/: API helper functions and React hooks (e.g., usePump)
– common/ui/: Component library (buttons, loading, popovers, theme toggle)
– common/utils/: General utilities (env, format, request, store, tracking)
– common/styles/: Base CSS (theme, UnoCSS)
• public/: Static assets (manifest.json, fallback SW.js)
• Configuration files: next.config.mjs, tsconfig.json, package.json, etc.
README for Additional Insights
• Core features: token listing, market cap sorting/filtering, social links, one-click swaps via Bonkbot, Pepeboost, GMGN Sniper Bot.
• PWA support and theming (light/dark).
• No internal database; data is fetched from an external “pump.fun” source or via the internal app/api/pump/route.ts which may proxy or transform it.
Main Components and Their Interactions
a. Client (Browser)
– Loads Next.js pages, runs React components, registers Service Worker
– Renders UI modules, invokes hooks (usePump)
b. Next.js App Router
– Server-side rendering (SSR)/static generation of pages in app/
– Client-side transitions between routes
c. Internal API Layer
– app/api/pump/route.ts: Fetches/normalizes pump token data for the client
d. State Management
– app/store.ts + common/utils/store.ts: Holds global UI state, filter/sort settings
e. Service Worker & Offline
– app/sw.ts & public/sw.js: Caches assets & API responses, serves ~offline/page.tsx when offline
f. Common Modules & UI Library
– Shared components, hooks, and utilities consumed by pages and modules
g. External Services
– pump.fun data source (token metadata, social links)
– Swap endpoints: Bonkbot, Pepeboost, GMGN Sniper Bot (one-click swap operations)
Architectural Patterns and Design Principles
– Component-based UI (modular, reusable React components)
– Separation of concerns (presentation in app/modules, data fetching in app/api, business logic in common)
– PWA best practices (Service Worker, offline fallback)
– Theme toggling via CSS variables and a theme context/provider
Final Touches
– Ensure every component is labeled with its folder/file path for traceability.
– Optionally, annotate with key technologies (Next.js, React, TypeScript, SCSS, UnoCSS, PWA).