FORGE Header

Advanced

Architecture

Understanding Forge's technical architecture and design decisions

System Overview

Forge is built as a modern web application using Next.js 15 with the App Router. The architecture follows a clean separation of concerns with distinct layers for presentation, business logic, and data access.

Architecture Layers

1

Presentation Layer

React components, UI state, and user interactions

2

API Layer

Next.js API routes, request handling, validation

3

Business Logic Layer

Solana Agent Kit integration, plugin orchestration

4

Blockchain Layer

Solana Web3.js, wallet adapters, RPC communication

Technology Stack

Frontend

  • Next.js 15: React framework with App Router
  • React 19: UI library with latest features
  • TypeScript: Type-safe development
  • Tailwind CSS: Utility-first styling
  • Lucide React: Icon library

Backend

  • Next.js API Routes: Serverless functions
  • OpenAI API: GPT-4 for agent intelligence
  • Solana Web3.js: Blockchain interaction
  • Axios: HTTP client

Blockchain

  • Solana Agent Kit: Core agent framework
  • Wallet Adapter: Multi-wallet support
  • SPL Token: Token program library
  • Metaplex: NFT standards

Development

  • Node.js 22+: Runtime environment
  • npm/yarn: Package management
  • ESLint: Code linting
  • PostCSS: CSS processing

Component Architecture

Client Components

Interactive components that require client-side JavaScript:

  • • Dashboard navigation and layout
  • • Agent chat interface
  • • Wallet connection components
  • • Interactive forms and inputs
  • • Real-time data displays

Server Components

Components rendered on the server for better performance:

  • • Static page content
  • • Documentation pages
  • • Initial data fetching
  • • SEO-optimized content

Shared Components

Reusable components used across the application:

  • • Logo and branding
  • • Card components
  • • Icon wrappers
  • • Text effects
  • • Layout components

Data Flow

Agent Chat Flow

1.User sends message through chat interface
2.Frontend sends POST request to /api/agent/chat
3.API route validates request and extracts parameters
4.Message forwarded to OpenAI with agent context
5.Agent determines required blockchain actions
6.Solana Agent Kit executes operations via plugins
7.Results formatted and returned to frontend
8.UI updates with response and action results

Wallet Transaction Flow

1.User initiates transaction through UI
2.Transaction parameters validated on client
3.Transaction built using Solana Web3.js
4.User prompted to sign via wallet adapter
5.Signed transaction sent to Solana network
6.Confirmation awaited and status updated
7.UI reflects transaction completion

Plugin System

Modular Design

Forge uses a plugin-based architecture for blockchain operations:

  • Token Plugin: SPL token operations
  • NFT Plugin: Metaplex NFT functionality
  • DeFi Plugin: Protocol integrations
  • Misc Plugin: Utility functions

Plugin Benefits

  • ✓ Modular and maintainable codebase
  • ✓ Easy to extend with custom functionality
  • ✓ Clear separation of concerns
  • ✓ Independent testing and deployment
  • ✓ Reduced bundle size (tree-shaking)

Security Architecture

Private Key Management

Private keys never leave the wallet extension. All transactions are signed client-side using the Wallet Adapter protocol.

API Security

API routes use environment variables for sensitive data. Rate limiting prevents abuse. Request validation ensures data integrity.

RPC Communication

All blockchain communication uses HTTPS. Custom RPC endpoints can be configured for enhanced security and performance.

Performance Optimizations

Code Splitting

Next.js automatically splits code by routes, loading only necessary JavaScript.

Server Components

Static content rendered on server reduces client-side JavaScript.

Image Optimization

Next.js Image component provides automatic optimization and lazy loading.

Request Batching

Multiple blockchain requests batched to reduce RPC calls.

Deployment Architecture

Forge can be deployed to various platforms:

  • Vercel: Zero-config deployment with edge functions
  • Docker: Containerized deployment for custom infrastructure
  • Self-hosted: Node.js server with PM2 or similar
  • Static Export: Pre-rendered static site for CDN hosting