7.5 KiB
GridPilot Landing Page
Pre-launch landing page for GridPilot with email signup functionality.
Features
- Mode Switching: Toggle between pre-launch (landing page only) and alpha (full platform) modes
- Email Capture: Collect email signups with validation and rate limiting
- Production Ready: Configured for Vercel deployment with KV storage
Local Development Setup
Prerequisites
- Node.js 20+
- npm or pnpm
Installation
- Clone the repository and navigate to the website directory:
cd apps/website
- Install dependencies:
npm install
- Copy environment variables:
cp .env.example .env.local
- Configure environment variables in
.env.local:
# Application Mode (pre-launch or alpha)
NEXT_PUBLIC_GRIDPILOT_MODE=pre-launch
# Vercel KV (required for email signups)
KV_REST_API_URL=your_kv_rest_api_url_here
KV_REST_API_TOKEN=your_kv_rest_api_token_here
# Site URL
NEXT_PUBLIC_SITE_URL=http://localhost:3000
- Start the development server:
npm run dev
Visit http://localhost:3000 to see the landing page.
Environment Variables
Required Variables
| Variable | Description | Example |
|---|---|---|
NEXT_PUBLIC_GRIDPILOT_MODE |
Application mode (server & client) | pre-launch or alpha |
KV_REST_API_URL |
Vercel KV REST API endpoint | From Vercel Dashboard |
KV_REST_API_TOKEN |
Vercel KV authentication token | From Vercel Dashboard |
NEXT_PUBLIC_SITE_URL |
Public site URL | https://gridpilot.com |
Getting Vercel KV Credentials
- Go to Vercel Dashboard
- Navigate to Storage → Create Database → KV
- Create a new KV database (free tier available)
- Copy the
KV_REST_API_URLandKV_REST_API_TOKENfrom the database settings - Add them to your environment variables
Mode Switching
The application supports two modes:
Pre-Launch Mode (Default)
- Shows landing page with email capture
- Only
/and/api/signuproutes are accessible - All other routes return 404
To activate:
NEXT_PUBLIC_GRIDPILOT_MODE=pre-launch
Post-Launch Mode
- Full platform access
- All routes are accessible
- Landing page is still available at
/
To activate:
NEXT_PUBLIC_GRIDPILOT_MODE=alpha
Email Signup API
Endpoint
POST /api/signup
Request Body
{
"email": "user@example.com"
}
Response
Success (200):
{
"success": true,
"message": "Successfully added to waitlist"
}
Error (400/409/429/500):
{
"error": "Error message here"
}
Features
- Validation: Email format validation using Zod
- Rate Limiting: Max 5 submissions per IP per hour
- Duplicate Prevention: Prevents duplicate email submissions
- Disposable Email Detection: Blocks common disposable email services
- Storage: Emails stored in Vercel KV with timestamp and IP
Accessing Submitted Emails
Submitted emails are stored in Vercel KV under the key signups:emails.
Option 1: Vercel KV Dashboard
- Go to Vercel Dashboard
- Navigate to Storage → Your KV Database
- Browse the
signups:emailshash
Option 2: CLI (with Vercel KV SDK)
import { kv } from '@vercel/kv';
// Get all signups
const signups = await kv.hgetall('signups:emails');
console.log(signups);
Deployment
Vercel Deployment (Recommended)
-
Connect Repository
- Go to Vercel Dashboard
- Import your Git repository
- Select the
apps/websitedirectory as the root
-
Configure Build Settings
- Framework Preset: Next.js
- Build Command:
npm run build - Output Directory:
.next - Install Command:
npm install
-
Set Environment Variables
In Vercel Dashboard → Project Settings → Environment Variables:
Production:
NEXT_PUBLIC_GRIDPILOT_MODE=pre-launch KV_REST_API_URL=<your_vercel_kv_url> KV_REST_API_TOKEN=<your_vercel_kv_token> NEXT_PUBLIC_SITE_URL=https://gridpilot.comPreview (optional): Same as production, or use different values for testing
-
Deploy
- Click "Deploy"
- Vercel will automatically deploy on every push to main branch
Switching to Post-Launch Mode
When ready to launch the full platform:
- Go to Vercel Dashboard → Project Settings → Environment Variables
- Update
NEXT_PUBLIC_GRIDPILOT_MODEtoalpha - Redeploy the application (automatic if you save changes)
Custom Domain Setup
- Go to Vercel Dashboard → Project Settings → Domains
- Add your domain (e.g.,
gridpilot.com) - Follow DNS configuration instructions
- Update
NEXT_PUBLIC_SITE_URLenvironment variable to match your domain
Build & Test
Build for Production
npm run build
This creates an optimized production build in .next/ directory.
Start Production Server
npm run start
Lint
npm run lint
Testing Email Signup
Test Locally
- Start the development server
- Navigate to
http://localhost:3000 - Scroll to "Want Early Access?" section
- Enter an email and click "Join Waitlist"
Test Scenarios
- ✅ Valid email submission
- ✅ Invalid email format rejection
- ✅ Duplicate email prevention
- ✅ Rate limiting (5 submissions per hour)
- ✅ Loading states
- ✅ Error messages
- ✅ Success confirmation
Test Rate Limiting
Submit the same email 5 times within an hour. The 6th submission should return a 429 error.
Troubleshooting
Email Signup Not Working
Issue: API returns 500 error
Solution: Check that KV_REST_API_URL and KV_REST_API_TOKEN are correctly set in environment variables
Mode Switching Not Working
Issue: Routes still show 404 in alpha mode
Solution:
- Ensure
NEXT_PUBLIC_GRIDPILOT_MODEis set toalpha - Restart the development server or redeploy to Vercel
- Clear browser cache
Rate Limiting Issues
Issue: Rate limiting not working in development
Solution: Vercel KV may need to be properly configured. Check KV dashboard for errors.
Project Structure
apps/website/
├── app/
│ ├── api/
│ │ └── signup/
│ │ └── route.ts # Email signup API endpoint
│ ├── globals.css
│ ├── layout.tsx
│ └── page.tsx # Landing page
├── components/
│ ├── landing/
│ │ ├── EmailCapture.tsx # Email signup form
│ │ ├── FAQ.tsx
│ │ ├── FeatureGrid.tsx
│ │ ├── Hero.tsx
│ │ └── RatingExplainer.tsx
│ ├── mockups/ # UI mockups
│ ├── shared/
│ │ └── ModeGuard.tsx # Client-side mode guard
│ └── ui/ # Reusable UI components
├── lib/
│ ├── email-validation.ts # Email validation utilities
│ ├── mode.ts # Mode detection utilities
│ └── rate-limit.ts # Rate limiting utilities
├── middleware.ts # Next.js middleware for route protection
├── .env.example # Environment variables template
└── README.md # This file
Tech Stack
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- Validation: Zod
- Storage: Vercel KV (Redis)
- Deployment: Vercel
Support
For issues or questions, contact the development team or open an issue in the repository.