How ramjit-soren/generative-ai-apps works
1. This repository is a catalog of many independent AI SaaS templates, not a single application. The root README.md is the product catalog, and each subfolder under ai_agents, image_generation, video_generation, beauty_fashion, ecommerce, home_real_estate, portrait_avatar, writing_content, and platforms is a standalone deployable product.
2. Most templates share the same SaaS spine: a Next.js App Router frontend in src/app, API routes in src/app/api, reusable UI in src/components, and server-side helpers in src/lib. That shared shape is the main architecture pattern across the repo.
3. The typical data boundary is browser → Next.js route handler → service layer → database / external AI provider. The UI pages drive actions like login, pricing, gallery, dashboard, and creation views; the API layer performs auth checks, billing checks, generation requests, and persistence.
4. Persistence is usually Prisma-backed. Each app has its own prisma/schema.prisma, a prisma.config.ts, and src/lib/prisma.js, which means the database model is local to each template rather than shared across the repo. The README confirms PostgreSQL is the standard backing store.
5. Authentication is centralized around NextAuth with a Google OAuth-style login flow. The auth entry point is usually src/app/api/auth/[...nextauth]/route.js, supported by src/lib/auth.js, and the UI exposes login and protected dashboard/gallery areas.
6. Billing is a first-class subsystem. Templates expose checkout endpoints and Stripe webhook handlers, with billing logic factored into src/lib/services/billing.js and Stripe client setup in src/lib/stripe.js. The usual flow is: user initiates checkout, Stripe confirms payment, webhook updates account state or credits in the database.
7. AI generation is usually isolated behind feature-specific route handlers and a service wrapper. Common patterns include /api/generation, /api/upload, /api/download, /api/creations, plus feature routes such as /api/headshot, /api/logo, /api/tryon, /api/fitness, /api/seedance, or /api/generate. These endpoints typically store a job record, call MuAPI or another model provider, and later return status or artifacts.
8. Many products use asynchronous job polling rather than synchronous generation. Evidence in the tree includes status endpoints like /api/headshot/status, /api/generate/status, /api/banana/status, /api/fitness/status, and /api/seedance/check-status. This suggests a job lifecycle of submit → persist job id → poll status → materialize result in gallery/creations.
9. The UI layer is mostly shared layout plus vertical-specific feature components. Common pieces include Navbar, Footer, Providers, and domain-specific widgets like templates, sliders, forms, editors, selectors, credit badges, and canvas-like views. This keeps the top-level app shell consistent while each niche product swaps in its own generation UX.
10. There are some higher-complexity platform projects that break the usual single-app pattern. platforms/Open-Generative-AI adds an Electron shell, local inference modules, and a separate packages/studio UI package; platforms/Open-AI-Design-Agent and platforms/Open-Poe-AI split into a Next.js client plus a Python server; platforms/Open-Generative-AI also includes model catalogs, workflow routes, and local model management. These are multi-runtime architectures rather than standard SaaS templates.
11. The main external service boundaries are Stripe for payments, MuAPI for model access and async generation, and Google OAuth through NextAuth. Some niche templates add their own provider-specific routes, but the repo-wide architecture is still built around those three integration points.
12. For an architecture diagram, the key takeaway is that this repo is a factory of self-contained SaaS products with a common reference architecture: Next.js frontend, API routes, Prisma/Postgres, auth, Stripe billing, and AI-job orchestration. The important variation is whether a template stays within that standard stack or adds an extra backend/runtime layer for local inference, desktop packaging, or specialized processing.
Main entry points: app App Router · README.md Catalog README · lib Service layer · api API routes
Components 26
Catalog
Repository-level index of template families
- Catalog README · Root README that explains the template factory and shared SaaS pattern
README.md
Shared stack
Common SaaS architecture reused by most templates
- App Router · Browser-facing pages and application shell, typically under src/app
ai_agents/ai-knowledge-base/src/app - API routes · Auth, billing, generation, upload, download, and webhook handlers
ai_agents/ai-knowledge-base/src/app/api - UI shell · Common navbar, footer, provider, and domain widgets
ai_agents/ai-knowledge-base/src/components - Service layer · Auth, billing, AI, user, and provider helper modules
ai_agents/ai-knowledge-base/src/lib - Prisma schema · Per-template database schema and Prisma config
ai_agents/ai-knowledge-base/prisma/schema.prisma - Auth · NextAuth entry and auth helper for OAuth-style login
ai_agents/ai-knowledge-base/src/lib/auth.js - Billing · Checkout and account-state logic for Stripe monetization
ai_agents/ai-knowledge-base/src/lib/services/billing.js - Stripe client · Stripe SDK setup used by checkout and webhook handlers
ai_agents/ai-knowledge-base/src/lib/stripe.js - AI service · Wrapper around MuAPI or other model providers for generation jobs
image_generation/ai-headshot-generator/src/lib/services/ai.js
Templates
Standalone product families
- AI agents · Standalone agent-oriented templates and adjacent apps
ai_agents - Image generation · Standalone image-focused SaaS templates
image_generation - Video generation · Standalone video-focused SaaS templates and pipelines
video_generation - Beauty/fashion · Standalone vertical SaaS templates for beauty and fashion workflows
beauty_fashion - Ecommerce · Standalone commerce-oriented product studios
ecommerce - Real estate · Standalone home and property workflow templates
home_real_estate - Portrait/avatar · Standalone portrait, avatar, and identity templates
portrait_avatar - Writing/content · Standalone writing and content-generation templates
writing_content
Platforms
Multi-runtime projects with extra backends or desktop layers
- Platforms · Higher-complexity products with extra runtimes or packaging layers
platforms - Python server · Supplementary backend runtime used by some platform projects
platforms/Open-AI-Design-Agent/server - Electron shell · Desktop packaging and local inference runtime for Open-Generative-AI
platforms/Open-Generative-AI/electron - Studio UI · Separate studio package used by multi-package platform projects
platforms/Open-Generative-AI/packages/studio
Integrations
External service boundaries
- Postgres · Standard persistence backend described by the repo README
- Google OAuth · External login boundary used through NextAuth
- Stripe · External billing and webhook provider
- MuAPI · External AI provider used for async generation and webhooks
Connections 40
- Catalog README → AI agents: indexes · Catalog lists this family
- Catalog README → Image generation: indexes · Catalog lists this family
- Catalog README → Video generation: indexes · Catalog lists this family
- Catalog README → Beauty/fashion: indexes · Catalog lists this family
- Catalog README → Ecommerce: indexes · Catalog lists this family
- Catalog README → Real estate: indexes · Catalog lists this family
- Catalog README → Portrait/avatar: indexes · Catalog lists this family
- Catalog README → Writing/content: indexes · Catalog lists this family
- Catalog README → Platforms: indexes · Catalog lists this family
- AI agents → App Router: contains · Typical template shape
- Image generation → App Router: contains · Typical template shape
- Video generation → App Router: contains · Typical template shape
- Beauty/fashion → App Router: contains · Typical template shape
- Ecommerce → App Router: contains · Typical template shape
- Real estate → App Router: contains · Typical template shape
- Portrait/avatar → App Router: contains · Typical template shape
- Writing/content → App Router: contains · Typical template shape
- Platforms → Python server: may add · Some platform projects split into a separate Python backend
- Platforms → Electron shell: may add · Open-Generative-AI adds a desktop runtime
- Platforms → Studio UI: may add · Open-Generative-AI uses a separate studio package
- App Router → API routes: routes through · Browser actions are handled through route handlers
- App Router → UI shell: renders with · Pages share a common app shell and reusable widgets
- API routes → Auth: uses · Authentication endpoints and guards
- API routes → Billing: uses · Checkout and webhook handling
- API routes → AI service: uses · Generation and async job orchestration
- Service layer → Auth: contains · Auth helper lives in the service boundary
- Service layer → Billing: contains · Billing helper lives in the service boundary
- Service layer → AI service: contains · AI helper lives in the service boundary
- Service layer → Stripe client: contains · Stripe client setup lives in the service boundary
- Service layer → Prisma schema: persists via · Local Prisma schema defines the backing store
- Auth → Google OAuth: delegates to · NextAuth wraps the external login flow
- Billing → Stripe: delegates to · Billing depends on Stripe checkout and webhooks
- Stripe client → Stripe: connects to · Stripe SDK boundary
- AI service → MuAPI: delegates to · Primary model provider boundary
- Prisma schema → Postgres: targets · Standard persistence backend
- API routes → Prisma schema: writes · Handlers store jobs, credits, and artifacts locally
- UI shell → App Router: supports · Shared UI components feed the pages
- Python server → MuAPI: calls · Design-agent sidecar uses MuAPI helpers
- Electron shell → Studio UI: hosts · Desktop app embeds the studio UI package
- Electron shell → MuAPI: calls · Local inference and cloud provider boundary