What you'll build
A complete SaaS with everything you need to launch: authentication, subscription payments, and an AI feature.
Users register with Google, pay a monthly subscription with Stripe, and access AI functionalities (chat, analysis, or content generation). PostgreSQL database, Redis cache, and deploy-ready with Docker.
When finished, you'll have the complete architecture of a modern SaaS. From login to monthly billing, with an AI functionality that differentiates your product. It's the project that integrates everything you learned in the previous levels.
The prompt to start
Design the architecture of a SaaS with:
- Auth with Google (Firebase)
- Payments with Stripe (subscriptions)
- AI feature (choose: chat, analysis, generation)
- PostgreSQL database
- Docker deploy
Suggested architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FRONTEND โ
โ (Next.js 15) โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โ
โ โ Auth โ โ Billing โ โ AI โ โ
โ โ Page โ โ Page โ โ Chat โ โ
โ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โ
โโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ API โ
โ (Next.js API) โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โ
โ โFirebase โ โ Stripe โ โ Gemini โ โ
โ โ Auth โ โWebhooks โ โ API โ โ
โ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โ
โโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ STORAGE โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ PostgreSQL โ โ Redis โ โ
โ โ (users, โ โ (cache, โ โ
โ โ chats) โ โ sessions) โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key components
1. Auth
// Use what you learned in auth-firebase
import { signInWithGoogle } from './firebase'
2. Payments
// Use what you learned in payment-stripe
import { createCheckoutSession } from './stripe'
3. AI
// Use what you learned in chatbot-gemini
import { generateResponse } from './gemini'
4. Database
// Use what you learned in crud-postgres
import { prisma } from './db'
Data model
model User {
id String @id @default(cuid())
email String @unique
plan Plan @default(FREE)
stripeId String?
chats Chat[]
tokensUsed Int @default(0)
createdAt DateTime @default(now())
}
model Chat {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id])
messages Message[]
createdAt DateTime @default(now())
}
model Message {
id String @id @default(cuid())
chatId String
chat Chat @relation(fields: [chatId], references: [id])
role String // user | assistant
content String
createdAt DateTime @default(now())
}
enum Plan {
FREE
PRO
ENTERPRISE
}
Limits by plan
| Feature | Free | Pro | Enterprise |
|---|---|---|---|
| Messages/month | 100 | 10,000 | Unlimited |
| Models | Gemini Flash | Gemini Pro | All |
| History | 7 days | 1 year | Unlimited |
| Support | Community | Dedicated |
Docker Compose
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgresql://...
- GEMINI_API_KEY=...
- STRIPE_SECRET_KEY=...
depends_on:
- db
- redis
db:
image: postgres:16
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:7-alpine
volumes:
pgdata:
Congratulations
You've completed all levels of luxIA Cooking.
You now have the skills to build real products with AI.
โ Back to start