Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ๏ธ Golf Charity Platform

A full-stack subscription platform that blends golf performance, real rewards, and meaningful impact.

Built to simulate a real-world SaaS product, this system combines:

  • ๐Ÿ“Š Score tracking
  • ๐ŸŽ Monthly reward draws
  • โค๏ธ Charity contributions
  • ๐Ÿ’ณ Subscription billing

๐ŸŒ Live Demo

๐Ÿ‘‰ https://golf-charity-platform-woad-gamma.vercel.app


๐Ÿง  The Idea

Most golf apps track performance.
Some platforms offer rewards.
Very few connect personal improvement โ†’ incentives โ†’ impact.

This platform does all three.

You play better โ†’ you stay consistent โ†’ you contribute โ†’ you get rewarded.


โš™๏ธ Core Product Flow

graph TD
A[User signs up] --> B[Subscribe via Stripe]
B --> C[Subscription stored via webhook]
C --> D[User adds golf scores]
D --> E[Latest 5 scores stored]
E --> F[Admin creates monthly draw]
F --> G[Draw simulated + published]
G --> H[Winners generated]
H --> I[User uploads proof]
I --> J[Admin verifies]
J --> K[Payout completed]
Loading

โœจ Features

๐Ÿ” Authentication & Roles

  • Supabase Auth (email/password)
  • Role-based system (admin vs subscriber)
  • Secure session handling (server-side)

๐Ÿ’ณ Subscription System (Stripe)

  • Monthly & yearly plans
  • Stripe Checkout integration
  • Webhook-driven state sync
  • Access gating based on subscription status

๐Ÿ“Š Golf Score Engine

  • Stores only latest 5 scores
  • Automatic rolling replacement
  • Stableford scoring format
  • Reverse chronological ordering

๐ŸŽฏ Monthly Draw System

  • Admin-controlled draw lifecycle:
    • Draft โ†’ Simulate โ†’ Publish
  • Score snapshot-based entry system
  • Match tiers:
    • 3-match
    • 4-match
    • 5-match (jackpot)
  • Prize pool distribution
  • Jackpot rollover logic

๐Ÿ† Winner Flow

  • Users upload proof (image/PDF)
  • Stored securely via Supabase Storage
  • Admin review system:
    • Approve / Reject
  • Payment tracking:
    • pending โ†’ paid

๐Ÿ›  Admin Dashboard

  • Create & manage draws
  • Simulate outcomes before publishing
  • Review winner claims
  • Platform analytics overview

โค๏ธ Charity System

  • Select a charity
  • Choose contribution %
  • Track user preference
  • Designed for future impact reporting

๐Ÿงฑ Tech Stack

Layer Tech
Frontend Next.js (App Router, Server Components)
Backend Server Actions (no REST bloat)
Database Supabase (PostgreSQL + RLS)
Auth Supabase Auth
Payments Stripe
Storage Supabase Storage
Deployment Vercel

๐Ÿงฉ Architecture Highlights

๐Ÿ”’ Row-Level Security (RLS)

  • All user data is protected at the database level
  • No reliance on frontend trust

โšก Server Actions

  • Direct DB + Stripe interaction
  • Eliminates API layer complexity
  • Cleaner, more maintainable architecture

๐Ÿ” Webhook-Driven Sync

  • Stripe events โ†’ Supabase state
  • Ensures source of truth = Stripe

Handles:

  • subscription activation
  • renewal
  • cancellation

๐Ÿ“ฆ Lazy Initialization (Stripe Fix)

  • Prevents Vercel build failures
  • Ensures runtime-only secret usage

๐Ÿš€ Getting Started

1. Clone

git clone https://github.com/YOUR_USERNAME/golf-charity-platform.git
cd golf-charity-platform

2. Install

npm install

3. Create Environment Variables .env.local

NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=

NEXT_PUBLIC_APP_URL=http://localhost:3000

STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=

4. Run

npm run dev

๐Ÿ—„ Database Setup

  • Create Supabase project
  • Run init.sql

Enable:

  • RLS
  • Storage bucket: winner-proofs

๐Ÿ’ณ Stripe Setup

Create products

  • Monthly
  • Yearly

Add webhook

https://your-domain.vercel.app/api/stripe/webhook

Events:

  • checkout.session.completed
  • customer.subscription.updated
  • customer.subscription.deleted

๐Ÿš€ Deployment

vercel --prod

๐Ÿงช Testing Checklist

  • Signup / login
  • Subscription checkout
  • Webhook updates DB
  • Dashboard unlocks
  • Add scores (max 5)
  • Create + publish draw
  • Upload proof
  • Admin approves
  • Mark payout as paid

๐Ÿ“Œ What This Project Demonstrates

  • End-to-end SaaS architecture
  • Payment systems + webhooks
  • Secure database design (RLS)
  • Admin workflows
  • Real-world product thinking
  • Production deployment

๐Ÿง  Lessons & Challenges

  • Handling Stripe webhooks across environments
  • Avoiding build-time secret crashes (lazy init pattern)
  • Designing clean server-action architecture
  • Maintaining data integrity with rolling score logic
  • Syncing multiple systems (Stripe โ†” Supabase)

๐Ÿ”ฎ Future Improvements

  • Email notifications (wins, renewals)
  • Leaderboards
  • Charity impact analytics
  • Mobile app (React Native)
  • Fraud detection for proof uploads

๐Ÿ™Œ Acknowledgements