Documentation

Everything you need to set up, customize, and deploy SiteBolt.

Quick Start

01

Clone & Install

git clone <your-repo-url> sitebolt
cd sitebolt
npm install
02

Set Up Supabase

1. Create a new project at supabase.com
2. Go to SQL Editor and run both schema files:
   - supabase-schema.sql (core tables, RLS, triggers)
   - supabase-schema-v2.sql (payments, emails, webhooks)
3. Copy your project URL and keys from Settings > API
03

Set Up Stripe

1. Create a Stripe account at stripe.com
2. Create 2 products with monthly prices (Pro & Unlimited)
3. Copy the Price IDs (price_xxx)
4. Create a webhook endpoint:
   URL: https://yourdomain.com/api/stripe/webhook
   Events: customer.subscription.*, invoice.*
5. Copy the webhook signing secret (whsec_xxx)
04

Configure Environment

cp .env.example .env.local
# Fill in all required variables (see table below)
05

Run Development Server

npm run dev
# Open http://localhost:3000
06

Deploy to Vercel

npm i -g vercel
vercel link
vercel env pull  # or add env vars in Vercel dashboard
vercel --prod

Environment Variables

Copy .env.example to .env.local and fill in your values. On Vercel, add these in the project settings under Environment Variables.

NEXT_PUBLIC_SUPABASE_URL
RequiredClient

Your Supabase project URL. Found in Project Settings > API.

NEXT_PUBLIC_SUPABASE_ANON_KEY
RequiredClient

Supabase anon/public key for client-side auth. Found in Project Settings > API.

SUPABASE_SERVICE_ROLE_KEY
RequiredServer

Supabase service role key for server-side admin operations. Never expose to the client.

STRIPE_SECRET_KEY
RequiredServer

Stripe API secret key (use test key for development). Found in Stripe Dashboard > Developers > API keys.

STRIPE_WEBHOOK_SECRET
RequiredServer

Signing secret for Stripe webhook endpoint verification. Generated when you create a webhook endpoint.

STRIPE_PRO_PRICE_ID
RequiredServer

Stripe Price ID for the Pro plan subscription. Create in Stripe > Products.

STRIPE_UNLIMITED_PRICE_ID
RequiredServer

Stripe Price ID for the Unlimited plan subscription.

NEXT_PUBLIC_STRIPE_PRO_PRICE_ID
RequiredClient

Same Pro price ID, exposed to client for upgrade buttons.

NEXT_PUBLIC_STRIPE_UNLIMITED_PRICE_ID
RequiredClient

Same Unlimited price ID, exposed to client for upgrade buttons.

NEXT_PUBLIC_APP_URL
RequiredClient

Your app's base URL (e.g., https://yourdomain.com). Used for redirects, invitation links, and Stripe callbacks.

RESEND_API_KEY
OptionalServer

Resend API key for transactional emails. If not set, emails are logged to console instead of sent.

EMAIL_FROM
OptionalServer

Sender address for emails. Defaults to "SiteBolt <noreply@yourdomain.com>".

EMAIL_REPLY_TO
OptionalServer

Reply-to address for emails. Defaults to "support@yourdomain.com".

Architecture

LayerTechnology
FrameworkNext.js 16 (App Router, Turbopack)
StylingTailwind CSS 4 + shadcn/ui
AuthSupabase Auth
DatabaseSupabase (PostgreSQL)
PaymentsStripe
EmailResend
DeploymentVercel
LanguageTypeScript

What's Included

Visual Site Builder

  • 6 visual style templates (Meridian, Obsidian, Terracotta, Aurora, Ironwork, Catalyst)
  • 6 industry presets (Storefront, Portfolio, SaaS, Restaurant, Agency, Blog)
  • 17+ composable sections
  • Live preview with desktop/mobile toggle
  • Undo/redo with keyboard shortcuts
  • One-click ZIP export

SaaS Infrastructure

  • Multi-tenant organizations
  • Role-based access (Owner/Admin/Member)
  • Email invitations with 7-day expiry
  • SHA-256 hashed API key management
  • Usage tracking with atomic increments
  • Admin panel with user/org management

Payments & Billing

  • Stripe subscriptions (Free/Pro/Unlimited)
  • Checkout + billing portal
  • Webhook lifecycle (created, updated, deleted)
  • Dunning flow (grace period, reminders, suspension)
  • Trial support with/without card
  • Cancel at period end + reactivation

Auth & Email

  • Email/password + Google OAuth
  • Email verification gate
  • Password reset flow
  • Session refresh via middleware
  • 9 transactional email templates (Resend)
  • Welcome, payment failed, usage warnings, trial ending

Database Schema

Run both SQL files in your Supabase SQL Editor in order. The schema includes tables, RLS policies, triggers, and indexes.

sb_users

User profiles (extends Supabase Auth). Auto-created on signup via trigger.

sb_organizations

Multi-tenant workspaces with plan, usage limits, Stripe customer, payment status.

sb_organization_members

Maps users to orgs with roles (owner/admin/member).

sb_invitations

Pending team invites with 7-day expiring tokens.

sb_api_keys

SHA-256 hashed API keys with last-used tracking.

usage_log

Per-action token usage for billing metering.

sb_email_logs

Sent email tracking with status and metadata.

sb_webhook_failures

Failed webhook processing for debugging.

sb_processed_events

Idempotency tracking for Stripe webhooks.

sb_admin_actions

Audit log for all admin operations.

Key Database Features

  • Auto-provisioning: New users automatically get a profile + personal org via the handle_new_user() trigger.
  • Row-Level Security: Every table has RLS policies. Users only see their own data. Org members only see their org.
  • Atomic usage tracking: increment_org_usage() prevents race conditions on concurrent credit deductions.
  • Webhook idempotency: processed_events table prevents duplicate Stripe event processing.

File Structure

PathDescription
src/app/Next.js App Router pages and API routes
src/app/auth/Login, signup, reset password, email verification, OAuth callback
src/app/api/stripe/Checkout, portal, webhooks, cancel, reactivate, trial
src/app/api/org/Members, invitations, API keys
src/app/api/admin/User management, org management, admin actions
src/app/builder/Visual site builder with live preview
src/app/dashboard/User dashboard with site management
src/app/settings/Org settings, team management, API keys
src/app/admin/Admin panel for user/org management
src/lib/templates.tsTemplate engine — 6 visual styles, 17+ section renderers, HTML generation
src/lib/presets.ts6 industry presets (Storefront, Portfolio, SaaS, Restaurant, Agency, Blog)
src/lib/stripe.tsStripe client (lazy-loaded), checkout/portal session helpers
src/lib/supabase.tsSupabase client factories (browser + server), plan limits
src/lib/email.tsEmail templates and Resend integration
src/lib/webhooks.tsWebhook idempotency and failure logging
src/middleware.tsSession refresh, email verification gate
supabase-schema.sqlCore database schema (users, orgs, members, API keys, RLS)
supabase-schema-v2.sqlExtended schema (payments, emails, webhooks, dunning)

Customization Guide

Change branding

Update the Logo component in src/components/logo.tsx. Change "SiteBolt" text in layout.tsx metadata and nav.tsx. Update email templates in src/lib/email.ts.

Modify pricing plans

Edit PLAN_LIMITS and PLAN_PRICES in src/lib/supabase.ts. Create matching Stripe products/prices and update the price ID env vars.

Add a new template style

Add a new generator function in src/lib/templates.ts following the pattern of existing templates (meridian, obsidian, etc). Register it in TEMPLATE_META and the generateHTML dispatcher.

Add a new section/block

Add the section renderer in the sharedSections() function in templates.ts. Register it in SECTION_META. Add a toggle and editor in builder/page.tsx.

Add a new industry preset

Add a new entry in src/lib/presets.ts with the full BuilderState configuration. Add a card for it on the landing page.

Change the color scheme

Edit CSS variables in src/app/globals.css. The :root block controls the light theme colors, glass-card effects, and gradient definitions.