Skip to content

solanadapphunt/dapphunt

Repository files navigation

DappHunt - Solana dApp Discovery Platform

A Product Hunt-style platform for discovering and launching Solana dApps. Built with Next.js, Prisma, and integrated with Solana blockchain functionality.

πŸš€ Features

  • Project Submission & Approval - Submit dApps for community review
  • Voting System - Upvote/downvote projects with real user authentication
  • Google OAuth Authentication - Secure login with Google accounts
  • Admin Panel - Review and approve submissions
  • Leaderboards - Ranked lists by hunt score, votes, and time periods
  • Forum Discussions - Community discussions around projects
  • Solana Integration - Built-in wallet connection and Solana program interaction
  • Mobile Responsive - Works great on all devices

πŸ›  Tech Stack

  • Frontend: Next.js 14, React, TypeScript, TailwindCSS
  • Authentication: NextAuth.js with Google OAuth
  • Database: SQLite (development) / PostgreSQL (production) with Prisma ORM
  • Blockchain: Solana, Anchor Framework
  • UI Components: Radix UI, Lucide React
  • State Management: React Query, Jotai

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js v18.18.0 or higher
  • pnpm package manager
  • Rust v1.77.2 or higher (for Solana development)
  • Anchor CLI 0.30.1 or higher
  • Solana CLI 1.18.17 or higher

πŸš€ Quick Start

1. Clone the Repository

git clone <your-repo-url>
cd dapphunt

2. Install Dependencies

pnpm install

3. Set Up Environment Variables

Create a .env.local file in the root directory:

# NextAuth.js Configuration
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key-here

# Google OAuth (Required for authentication)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

# Database
DATABASE_URL="file:./dev.db"

To get Google OAuth credentials:

  1. Go to Google Cloud Console
  2. Create a new project or select existing one
  3. Enable Google+ API
  4. Create OAuth 2.0 credentials
  5. Add http://localhost:3000/api/auth/callback/google as authorized redirect URI

Generate NextAuth Secret:

openssl rand -base64 32

4. Set Up the Database

Generate Prisma client and create the database:

# Generate Prisma client
npx prisma generate

# Create and migrate database
npx prisma db push

# Seed the database with sample data
npx prisma db seed

5. Start the Development Server

pnpm dev

The app will be available at http://localhost:3000

πŸ“– Detailed Setup

Database Management

View Database (Optional):

npx prisma studio

Reset Database:

npx prisma db push --force-reset
npx prisma db seed

Deploy Database Changes:

npx prisma db push

Solana Development (Optional)

If you want to work with the Solana program:

Sync Program ID:

pnpm anchor keys sync

Build Solana Program:

pnpm anchor-build

Start Local Validator:

pnpm anchor-localnet

Run Tests:

pnpm anchor-test

Deploy to Devnet:

pnpm anchor deploy --provider.cluster devnet

🧭 Usage Guide

First Time Setup

  1. Start the app - Run pnpm dev
  2. Sign in - Click "Sign In" and authenticate with Google
  3. Explore - Browse existing projects on the home page
  4. Vote - Click upvote buttons to vote on projects
  5. Submit - Go to /submit to submit your own dApp
  6. Admin - Visit /admin to approve submissions (when signed in)

Key Routes

  • / - Home page with top projects
  • /products - All projects with filtering
  • /submit - Submit new dApp
  • /admin - Admin panel for approvals
  • /leaderboard - Leaderboard rankings
  • /profile - User profile and submissions
  • /solana - Solana blockchain features

πŸ— Project Structure

src/
β”œβ”€β”€ app/                    # App Router (Next.js 13+)
β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”‚   β”œβ”€β”€ auth/         # NextAuth configuration
β”‚   β”‚   β”œβ”€β”€ projects/     # Project CRUD operations
β”‚   β”‚   β”œβ”€β”€ submissions/  # Submission management
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ solana/           # Solana-specific pages
β”‚   └── layout.tsx        # Root layout
β”œβ”€β”€ pages/                 # Pages Router (legacy routes)
β”‚   β”œβ”€β”€ products.tsx      # Products listing
β”‚   β”œβ”€β”€ profile.tsx       # User profiles
β”‚   └── _app.tsx         # Pages app wrapper
β”œβ”€β”€ components/           # Reusable UI components
β”‚   β”œβ”€β”€ ui/              # Base UI components
β”‚   β”œβ”€β”€ Header.tsx       # Navigation header
β”‚   β”œβ”€β”€ ProductCard.tsx  # Product display card
β”‚   └── ...
β”œβ”€β”€ hooks/               # Custom React hooks
β”œβ”€β”€ lib/                 # Utility libraries
β”‚   β”œβ”€β”€ prisma.ts       # Prisma client
β”‚   └── auth.ts         # Auth utilities
β”œβ”€β”€ providers/          # Context providers
└── types/             # TypeScript definitions

prisma/
β”œβ”€β”€ schema.prisma      # Database schema
β”œβ”€β”€ seed.ts           # Database seeding
└── dev.db           # SQLite database (development)

anchor/               # Solana program code
β”œβ”€β”€ programs/        # Rust programs
β”œβ”€β”€ tests/          # Program tests
└── Anchor.toml     # Anchor configuration

πŸ”§ Development Scripts

# Development
pnpm dev              # Start development server
pnpm build            # Build for production
pnpm start            # Start production server

# Database
pnpm db:generate      # Generate Prisma client
pnpm db:push          # Push schema changes
pnpm db:seed          # Seed database
pnpm db:studio        # Open Prisma Studio

# Solana/Anchor
pnpm anchor-build     # Build Solana program
pnpm anchor-test      # Run program tests
pnpm anchor-localnet  # Start local validator

🎯 Key Features Walkthrough

Authentication Flow

  1. Click "Sign In" β†’ Google OAuth β†’ Automatic account creation
  2. Users get auto-generated usernames
  3. Session persists across browser restarts

Project Submission Flow

  1. /submit β†’ Fill out comprehensive form
  2. Submission goes to admin review (/admin)
  3. Admin approves β†’ Project appears on platform
  4. Real-time voting and hunt scores

Admin Workflow

  1. Sign in β†’ Access /admin
  2. Review pending submissions
  3. One-click approval creates live projects
  4. Manage platform content

🚨 Troubleshooting

Authentication Issues:

  • Verify Google OAuth credentials in .env.local
  • Check redirect URIs match exactly
  • Clear browser cookies and restart dev server

Database Issues:

  • Run npx prisma db push to sync schema
  • Check DATABASE_URL in environment variables
  • Reset with npx prisma db push --force-reset

Build Errors:

  • Delete .next folder and restart
  • Check all environment variables are set
  • Verify Node.js version compatibility

πŸ“š Additional Resources

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

[Add your license here]


Built with ❀️ for the Solana ecosystem

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages