Architecture

This document provides an overview of VolumeCheck's technical architecture, detailing the components and their interactions.

Architecture Overview

VolumeCheck follows a modern web application architecture using Next.js as the core framework. The application is built with a focus on real-time data display and interaction.

Key Components

Frontend

  • Next.js: The application uses Next.js for server-side rendering and API routes

  • UI Components: Built with Shadcn UI components and Tailwind CSS

  • State Management: Uses React's built-in hooks for state management

  • Data Fetching: Utilizes SWR for data fetching with built-in caching and revalidation

Backend

  • API Routes: Next.js API routes serve as the backend endpoints

  • Database Access: Prisma ORM handles database interactions

  • Authentication: (If applicable) Describe authentication method

  • Data Processing: Backend logic for processing and aggregating token data

Database

  • PostgreSQL: Primary database for storing token data

  • Schema: Normalized schema for efficient storage and retrieval

  • Indexes: Optimized indexes for quick search operations

Data Flow

  1. Data Collection: Blockchain data is collected and processed (via external services or scripts)

  2. Data Storage: Processed data is stored in the PostgreSQL database

  3. API Endpoints: Next.js API routes expose this data through REST endpoints

  4. Frontend Consumption: The frontend fetches data from these endpoints and displays it

  5. User Interaction: Users interact with the data through the UI, triggering additional data fetching as needed

Component Interactions

The following diagram illustrates how components interact within the application:

User → Browser → Next.js Frontend → API Routes → Prisma ORM → PostgreSQL
                        ↑                ↑
                        |                |
                   UI Components     Data Processing

Folder Structure

pumpcheck/
├── app/                  # Next.js application
│   ├── api/              # API routes
│   │   ├── token-migration/  # Migration-related API endpoints
│   │   ├── token-creation/   # Creation-related API endpoints
│   │   └── stats/           # Statistics API endpoints
│   └── page.js           # Main dashboard page
├── components/           # UI components
│   ├── ui/               # Shadcn components
│   └── custom/           # Custom application components
├── lib/                  # Utility functions
│   ├── database.js       # Database connection utilities
│   ├── formatters.js     # Data formatting helpers
│   └── api-helpers.js    # API utility functions
├── prisma/               # Database schema and migrations
│   ├── schema.prisma     # Prisma schema definition
│   └── migrations/       # Database migrations
├── public/               # Static assets
└── package.json          # Dependencies and scripts

Scalability Considerations

VolumeCheck is designed with scalability in mind:

  • Data Fetching Strategy: Uses SWR for efficient cache management and revalidation

  • API Optimization: Endpoints are designed to return only necessary data

  • Database Indexing: Critical fields are indexed for quick lookup

  • Connection Pooling: Database connections are pooled for efficient resource usage

Security Aspects

The application implements several security best practices:

  • Input Validation: All user inputs are validated before processing

  • Rate Limiting: API endpoints are rate-limited to prevent abuse

  • Environment Variables: Sensitive configuration is stored in environment variables

  • CORS Configuration: Cross-Origin Resource Sharing is properly configured