Skip to content

TencentEdgeOne/saas-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SaaS AI Template

A modern, production-ready SaaS AI template built with Next.js 14, TypeScript, and Tailwind CSS. SaaS Starter TypeScript Tailwind CSS

✨ Features

🎨 Beautiful Design System

  • Clean, modern UI
  • Fully responsive design
  • Dark/Light mode support
  • Customizable color schemes

πŸ”§ Essential SaaS Components

  • Authentication: Login, register, password reset
  • Third-party Login: Google, GitHub OAuth integration
  • Credits System: Complete credit management with earning, spending, and history
  • AI Image Generation: Multi-model AI image generation capabilities
  • Admin Management System: User management, billing management with environment variable admin configuration
  • Blog System: Markdown-based blog with frontmatter
  • Case Studies: Showcase your success stories
  • Payment Integration: Stripe-ready payment system

πŸ›  Developer Experience

  • TypeScript: Full type safety
  • Next.js 14: Latest App Router with SSG support
  • Tailwind CSS: Utility-first CSS framework
  • Component Library: Reusable UI components
  • ESLint & Prettier: Code formatting and linting
  • Responsive Design: Mobile-first approach

πŸš€ Core Features Overview

πŸ’³ Credits System

Complete credit management system supporting user credit earning, spending, and history tracking:

Features:

  • New user signup bonus: 50 credits
  • Purchase plan rewards: Different credits based on plan tier
  • Credit spending: AI image generation and other features consume credits
  • Credit history: Complete record of credit earning and spending
  • Balance inquiry: Real-time current credit balance

πŸ” Third-party Authentication

Support for mainstream OAuth providers for quick login:

Supported Providers:

  • Google OAuth 2.0
  • GitHub OAuth

Features:

  • One-click login/registration
  • Automatic account linking
  • Secure callback handling
  • New user signup credit rewards

Configuration Required:

# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key

# App Configuration
NEXT_PUBLIC_APP_URL=your-app-url

🎨 AI Image Generation

Multi-model AI image generation capabilities:

Supported Models:

  • OpenAI DALL-E 3
  • Stability AI (Stable Diffusion)
  • Other compatible models

Features:

  • Multiple image sizes: 256x256, 512x512, 768x768, 1024x1024, 1024x1792, 1792x1024
  • Credit billing system
  • Real-time balance checking
  • Image preview and download
  • Multi-language prompt support
  • Error handling and retry mechanism

Usage Flow:

  1. User inputs prompt
  2. Select model and size
  3. System checks credit balance
  4. Call AI model to generate image
  5. Deduct corresponding credits
  6. Return generated image

Environment Variables:

# OpenAI
OPENAI_API_KEY=your-openai-api-key

# Stability AI
STABILITY_API_KEY=your-stability-api-key

# Other AI Providers
# Add corresponding API keys as needed

πŸ›‘οΈ Admin Management System

Complete admin management system supporting comprehensive platform administration:

Core Features:

  • User Management: View user list, user details, credit management
  • Billing Management: View order list, order details, revenue statistics
  • Multi-language Support: Chinese and English interface switching
  • Responsive Design: Desktop and mobile device compatibility

Admin Configuration:

Configure admin emails through environment variables, supporting multiple administrators:

# Admin email configuration (multiple emails separated by commas)
ADMIN_EMAILS=admin1@example.com,admin2@example.com,admin3@example.com

Features:

  • Environment variable-driven admin permission control
  • Secure authentication and authorization mechanisms
  • Real-time data statistics and visualization
  • Complete user lifecycle management
  • Order and payment record tracking

Access:

Administrators can access the admin management system through the /admin path. The system automatically verifies if the email is configured in the ADMIN_EMAILS environment variable.

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

  1. Clone the repository
git clone https://github.com/your-username/saas-starter-template.git
cd saas-starter-template
  1. Install dependencies
npm install
# or
yarn install
  1. Start development server
edgeone pages dev
  1. Open your browser Visit http://localhost:8088 to see your app.

πŸ“ Project Structure

saas-starter-template/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                 # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ admin/          # Admin management system pages
β”‚   β”‚   β”œβ”€β”€ ai/             # AI image generation pages
β”‚   β”‚   β”œβ”€β”€ blog/           # Blog pages
β”‚   β”‚   β”œβ”€β”€ cases/          # Case studies
β”‚   β”‚   β”œβ”€β”€ globals.css     # Global styles
β”‚   β”‚   β”œβ”€β”€ layout.tsx      # Root layout
β”‚   β”‚   └── page.tsx        # Homepage
β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”‚   β”œβ”€β”€ ui/            # Basic UI components
β”‚   β”‚   β”œβ”€β”€ layout/        # Layout components
β”‚   β”‚   └── sections/      # Page sections
β”‚   └── lib/               # Utility functions
β”œβ”€β”€ content/               # Markdown content
β”‚   β”œβ”€β”€ blog/             # Blog posts
β”‚   └── cases/            # Case studies
β”œβ”€β”€ public/               # Static assets
β”œβ”€β”€ package.json
β”œβ”€β”€ tailwind.config.js
β”œβ”€β”€ tsconfig.json
└── next.config.js

🎨 Customization

Colors and Theming

The template uses CSS custom properties for theming. You can customize colors in src/app/globals.css:

:root {
  --primary: 142 76% 36%; /* Green primary color */
  --primary-foreground: 355 7% 97%;
  --secondary: 240 4.8% 95.9%;
  /* ... more variables */
}

Components

All components are built with TypeScript and Tailwind CSS. They're located in src/components/:

  • ui/ - Basic UI components (Button, Card, Badge, etc.)
  • layout/ - Layout components (Header, Footer)
  • sections/ - Page sections (Hero, Features, Pricing, etc.)

AI Assistance

You can modify the code through dialogue in Cursor.

Here are some example Prompts:

  • Change the theme color: Change the project's primary color to pink
  • Add language support: Add French support to the project
  • Modify the page: Modify the homepage, removing the xx module

Local Content Management

Blog Posts

Create new blog posts in content/blog/ with frontmatter:

---
title: "Your Blog Post Title"
date: "2024-01-15"
excerpt: "A brief description of your post"
author: "Your Name"
tags: ["SaaS", "Next.js", "Tutorial"]
readTime: "5 min read"
---

# Your Blog Post Content

Write your content here in Markdown...

Case Studies

Create new case studies in content/cases/

Contentful Integration

Quick Setup

  1. Import data structure to your Contentful space:

    # Install Contentful CLI
    npm install -g contentful-cli
    
    # Login to Contentful
    contentful login
    
    # Import provided data models
    contentful space import --config cms/contentful/contentful-models-config.json
  2. Configure environment variables:

    # In your .env file
    CONTENTFUL_SPACE_ID=your_space_id
    CONTENTFUL_ACCESS_TOKEN=your_access_token
    CONTENTFUL_ENVIRONMENT=master
    NEXT_PUBLIC_SUPABASE_URL=your-supabse-url
    NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
    SUPABASE_SERVICE_ROLE_KEY=your-supabase-anon-service-role-key
    
    STRIPE_WEBHOOK_SECRET=your-stripe-webhooksecret
    STRIPE_SECRET_KEY=your-stripe-secret-key
    STRIPE_CALLBACK_URL=site-url
    
    NEXT_PUBLIC_APP_URL=site-url
  3. Export content to local markdown:

    npm run contentful:export

What's included:

  • Data Models: Pre-configured Blog and Case content types
  • Multi-language: Support for English (en-US) and Chinese (zh-CN)
  • Rich Content: RichText conversion to Markdown
  • Asset Management: Automatic image download and localization
  • Language Mapping: en β†’ en-US, zh β†’ zh-CN

Output structure:

content/
β”œβ”€β”€ en/blog/*.md        # English blog posts
└── zh/blog/*.md        # Chinese blog posts
public/images/contentful/  # Downloaded images

For detailed setup and configuration, see cms/contentful/README.md.

Internationalization

Our project supports multiple languages, you can find all the translation files in the dictionaries/ directory. For detailed internationalization setup and configuration, please see dictionaries/README.md.

Data Analytics

The project has built-in support for Google Analytics data analytics.

  1. Sign up for Google Analytics to get the tracking code
  2. Set the tracking code in the environment variables
NEXT_PUBLIC_GA_ID=G-xxxxx

🎯 SEO Features

  • Meta tags optimization
  • OpenGraph and Twitter Card support
  • Structured data for better search results
  • Sitemap generation ready
  • Fast loading times
  • Mobile-first responsive design

robot.txt and sitemap.xml

The project provides scripts to automatically generate robot.txt and sitemap.xml. You only need to modify the SITE_URL in the gen:seo command in package.json to your own site address, then run: npm run gen:seo to generate them.

πŸš€ Deploy

Deploy with EdgeOne Pages

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments


Happy building! πŸš€

About

A Saas Website Starter built with Next.js, Tailwind CSS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •