Skip to content

Shpigford/dutch-auction

Repository files navigation

Dutch Auction Platform

A Next.js-based Dutch auction platform originally built by @Shpigford to sell Optic, a competitive monitoring and analysis platform. This project implements a fully automated Dutch auction system where the price decreases continuously over time until someone makes a purchase.

NOTE: This was originally thrown together very quickly for one specific purpose (selling Optic), so there's some cleanup to be done to repurpose it for your own use.

Example Auction

Features

  • 🏷️ Dutch Auction System

    • Automated price reduction over a 7-day period
    • Configurable starting and ending prices
    • Real-time price updates
    • First-come, first-served purchase system
  • 📊 Price Monitoring

    • Real-time price display with automatic updates
    • Countdown timer for auction start/end
    • Average target price indicator
    • Current visitor count display
  • 📧 Price Notifications

    • Email notification system when price reaches target
    • Rate limiting and spam protection
    • IP-based subscription limits
    • Automated email delivery via Postmark
  • 💳 Payment Processing

    • Stripe integration for secure payments
    • Automatic auction completion upon successful purchase
    • Sale status tracking
  • 🔒 Security Features

    • Rate limiting on all API endpoints
    • IP address hashing for privacy
    • Input validation and sanitization
    • Secure environment variable handling

Tech Stack

  • Frontend: Next.js 15, React, TypeScript, Tailwind CSS, Framer Motion
  • Backend: Next.js API Routes, Supabase
  • Database: PostgreSQL (via Supabase)
  • Email: Postmark
  • Payment: Stripe
  • Deployment: Vercel

Prerequisites

  • Node.js 18.x or higher
  • npm or yarn
  • Supabase account
  • Postmark account
  • Stripe account

Environment Variables

Create a .env.local file using the .env.example file as a template.

Getting Started

  1. Clone the repository:
git clone https://github.com/Shpigford/dutch-auction.git
cd dutch-auction
  1. Install dependencies:
npm install
# or
yarn install
  1. Set up your environment variables in .env.local

  2. Run the database migrations:

npm run supabase:migrate
# or
yarn supabase:migrate
  1. Start the development server:
npm run dev
# or
yarn dev
  1. Open http://localhost:3000 with your browser to see the result.

Database Setup

The project uses Supabase for database management. The necessary migrations are included in the supabase/migrations directory. They will create the following tables:

  • sale_status: Tracks the auction status and final sale price
  • email_notifications: Stores user notification preferences
  • visitor_count: Tracks unique visitors

API Routes

  • /api/check-price-notifications: Checks and sends price notifications
  • /api/create-checkout-session: Creates Stripe checkout sessions
  • /api/subscribe-notification: Handles notification subscriptions
  • /api/verify-payment: Processes successful payments
  • /api/webhook: Handles Stripe webhooks

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.

Acknowledgments