Skip to content

PlaypowerLabs/playpower-games-dashboard

Repository files navigation

PlayPowerGames Dashboard

A modern lead tracking and CRM dashboard built with Next.js 14 and Supabase.

Features

  • 🎨 Modern dark mode UI
  • 📝 Lead capture form with validation
  • 🔒 Secure server-side API routes
  • ⚡ Real-time database sync with Supabase
  • 📱 Fully responsive design

Tech Stack

  • Next.js 14 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Supabase - PostgreSQL database and backend

Quick Setup

1. Install Dependencies

npm install

2. Set Up Supabase

  1. Create a free account at supabase.com
  2. Create a new project
  3. Go to SQL Editor and run the contents of setup.sql:
-- Create the leads table
CREATE TABLE IF NOT EXISTS leads (
  id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
  name TEXT NOT NULL,
  email TEXT NOT NULL UNIQUE,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- Add indexes
CREATE INDEX IF NOT EXISTS idx_leads_email ON leads(email);
CREATE INDEX IF NOT EXISTS idx_leads_created_at ON leads(created_at DESC);

-- Disable RLS (we use API routes for security)
ALTER TABLE leads DISABLE ROW LEVEL SECURITY;
  1. Get your credentials from Settings > API:
    • Project URL
    • anon public key

3. Configure Environment Variables

Copy .env.example to .env.local:

cp .env.example .env.local

Update .env.local with your Supabase credentials:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here

4. Run Development Server

npm run dev

Open http://localhost:3000 to see your dashboard.

Project Structure

├── app/
│   ├── api/leads/route.ts    # API endpoint for lead submissions
│   ├── layout.tsx             # Root layout
│   ├── page.tsx               # Main dashboard page
│   └── globals.css            # Global styles
├── components/
│   └── FeedbackForm.tsx       # Lead capture form
├── lib/
│   └── supabase.ts            # Supabase client config
└── setup.sql                  # Database setup script

How It Works

This app uses a server-side API route approach for security:

User → FeedbackForm → /api/leads → Supabase → Database

Benefits:

  • ✅ No database credentials exposed to browser
  • ✅ Server-side validation
  • ✅ Easy to extend (rate limiting, emails, etc.)
  • ✅ No RLS complexity

View Your Data

Go to your Supabase project → Table Editorleads table to see all submissions.

Or run this SQL query:

SELECT * FROM leads ORDER BY created_at DESC;

Deployment

Vercel (Recommended)

  1. Push your code to GitHub
  2. Import to Vercel
  3. Add environment variables in Vercel settings
  4. Deploy!

AWS Amplify

  1. Push to GitHub/GitLab/Bitbucket
  2. Connect to AWS Amplify
  3. Add environment variables
  4. Amplify uses amplify.yml automatically

Scripts

npm run dev      # Start development server
npm run build    # Build for production
npm start        # Start production server
npm run lint     # Run ESLint

Environment Variables

Variable Description Required
NEXT_PUBLIC_SUPABASE_URL Your Supabase project URL Yes
NEXT_PUBLIC_SUPABASE_ANON_KEY Your Supabase anon key Yes

License

MIT


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors