princepal9120/ai-stack

This is starter repo for ai applications , from mvp to production grade.

★ 1Forks 0GitHub ↗Compare

README

AI Stack

The Production-Ready AI Application Framework

Build AI-powered applications with zero vendor lock-in.

npm version License: MIT TypeScript Next.js

Get Started · Documentation · Stack Builder · GitHub


Why AI Stack?

Building production AI applications requires more than just connecting to an LLM. You need authentication, vector databases, RAG pipelines, and infrastructure that scales. AI Stack gives you all of this out of the box.

Challenge AI Stack Solution
Vendor Lock-in Swap LLMs or Vector DBs with one environment variable
Production Readiness Built-in auth, error handling, observability, and cost tracking
Type Safety Full TypeScript + Pydantic across the entire stack
Infrastructure Docker Compose dev, Kubernetes prod - ready to deploy

Quick Start

npx create-ai-stack-starter@latest my-ai-app

You'll be prompted to select:

  • Architecture: Next.js Fullstack, FastAPI + Next.js, or TypeScript Backend
  • Database: Neon, Supabase, Turso, or SQLite
  • Auth: Better Auth, NextAuth, Clerk, or None
  • LLM Provider: OpenAI, Anthropic, or Novita AI
  • Add-ons: Tailwind, Biome, PWA, Analytics

Architecture Options

🌐 Next.js Fullstack

Best for: Rapid prototyping, Vercel deployment

  • Vercel AI SDK
  • Drizzle ORM
  • Better Auth
  • Server Actions

🐍 FastAPI + Next.js

Best for: ML teams, complex AI pipelines

  • Async Python backend
  • SQLAlchemy 2.0
  • Celery for background jobs
  • Alembic migrations

📦 TypeScript Backend

Best for: TypeScript teams, edge deployment

  • Hono / NestJS / Fastify
  • Drizzle or Prisma
  • Edge-ready
  • tRPC ready

Core Features

🔓 Zero Vendor Lock-in

Abstract interfaces for every integration. Switch providers with one env variable:

# Switch LLM provider
LLM_PROVIDER=openai      # or: anthropic, gemini, ollama

# Switch Vector DB
VECTOR_DB=qdrant         # or: weaviate, pgvector, pinecone

⚡ Production RAG Pipeline

Complete document ingestion, chunking, embedding, and retrieval:

// Ingest documents
await rag.ingest(documents, { chunkSize: 512, overlap: 50 });

// Query with context
const response = await rag.query("What is the refund policy?", {
  topK: 5,
  rerank: true,
});

🔐 Enterprise Authentication

Multiple auth strategies with unified interface:

  • Better Auth - Modern, type-safe, self-hosted
  • NextAuth.js - Flexible OAuth, social logins
  • Clerk - Managed auth with great DX
  • JWT - Service-to-service authentication

📊 Built-in Observability

Track everything that matters in production:

  • Token usage and cost tracking
  • Request latency monitoring
  • Error aggregation
  • LLM response quality metrics

Use Cases

💬 AI Customer Support

Build intelligent chatbots that understand your product docs and provide accurate answers with citations.

📚 Document Q&A

Create internal knowledge bases that let employees query company documents naturally.

🔍 Semantic Search

Replace keyword search with AI-powered semantic search across your content.

🤖 AI Assistants

Build domain-specific AI assistants with memory and tool use.


Tech Stack

Layer Technology
Frontend Next.js 15, React 19, Tailwind CSS
Backend FastAPI / Hono / NestJS
Database PostgreSQL (Neon/Supabase), SQLite (Turso)
Vector DB Qdrant, Weaviate, pgvector
ORM Drizzle / Prisma / SQLAlchemy
Auth Better Auth, NextAuth, Clerk
AI OpenAI, Anthropic, Google Gemini, Ollama
Infrastructure Docker, Kubernetes, Vercel

Documentation

Section Description
Quick Start Get running in 5 minutes
Architecture System design and patterns
LLM Providers Configure AI providers
Vector Databases Vector storage options
RAG Pipeline Document ingestion and retrieval
Deployment Production deployment guides
Security Security best practices

Project Structure

my-ai-app/
├── app/                    # Next.js App Router
│   ├── (auth)/            # Auth pages
│   ├── (dashboard)/       # Protected pages
│   └── api/               # API routes
├── components/            # React components
│   ├── chat/              # Chat UI components
│   └── ui/                # shadcn/ui components
├── lib/
│   ├── ai/                # LLM client abstraction
│   ├── auth/              # Auth configuration
│   ├── db/                # Database schema & client
│   └── search/            # Vector search client
└── types/                 # TypeScript types

Security

AI Stack is built with security as a first-class concern:

  • ✅ Authentication - Multiple battle-tested auth providers
  • ✅ Authorization - Role-based access control ready
  • ✅ Data Encryption - TLS in transit, encryption at rest
  • ✅ API Security - Rate limiting, CORS, input validation
  • ✅ Secrets Management - Environment-based configuration
  • ✅ Audit Logging - Track all sensitive operations

Read our Security Documentation for details.


Contributing

We welcome contributions! See our Contributing Guide for details.

# Clone the repo
git clone https://github.com/princepal9120/ai-stack.git

# Install dependencies
pnpm install

# Run development
pnpm dev

License

MIT © AI Stack Team


Built with ❤️ for the AI developer community

Website · Documentation · GitHub · Twitter

Contributors

princepal9120

Issues