Skip to content

MichaelTheMay/configurable-SaaS-starter-webpage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SaaS Website Template

Live Demo GitHub

A production-ready SaaS company website template with integrated authentication, Stripe payments, and lead generation. Built with Hono framework for Cloudflare Pages.

🌐 Live Demo

See it in action: https://configurable-saas-template.pages.dev

The demo showcases all features with placeholder content. You can explore:

  • 🏠 Homepage - Hero, features, pricing, testimonials
  • πŸ“„ Custom Pages - About, Blog, Contact pages
  • 🎨 Default Theme - Modern purple gradient theme
  • πŸ” Auth Pages - Login and signup interfaces

Note: The demo uses placeholder data. Replace {{PLACEHOLDERS}} in config.ts with your actual content.

Demo Pages Available

  • Home (/) - Full landing page with all sections
  • About (/about) - About page with team section
  • Blog (/blog) - Blog placeholder page
  • Contact (/contact) - Contact form page
  • Privacy (/privacy) - Privacy policy page
  • Terms (/terms) - Terms of service page
  • Login (/login) - User login page
  • Signup (/signup) - User registration page

🎯 Features

βœ… Currently Implemented

  • Landing Page: Hero section, features, pricing, testimonials, CTA, footer
  • Authentication: Email/password signup and login pages (OAuth ready)
  • Stripe Integration: Subscription checkout flow with multiple pricing tiers
  • Lead Generation: Contact form with email notifications via Resend
  • Database Schema: D1 SQLite tables for users, subscriptions, leads, sessions
  • Responsive Design: Mobile-first design with Tailwind CSS
  • API Routes: RESTful API endpoints for all features
  • Configuration System: Single config.ts file for all customization
  • 🎨 Advanced Theme System:
    • 6 button variants (solid, outline, ghost, gradient, small, large)
    • 5 card styles (default, flat, elevated, outlined, gradient)
    • Complete typography control (9 font sizes, weights, line heights, letter spacing)
    • Comprehensive color system (primary/secondary with light/dark variants)
    • Full spacing scale (40+ spacing values)
    • Component-specific styling (navbar, footer, forms, hero, features, pricing, testimonials)
    • Animation controls (enable/disable, durations, easing)
  • πŸ“„ Dynamic Page Routing: Automatic page generation from config
  • 🎯 Component Library: Themed buttons, cards, and navigation

πŸ“‹ Configuration-Driven Design

All content AND design is managed through a single config.ts file:

Content Configuration:

  • Company information and branding
  • Hero section content
  • Features list
  • Pricing plans (linked to Stripe)
  • Testimonials
  • Social media links
  • Authentication providers
  • Lead form fields
  • SEO metadata

🎨 NEW: UI Theme Configuration:

  • Colors: Primary, secondary, success, error, backgrounds
  • Typography: Font families (Google Fonts), sizes
  • Layout: Max width, header height, nav position
  • Borders: Border radius for all components
  • Shadows: Box shadows for depth
  • Buttons: Complete button style system
  • Cards: Card styling and hover effects

πŸ“„ NEW: Custom Pages:

  • Define unlimited custom pages in config
  • Automatic routing (e.g., /about, /privacy, /terms)
  • Flexible content sections (text, team, forms)
  • Choose which pages appear in menu
  • Shared navigation and footer

πŸ”Œ Integrations

  1. Stripe - Payment processing and subscriptions
  2. Resend - Transactional emails and notifications
  3. Cloudflare D1 - SQLite database for data persistence
  4. Google OAuth - Social authentication (ready to configure)
  5. GitHub OAuth - Social authentication (ready to configure)

πŸš€ Quick Start

1. Configure Your Site

Edit config.ts and replace all placeholders:

export const siteConfig = {
  company: {
    name: "Your Company Name",
    tagline: "Your Tagline",
    email: "hello@yourcompany.com",
    // ... etc
  },
  // ... update all sections
}

2. Setup Environment Variables

Copy the template and add your API keys:

cp .dev.vars.example .dev.vars
# Edit .dev.vars with your actual keys

Required keys:

3. Setup Database

# Create D1 database
npm run db:create

# Update wrangler.jsonc with the database_id from output

# Run migrations
npm run db:migrate:local

4. Setup Stripe Products

  1. Go to https://dashboard.stripe.com/products
  2. Create 3 products matching your pricing tiers
  3. Copy the Price IDs to config.ts under pricing.plans[].stripePriceId

5. Build and Run

# Build the project
npm run build

# Start development server with PM2
pm2 start ecosystem.config.cjs

# Test the application
npm test

# Check logs
pm2 logs webapp --nostream

πŸ“ Project Structure

webapp/
β”œβ”€β”€ config.ts              # Single configuration file (MAIN CUSTOMIZATION)
β”œβ”€β”€ src/
β”‚   └── index.tsx         # Hono backend with all routes
β”œβ”€β”€ public/static/
β”‚   β”œβ”€β”€ app.js            # Frontend JavaScript (lead form, Stripe)
β”‚   └── auth.js           # Authentication JavaScript
β”œβ”€β”€ migrations/
β”‚   └── 0001_initial_schema.sql  # Database schema
β”œβ”€β”€ wrangler.jsonc        # Cloudflare configuration
β”œβ”€β”€ .dev.vars.example     # Environment variables template
β”œβ”€β”€ ecosystem.config.cjs  # PM2 configuration
└── package.json          # Dependencies and scripts

🎨 Customization Guide

Update Company Branding

// config.ts
company: {
  name: "CloudFlow",
  logo: "/static/logo.png",  // Add your logo to public/static/
  // ...
}

Modify Pricing Plans

// config.ts
pricing: {
  plans: [
    {
      name: "Starter",
      price: "$29",
      period: "month",
      stripePriceId: "price_xxxxx",  // From Stripe Dashboard
      features: [
        "10 Projects",
        "Basic Support"
      ]
    }
    // ... add more plans
  ]
}

Add/Remove Features

// config.ts
features: [
  {
    icon: "fas fa-rocket",  // FontAwesome icon
    title: "Fast Performance",
    description: "Lightning-fast edge deployment"
  }
  // ... add/remove as needed
]

Customize Lead Form

// config.ts
leadForm: {
  fields: [
    {
      name: "custom_field",
      label: "Custom Field",
      type: "text",
      required: true,
      placeholder: "Enter value"
    }
    // ... add/remove fields
  ]
}

🎨 NEW: Customize UI Theme

// config.ts
theme: {
  colors: {
    primary: "#667eea",        // Your brand color
    primaryDark: "#764ba2",    // Darker shade
    secondary: "#4c9aff",      // Accent color
    // ... more colors
  },
  fonts: {
    primary: "'Poppins', sans-serif",  // Main font
    heading: "'Montserrat', sans-serif", // Heading font
  },
  borderRadius: {
    lg: "1rem",    // Rounded corners
  },
  buttons: {
    primary: {
      background: "primary",
      borderRadius: "lg",
      padding: "0.75rem 2rem",
    }
  }
}

πŸ“„ NEW: Add Custom Pages

// config.ts
pages: [
  {
    path: "/about",
    title: "About Us",
    inMenu: true,  // Show in navigation
    content: {
      hero: {
        title: "About Our Company",
        subtitle: "Our story and mission"
      },
      sections: [
        {
          type: "text",
          title: "Who We Are",
          content: "Your company story here..."
        },
        {
          type: "team",
          title: "Meet Our Team",
          members: [
            {
              name: "John Doe",
              role: "CEO",
              bio: "Leader with 10 years experience",
              image: "/static/team/john.jpg",
              social: {
                linkedin: "https://linkedin.com/in/johndoe",
                twitter: "https://twitter.com/johndoe"
              }
            }
          ]
        }
      ]
    }
  }
  // Add unlimited pages!
]

πŸ” Authentication Setup

Email/Password (Already Working)

  • Signup and login forms are ready
  • TODO: Implement password hashing (bcrypt)
  • TODO: Implement JWT token generation
  • TODO: Add email verification flow

Google OAuth

  1. Go to https://console.cloud.google.com/apis/credentials
  2. Create OAuth 2.0 Client ID
  3. Add authorized redirect URI: https://your-domain.com/api/auth/google/callback
  4. Update config.ts:
auth: {
  providers: {
    google: {
      enabled: true,
      clientId: "your-client-id"
    }
  }
}
  1. Add GOOGLE_CLIENT_SECRET to .dev.vars

GitHub OAuth

  1. Go to https://github.com/settings/developers
  2. Create OAuth App
  3. Set callback URL: https://your-domain.com/api/auth/github/callback
  4. Update config.ts:
auth: {
  providers: {
    github: {
      enabled: true,
      clientId: "your-client-id"
    }
  }
}
  1. Add GITHUB_CLIENT_SECRET to .dev.vars

πŸ’³ Stripe Integration

Setup Stripe Checkout

  1. Products are configured in config.ts
  2. When user clicks "Get Started", it calls /api/stripe/create-checkout-session
  3. User is redirected to Stripe Checkout
  4. After payment, they're redirected to /success

Webhook Handler

Setup webhook endpoint in Stripe Dashboard:

  • URL: https://your-domain.com/api/stripe/webhook
  • Events: customer.subscription.created, customer.subscription.updated, customer.subscription.deleted

πŸ“§ Email Notifications

Lead form submissions automatically send emails via Resend:

// config.ts
integrations: {
  email: {
    provider: "resend",
    fromEmail: "noreply@yourdomain.com",
    notificationEmail: "leads@yourdomain.com"
  }
}

πŸš€ Deployment

Deploy to Cloudflare Pages

# First deployment
npm run deploy:prod

# This will:
# 1. Build the project
# 2. Deploy to Cloudflare Pages
# 3. Give you a URL: https://webapp.pages.dev

Setup Production Secrets

# Add secrets one by one
wrangler secret put STRIPE_SECRET_KEY --project-name webapp
wrangler secret put RESEND_API_KEY --project-name webapp
wrangler secret put JWT_SECRET --project-name webapp

Run Production Migrations

npm run db:migrate:prod

πŸ“Š Database Schema

Users Table

  • Authentication and user management
  • Supports email, Google, and GitHub providers

Subscriptions Table

  • Linked to Stripe subscriptions
  • Tracks subscription status and billing periods

Leads Table

  • Stores contact form submissions
  • Status tracking: new β†’ contacted β†’ qualified β†’ converted

Sessions Table

  • JWT session management
  • Automatic expiration

πŸ”§ Development

Available Scripts

npm run dev              # Vite dev server
npm run build            # Build for production
npm run dev:sandbox      # Wrangler dev server (sandbox)
npm run dev:d1           # Wrangler with D1 database
npm test                 # Test local server
npm run clean-port       # Kill process on port 3000
npm run db:migrate:local # Apply migrations locally
npm run db:migrate:prod  # Apply migrations to production

Database Commands

# Query local database
npm run db:console:local -- --command="SELECT * FROM users"

# Query production database
npm run db:console:prod -- --command="SELECT * FROM leads WHERE status='new'"

🎨 Comprehensive Styling System

This template features the most configurable styling system available - every visual aspect is controlled through config.ts.

πŸ“– Complete Documentation

For the full styling guide with examples, see:

Quick Overview

Button Variants (6 styles)

<button class="btn-primary">Primary</button>
<button class="btn-secondary">Secondary</button>
<button class="btn-ghost">Ghost</button>
<button class="btn-gradient">Gradient</button>
<button class="btn-small">Small</button>
<button class="btn-large">Large</button>

Card Variants (5 styles)

<div class="card-default">Default Card</div>
<div class="card-flat">Flat Card</div>
<div class="card-elevated">Elevated Card</div>
<div class="card-outlined">Outlined Card</div>
<div class="card-gradient">Gradient Card</div>

Component Configuration

Every component has individual styling controls:

components: {
  navbar: { /* height, colors, spacing */ },
  footer: { /* layout, colors, gaps */ },
  forms: { /* inputs, labels, validation */ },
  hero: { /* background, sizes, alignment */ },
  features: { /* icons, grid, gaps */ },
  pricing: { /* highlighting, badges */ },
  testimonials: { /* avatars, ratings */ },
}

Animation Controls

animations: {
  enabled: true,  // Master toggle
  duration: { fast: "150ms", normal: "300ms", slow: "500ms" },
  hoverScale: "1.05",
  hoverTranslateY: "-5px",
}

Quick Theme Change

Change your entire website theme in seconds:

// Modern Blue Theme
theme: {
  colors: {
    primary: "#3b82f6",
    primaryDark: "#2563eb",
    // ...
  }
}

// Or Vibrant Startup Theme
theme: {
  colors: {
    primary: "#ec4899",  // Pink
    primaryDark: "#db2777",
    secondary: "#8b5cf6",  // Purple
    // ...
  }
}

// Or Minimalist Dark Theme
theme: {
  colors: {
    primary: "#22c55e",
    background: "#0f172a",
    surface: "#1e293b",
    text: { primary: "#f1f5f9" }
  }
}

See STYLING_GUIDE.md for complete examples and configuration options!

πŸ“„ Dynamic Page System

Create unlimited custom pages without writing code!

Supported Page Types

  1. Text Sections - Rich content with headings
  2. Team Sections - Team member profiles with photos
  3. Blog List - Coming soon placeholder
  4. Contact Forms - Uses lead form configuration

Page Configuration

Each page needs:

  • path - URL route (e.g., "/about")
  • title - Page title
  • inMenu - Show in navigation (true/false)
  • content - Page content definition

Example Pages

About Page with Team:

{
  path: "/about",
  title: "About Us",
  inMenu: true,
  content: {
    hero: { title: "About", subtitle: "Our Story" },
    sections: [
      { type: "text", title: "Mission", content: "..." },
      { type: "team", title: "Team", members: [...] }
    ]
  }
}

Legal Pages (Privacy/Terms):

{
  path: "/privacy",
  title: "Privacy Policy",
  inMenu: false,  // Not in main nav
  content: {
    hero: { title: "Privacy", subtitle: "Updated: 2024" },
    sections: [
      { type: "text", title: "Data Collection", content: "..." },
      { type: "text", title: "Data Usage", content: "..." }
    ]
  }
}

All pages automatically include:

  • Themed navigation bar
  • Consistent footer
  • Responsive layout
  • SEO metadata

🎯 Next Steps

Priority 1: Complete Authentication

  • Implement bcrypt password hashing
  • Generate and verify JWT tokens
  • Add email verification flow
  • Implement password reset
  • Complete OAuth flows (Google, GitHub)

Priority 2: Build Dashboard

  • Create /dashboard route
  • User profile management
  • Subscription management UI
  • Billing history

Priority 3: Admin Panel

  • Lead management interface
  • User management
  • Analytics dashboard

Priority 4: Email Templates

  • Welcome email
  • Email verification
  • Password reset
  • Subscription confirmation
  • Lead notification formatting

Priority 5: Testing

  • Add unit tests
  • Integration tests for API routes
  • E2E tests for critical flows

πŸ“ Configuration Reference

See config.ts for the complete configuration schema. Every piece of content on the website can be customized through this file.

Placeholder Pattern

All placeholders follow the pattern: {{PLACEHOLDER_NAME}}

Example:

company: {
  name: "{{COMPANY_NAME}}"  // Replace with: "Your Company"
}

Example Configuration

The exampleConfig export in config.ts shows a fully populated example for reference.

πŸ†˜ Troubleshooting

Port Already in Use

npm run clean-port

Stripe Not Working

  • Verify STRIPE_SECRET_KEY is set in .dev.vars
  • Check stripePriceId values in config.ts match Stripe Dashboard
  • Ensure Stripe publishable key is set in config.ts

Database Errors

# Reset local database
rm -rf .wrangler/state/v3/d1
npm run db:migrate:local

Build Errors

# Clean and rebuild
rm -rf dist .wrangler
npm run build

πŸš€ Deployment Info

Live Production Demo: This template is already deployed and running at:

Deployment Steps Used:

# 1. Build the project
npm run build

# 2. Deploy to Cloudflare Pages
npx wrangler pages deploy dist --project-name configurable-saas-template

# Result: Live in seconds! ✨

Want to deploy your own? See the complete deployment guide above!

πŸ“„ License

MIT License - Feel free to use this template for your SaaS projects.

🀝 Support

For issues or questions, please check the documentation in config.ts or consult the Cloudflare Workers/Hono documentation.

πŸ”— Links


Last Updated: 2025-10-27 Status: βœ… Production-ready with live demo Tech Stack: Hono + TypeScript + Cloudflare Pages + D1 + Stripe + Resend Demo: https://configurable-saas-template.pages.dev

About

This is a full-stack, deployment ready hyper-configurable saas starter webpage that comes with a single config file wherein you speicfy your own

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors