A modern web application built with TanStack Router, React, and Solana integration, featuring authentication via Privy and AI capabilities.

Features

Authentication

Secure user authentication powered by Privy’s embedded wallet solution

Solana Integration

Built with Solana Agent Kit for blockchain interactions and transactions

AI Capabilities

OpenAI integration for intelligent features and natural language interactions

Modern UI

Built with Radix UI components and Tailwind CSS for a sleek user experience

Type Safety

Full TypeScript support throughout the application codebase

Database Integration

PostgreSQL with Drizzle ORM for efficient data management

Tech Stack

CategoryTechnologies
FrontendReact 19, TanStack Router
AuthenticationPrivy
BlockchainSolana Web3.js, Solana Agent Kit
StylingTailwind CSS, Radix UI
DatabasePostgreSQL, Drizzle ORM
AIOpenAI SDK
DevelopmentTypeScript, Biome, Vinxi

Installation

1

Clone the repository

# Clone the starter template
npx gitpick sendaifun/solana-agent-kit/examples/privy-agent-tanstack-starter -b v2
cd privy-solana-agent
2

Install dependencies

pnpm install
3

Set up environment variables

Create a .env file in the root directory with the following variables:

# Privy credentials
VITE_PRIVY_APP_ID=

# Database connection
DATABASE_URL=

# Solana RPC URL
VITE_RPC_URL=

# OpenAI API key
OPENAI_API_KEY=
4

Run database migrations

pnpm db:generate
pnpm db:migrate

Development

Start the development server:

pnpm dev

The application will be available at http://localhost:3000.

Linting and Formatting

CommandDescription
pnpm lintRun linting
pnpm lint:fixFix linting issues

Database Management

CommandDescription
pnpm db:generateGenerate migrations
pnpm db:migrateRun migrations
pnpm db:studioOpen database studio
pnpm db:pushPush schema changes
pnpm db:pullPull schema changes
pnpm db:checkCheck schema
pnpm db:upUpdate schema

Project Structure

src/
├── components/     # React components
├── functions/     # Server-side functions
├── hooks/         # Custom React hooks
├── lib/           # Library code and utilities
├── routes/        # Application routes
├── styles/        # Global styles
└── utils/         # Utility functions

Privy Integration

This starter uses Privy to provide a seamless embedded wallet experience. Privy offers several advantages for Solana Agent Kit applications:

  • Simplified Authentication: Email, social, and wallet-based auth
  • Human-in-the-loop Transactions: Users confirm all transactions
  • Multi-device Support: Access from multiple devices
  • Non-custodial: Users maintain control of their keys
  • Social Recovery Options: Easy key recovery methods

Key Benefits

User-friendly Authentication

Privy provides a streamlined authentication experience that supports multiple methods including email, social logins, and existing wallets. This makes your application accessible to both crypto novices and experienced users.

Human-in-the-loop Security

All transactions require explicit user approval, ensuring that users maintain control over their assets while still allowing for an AI-assisted experience.

Database Integration

This starter includes a complete database setup with PostgreSQL and Drizzle ORM, allowing you to:

  • Store user preferences and settings
  • Save conversation history
  • Track transaction history
  • Implement custom features requiring persistent data

Type-safe Routing

The TanStack Router integration provides type-safe routing throughout the application, reducing errors and improving developer experience.

This is a starter template and may not include all features or optimizations for production use (e.g the use of the OpenAI API key on the client). Please review and modify as necessary for your specific use case.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.