Building Your First AI SaaS with SoloSaaS
Getting a SaaS product off the ground usually means weeks of wiring up auth, payments, and infrastructure before writing a single line of business logic. SoloSaaS cuts that down to an afternoon.
What You Get Out of the Box
The template ships with everything you need for a production-ready AI SaaS:
- Authentication — GitHub, Google, WeChat QR login, and email/password via Better Auth
- Payments — Stripe and Creem integration with subscriptions and credit packs
- AI Models — Multi-model support through Vercel AI SDK (OpenAI, Anthropic, Google, and more)
- Credit System — FIFO batch-based credits with expiry management
Quick Start
Clone the repo and install dependencies:
git clone https://github.com/solosass/template.git my-saas
cd my-saas
pnpm installSet up your environment variables:
cp .env.example .env.localThen fill in your API keys and database URL. Start the dev server:
pnpm devAdding Your First AI Feature
The AI system is already wired up. Here's how to customize the chat endpoint:
import { streamText } from "ai";
import { getProvider } from "@/lib/ai/providers";
export async function POST(req: Request) {
const { messages, model } = await req.json();
const result = streamText({
model: getProvider(model),
messages,
system: "You are a helpful assistant for my product.",
});
return result.toDataStreamResponse();
}The credit system automatically deducts credits per message based on the model used.
Deploying to Production
One-click deploy to Vercel is the fastest path:
- Push your code to GitHub
- Import the repo in Vercel
- Set your environment variables
- Hit deploy
Your SaaS is live. The template handles SSR, static generation, and edge middleware automatically.
What's Next
From here you can customize the landing page, add new AI features, or integrate additional payment providers. The codebase is designed to be readable and extensible — no magic, just straightforward Next.js patterns.
Tip: Check out the
/pricingpage configuration insite.config.tsto set up your own pricing plans.