Skip to content

Latest commit

 

History

History
105 lines (78 loc) · 2.74 KB

File metadata and controls

105 lines (78 loc) · 2.74 KB

Setup Guide

Quick Start

  1. Install Dependencies

    npm install
  2. Set Up Environment Variables

    Copy .env.example to .env and fill in your values:

    # On Windows (PowerShell)
    Copy-Item .env.example .env
    
    # On Linux/Mac
    cp .env.example .env

    Then edit .env and replace the placeholder values with your actual credentials.

  3. Set Up PostgreSQL Database

    If using Docker Compose, the database will be automatically initialized:

    docker-compose -f docker-compose.dev.yml up

    For manual setup:

    • Install PostgreSQL 17
    • Create a database: createdb token_meme
    • The database schema will be automatically migrated on first app startup

    Note: Database migrations run automatically on startup using versioned migration files with MD5 checksum verification. No manual SQL execution needed!

    The migration system will:

    • Read migration files from migrations/ directory in version order
    • Track applied migrations in schema_migrations table
    • Only apply new or changed migrations (detected via MD5 checksum)
    • Create all required tables automatically
  4. Add Admin Wallet (Optional)

    You can add additional admin wallets via PostgreSQL:

    INSERT INTO admin_wallets (wallet_address) 
    VALUES ('your_wallet_address_here');
  5. Run Development Server

    npm run dev
  6. Build for Production

    npm run build
    npm start

Docker Build

# Build the image
docker build -t token-meme .

# Run locally
docker run -p 3000:3000 --env-file .env token-meme

Google Cloud Deployment

  1. Enable required APIs

    gcloud services enable cloudbuild.googleapis.com
    gcloud services enable run.googleapis.com
  2. Build and push to Google Container Registry

    export PROJECT_ID=your-project-id
    docker build -t gcr.io/$PROJECT_ID/token-meme .
    docker push gcr.io/$PROJECT_ID/token-meme
  3. Deploy to Cloud Run

    gcloud run deploy token-meme \
      --image gcr.io/$PROJECT_ID/token-meme \
      --platform managed \
      --region us-central1 \
      --allow-unauthenticated \
      --set-env-vars="DATABASE_URL=postgresql://user:password@host:5432/dbname,NEXT_PUBLIC_SOLANA_NETWORK=devnet,ADMIN_WALLET_ADDRESS=..."

    Or use the Google Cloud Console to set environment variables through the UI.

Notes

  • The app uses devnet by default. Change NEXT_PUBLIC_SOLANA_NETWORK to mainnet-beta for production.
  • Admin access is granted to wallets specified in ADMIN_WALLET_ADDRESS env var or in the admin_wallets table.
  • The database schema is automatically initialized when using Docker Compose.