> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanaappkit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Server Overview

> Comprehensive backend server for the Solana App Kit, providing token management, social features, real-time messaging, and various API endpoints for interacting with the Solana blockchain.

<div className="flex items-center gap-2 mb-6">
  <img src="https://img.shields.io/badge/Solana-black?style=for-the-badge&logo=solana" alt="Solana" />

  <img src="https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />

  <img src="https://img.shields.io/badge/Express.js-404D59?style=for-the-badge" alt="Express.js" />

  <img src="https://img.shields.io/badge/PostgreSQL-316192?style=for-the-badge&logo=postgresql&logoColor=white" alt="PostgreSQL" />

  <img src="https://img.shields.io/badge/WebSocket-010101?style=for-the-badge&logo=socketdotio&logoColor=white" alt="WebSocket" />
</div>

## Overview

This backend server is built with Express.js and TypeScript, offering a robust API for Solana blockchain interactions, social features, real-time messaging, and comprehensive token management. It serves as the core backend for the Solana App Kit, providing modular, reusable, and easily customizable components for developers.

## Features

<CardGroup cols={2}>
  <Card title="Token Management" icon="coins">
    * Token creation via TokenMill
    * Market creation and management
    * Setting bonding curves
    * Token swapping (buy/sell)
    * Staking and vesting
    * Market graduation and funding
  </Card>

  <Card title="DEX Integrations" icon="exchange">
    * Jupiter DEX swapping
    * Raydium swap integration
    * Meteora DBC (Dynamic Bonding Curve)
    * PumpFun token launches
    * Cross-platform swap quotes
  </Card>

  <Card title="Social Features" icon="users">
    * Thread creation and management
    * User profiles and authentication
    * Follow system and user interactions
    * Image upload and management
    * User reactions and engagement
  </Card>

  <Card title="Real-time Features" icon="bolt">
    * WebSocket-based chat system
    * Global chat functionality
    * Real-time message delivery
    * Chat image support
    * Push notifications via Expo
  </Card>

  <Card title="Storage Solutions" icon="database">
    * IPFS integration via Pinata
    * Google Cloud Storage
    * Image processing and optimization
    * Metadata management
    * File upload handling
  </Card>

  <Card title="Wallet & Security" icon="shield">
    * Turnkey API integration
    * Secure wallet management
    * Transaction signing
    * Admin authentication system
    * Multi-signature support
  </Card>

  <Card title="NFT Operations" icon="image">
    * NFT minting and management
    * Metadata handling
    * Collection management
  </Card>

  <Card title="Aura System" icon="sparkles">
    * Aura-based interactions
    * User reputation management
    * Community engagement tracking
  </Card>
</CardGroup>

## Prerequisites

<AccordionGroup>
  <Accordion title="System Requirements">
    * **Node.js**: v16 or higher
    * **Package Manager**: pnpm (latest version)
    * **Database**: PostgreSQL (latest version)
  </Accordion>

  <Accordion title="Blockchain Requirements">
    * **Solana Wallet**: With SOL for transactions
    * **RPC Endpoint**: Access to Solana RPC (Helius recommended)
  </Accordion>

  <Accordion title="External Services">
    * **Google Cloud Storage**: Account with bucket setup
    * **Pinata**: Account for IPFS storage
    * **Turnkey**: API access for wallet management
    * **Expo**: For push notifications
  </Accordion>
</AccordionGroup>

## Quick Start

<Steps>
  <Step title="Clone and Navigate">
    ```bash theme={"system"}
    git clone https://github.com/SendArcade/solana-app-kit.git
    cd solana-app-kit/server
    ```
  </Step>

  <Step title="Install Dependencies">
    ```bash theme={"system"}
    pnpm install
    ```
  </Step>

  <Step title="Environment Setup">
    ```bash theme={"system"}
    cp .env.example .env
    ```

    <Note>
      Configure all required environment variables in your `.env` file. See the [Configuration](/docs/server/configuration) section for details.
    </Note>
  </Step>

  <Step title="Start Development Server">
    ```bash theme={"system"}
    pnpm dev
    ```

    <Info>
      The server will start on port 8080 (or the port specified in your environment variables) with WebSocket support enabled.
    </Info>
  </Step>
</Steps>

## Architecture Overview

The server follows a modular, service-oriented architecture:

```
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Controllers   │◄──►│    Services     │◄──►│   External APIs │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         ▲                        ▲                        ▲
         │                        │                        │
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│     Routes      │    │   Utilities     │    │   Blockchain    │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         ▲                        ▲                        ▲
         │                        │                        │
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│  Express App    │◄──►│   Database      │    │   WebSockets    │
└─────────────────┘    └─────────────────┘    └─────────────────┘
```

## Core Services

<Tabs>
  <Tab title="TokenMill Service">
    **Capabilities:**

    * Token creation and market management
    * Setting bonding curves for dynamic pricing
    * Token swapping with optimal rates
    * Staking mechanisms for rewards
    * Vesting schedules for token distribution
    * Market graduation and funding

    **Key Features:**

    * Integration with Solana programs
    * Real-time price calculations
    * Transaction optimization
  </Tab>

  <Tab title="WebSocket Service">
    **Features:**

    * Socket.IO integration
    * Global chat functionality
    * Real-time message delivery
    * Connection management
    * Transport optimization

    **Implementation:**

    * Cross-platform compatibility
    * Health monitoring
    * Debugging endpoints
  </Tab>

  <Tab title="Storage Service">
    **IPFS Integration:**

    * Metadata storage via Pinata
    * Decentralized content hosting
    * Gateway management

    **Cloud Storage:**

    * Google Cloud Storage for images
    * Image processing and optimization
    * CDN integration
  </Tab>

  <Tab title="Wallet Service">
    **Turnkey Integration:**

    * Secure key management
    * Hardware-backed security
    * Multi-signature support

    **Features:**

    * Wallet creation and recovery
    * Transaction signing
    * Address management
  </Tab>

  <Tab title="Notification Service">
    **Push Notifications:**

    * Expo integration
    * Real-time delivery
    * User targeting

    **Features:**

    * Notification scheduling
    * Custom payload support
    * Delivery tracking
  </Tab>
</Tabs>

## API Endpoints Overview

### TokenMill Endpoints

| Endpoint                 | Method | Description                    |
| ------------------------ | ------ | ------------------------------ |
| `/api/config`            | POST   | Create TokenMill configuration |
| `/api/quote-token-badge` | POST   | Get token badge quote          |
| `/api/markets`           | POST   | Create token market            |
| `/api/free-market`       | POST   | Free market from restrictions  |
| `/api/tokens`            | POST   | Create new token               |
| `/api/swap`              | POST   | Execute token swap             |
| `/api/stake`             | POST   | Create staking position        |
| `/api/vesting`           | POST   | Create vesting schedule        |

### DEX Integration Endpoints

| Endpoint              | Method  | Description             |
| --------------------- | ------- | ----------------------- |
| `/api/jupiter/*`      | Various | Jupiter DEX integration |
| `/api/raydium/swap/*` | Various | Raydium swap operations |
| `/api/meteora/*`      | Various | Meteora DBC operations  |
| `/api/pump-swap/*`    | Various | PumpSwap functionality  |

### Social & Real-time Features

| Endpoint             | Method  | Description         |
| -------------------- | ------- | ------------------- |
| `/api/thread`        | Various | Thread management   |
| `/api/profile`       | Various | User profiles       |
| `/api/chat`          | Various | Real-time messaging |
| `/api/notifications` | Various | Push notifications  |

<Tip>
  For detailed API documentation, see the [API Reference](/docs/server/endpoints/tokenmill) section.
</Tip>

## Security Measures

<Warning>
  **Important Security Considerations**

  * All transactions require proper signature verification
  * Environment variables store sensitive credentials
  * Database queries use parameterized statements
  * Error messages are sanitized
  * CORS configuration for API access
  * WebSocket connection validation
</Warning>

## Development Workflow

<CodeGroup>
  ```bash Development theme={"system"}
  # Start with auto-reload
  pnpm dev

  # Run with specific port
  PORT=3000 pnpm dev
  ```

  ```bash Production Build theme={"system"}
  # Build for production
  pnpm build

  # Start production server
  pnpm start
  ```

  ```bash Database Operations theme={"system"}
  # Run migrations
  pnpm migrate

  # Seed database
  pnpm seed
  ```
</CodeGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Installation Guide" icon="download" href="/docs/server/installation">
    Complete setup instructions with detailed environment configuration
  </Card>

  <Card title="API Documentation" icon="server" href="/docs/server/endpoints/tokenmill">
    Comprehensive API reference with examples and responses
  </Card>

  <Card title="Deployment" icon="rocket" href="/docs/server/deployment">
    Production deployment guides for various platforms
  </Card>

  <Card title="Integration Examples" icon="code" href="/docs/examples/server-integration">
    Real-world examples of client-server integration
  </Card>
</CardGroup>

***

<Info>
  **Need Help?** Check out our [support channels](/docs/support) or open an issue in the [GitHub repository](https://github.com/SendArcade/solana-app-kit).
</Info>
