Full-Stack AI Agent Template

repository·main·Indexed 23 days ago

https://github.com/vstorm-co/full-stack-ai-agent-template

A production-ready project generator for AI applications combining a FastAPI backend and Next.js 15 frontend. It supports AI agent frameworks including PydanticAI, LangChain, and LangGraph, with RAG pipeline integrations for Milvus, Qdrant, pgvector, and ChromaDB. Features include WebSocket streaming for real-time chat, JWT/OAuth authentication, an admin panel, and observability via Logfire and LangSmith. The template provides a CLI for scaffolding projects with presets for AI agents, production, and SaaS setups.

Tokens
105.6K
Snippets
224
Records
455
Agent score
82%

What's inside fastapi-fullstack

  1. Overview of AI Chat UI features

    main

    The template includes a sophisticated AI Chat interface designed for real-time agent interaction. Key features include:

    • Real-time Streaming: Responses are streamed over WebSockets.
    • Tool Call Rendering: Each tool call is rendered as a purpose-built card (e.g., run_python shows code and stdout/results in a collapsible card).
    • Plan & Tasks: A sticky checklist that updates live as the agent progresses through steps.
    • Subagents: A live feed and side panel showing the status and messages of individual subagents.
    • Interactive Charts: Inline rendering of bar, area, line, pie, and scatter charts.
    • User Interaction: An ask-user tool that allows the agent to pause and ask clarifying questions, maintaining a full transcript.
    • Reasoning & History: A clean view for agent reasoning and a history of answered questions for long agent turns.
  2. Overview of Full-Stack AI Agent Template features

    main

    The Full-Stack AI Agent Template is a comprehensive boilerplate for building production-ready AI applications. It includes a high-performance FastAPI backend and a modern Next.js 15 frontend.

    Key capabilities include:

    AI & Agentic Capabilities

    • Frameworks: Support for PydanticAI, PydanticDeep, LangChain, LangGraph, and DeepAgents.
    • LLM Providers: Integration with OpenAI, Anthropic, Google Gemini, and OpenRouter.
    • RAG Pipeline: Document ingestion (Local, Google Drive, S3/MinIO), parsing (PyMuPDF, LlamaParse, LiteParse), chunking, and embedding (OpenAI, Voyage, Gemini, SentenceTransformers) with storage in Milvus, Qdrant, ChromaDB, or pgvector.
    • Agent Tools: Web search (Tavily), knowledge base search, code execution (run_python), and specialized tool-call cards.
    • Real-time: WebSocket streaming for live agent responses and subagent feeds.

    Backend (FastAPI)

    • Database: Async PostgreSQL with SQLAlchemy 2.0, Alembic migrations, and pgvector support.
    • Auth: JWT + Refresh tokens, API Keys, and OAuth2 (Google).
    • Tasks: Background task support via Celery, Taskiq, ARQ, or Prefect.
    • CLI: Custom Django-style management commands.

    Frontend (Next.js 15)

    • UI: React 19, Tailwind CSS v4, and specialized AI chat interfaces with tool visualization.
    • Features: Dark mode, i18n (PL/EN), billing dashboards (Stripe), and admin panels.
    • Auth: HTTP-only cookies, magic links, and password resets.
  3. Overview of included features in the AI SaaS template

    main

    The template provides a pre-wired full-stack foundation for AI applications, including:

    • Auth: JWT access and refresh tokens, password hashing, optional OAuth, and magic links.
    • Billing: Stripe integration including checkout, customer portal, subscriptions, credits, and usage metering.
    • Teams: Organization management, invitations, and role-based access control (RBAC).
    • AI Agents: Support for various frameworks such as PydanticAI, LangChain, LangGraph, and DeepAgents.
    • RAG (Retrieval-Augmented Generation): Support for vector databases like Milvus, Qdrant, Chroma, or pgvector, with synchronization for Google Drive and S3.
    • Observability: Structured logging, request IDs, and integration with Logfire or LangSmith.
  4. Overview of the Full-Stack AI Agent Template

    main

    The Full-Stack AI Agent Template is a production-ready project generator that scaffolds a complete application consisting of a FastAPI backend and a Next.js 15 frontend. It is designed for building AI-driven applications with built-in support for AI agents, Retrieval-Augmented Generation (RAG), and enterprise-grade features.

    Core Capabilities:

    • AI Agent Frameworks: Supports PydanticAI, PydanticDeep, LangChain, LangGraph, and DeepAgents.
    • RAG Pipelines: Integrates with Milvus, Qdrant, pgvector, and ChromaDB.
    • Real-time UI: Uses WebSocket streaming for real-time chat interfaces.
    • Enterprise Features: Includes JWT/OAuth authentication, an admin panel, Celery for background tasks, and support for Docker and Kubernetes.
    • Conversation Sharing: Enables direct sharing, public links, and an admin browser for conversations.
  5. Overview of Auth, Dashboard, and Workspace features

    main

    The template provides a complete user management and organizational structure:

    • Authentication: Supports Google OAuth and email/password login with HTTP-only cookie sessions. Includes registration with terms acceptance.
    • User Dashboard: Provides usage timelines, recent activity, and stat cards (available in light and dark themes).
    • Workspaces & Teams: Supports multiple organizations (workspaces) with different plan tiers and roles. Includes team management features like member lists and invite functionality.
    • Knowledge Bases (RAG): Management of RAG collections, including document uploads and connectors for Google Drive and S3.
  6. Overview of Billing, Admin, and Observability features

    main

    The template includes production-grade management and monitoring tools:

    • Billing & Usage: Integrated with Stripe for subscription management, invoice history, and credit balances. Includes usage charts for token breakdown and daily credit spending.
    • Admin Panel: Workspace-wide metrics (users, sessions, MRR), user management (search, roles, suspension), conversation browsing, and message rating analysis.
    • System Health: Live readiness checks for API, DB, Redis, vector store, LLM, worker, and Stripe.
    • Observability:
      • Logfire: Distributed tracing for FastAPI, PydanticAI, DB, Redis, Celery, and HTTPX.
      • LangSmith: Trace viewer for LangChain/LangGraph chains and token usage.
      • Prefect: Self-hosted server for managing background RAG, billing, and email flows via cron schedules.
    • Channels: Built-in support for Telegram bots with multi-bot, polling, and webhook capabilities.
  7. Manage Billing, Usage, and Credits

    main

    The template provides a comprehensive billing suite:

    • Billing Overview: Displays plan details, seat counts, and storage usage. Includes a link to the Stripe Customer Portal.
    • Usage Tracking: Visualizes daily credits spent and call counts, including a breakdown of token usage by model.
    • Credits Management: Shows current balance and an immutable transaction ledger for all credit movements.
  8. Understand the frontend project structure

    main

    The frontend is built with Next.js 15 (App Router), React 19, TypeScript, and Tailwind CSS. The directory structure is as follows:

    • src/app/: Next.js App Router routes (all routes are locale-prefixed, e.g., /[locale]/...).
    • src/components/: React components including chat, auth, dashboard, marketing, and UI elements.
    • src/hooks/: Custom React hooks like useChat and useWebSocket.
    • src/lib/: API clients, query keys, and utility helpers.
    • src/stores/: State management using Zustand.
    • src/types/: Shared TypeScript type definitions.
    • src/i18n.ts: Configuration for next-intl.
    • src/middleware.ts: Handles locale routing and authentication guards.
  9. Explore AI Chat UI features

    main

    The generated AI Chat interface uses WebSockets for streaming and provides specialized UI components for agentic workflows:

    • Plan & Tasks: A sticky checklist above the composer that updates live as the agent works, including an inline reasoning indicator.
    • Subagents: A live feed and side panel showing the status, streamed messages, and final results of delegated subagents.
    • Tool Cards: Instead of raw JSON, tools render purpose-built cards:
      • create_chart: Renders interactive, theme-aware bar, area, line, pie, or scatter charts.
      • run_python: Shows executed code and its output (or error) in a collapsible card.
      • ask_user: Allows the agent to pause for user clarification and resume once answered.
    • Reasoning & History: Includes a clean thinking view and a history of answered questions to maintain readability during long turns.
  10. What is excluded from the upgrade process

    main

    The upgrade process uses a git-based merge that automatically skips certain files to prevent data loss or environment corruption. The following are never read, written, or merged:

    • Secrets: .env, .env.* (except for committed samples like .env.example, which are merged to provide new settings).
    • Lockfiles: uv.lock, package-lock.json, bun.lock, bun.lockb (you should re-generate these after an upgrade if dependencies changed).
    • Environment/Build Artifacts: .git/, node_modules/, .venv/, build artifacts, __pycache__/, and caches.
    • Git Metadata: .gitattributes and git submodules.
    • OS Junk: .DS_Store, Thumbs.db.
    • Symlinks: Tracked symlinks are never deleted or restaged. Note: An untracked symlink sitting exactly where the upgrade writes a file will be replaced by that file.
    • The Manifest: .fastapi-fullstack.json is only updated by upgrade finalize.
  11. Overview of generated project structure

    main

    When you generate a project, it follows a structured layout separating the FastAPI backend from the Next.js frontend:

    • backend/app/main.py: The entry point for the FastAPI application.
    • backend/app/api/routes/v1/: Versioned API endpoints.
    • backend/app/agents/: Logic for AI agents.
    • backend/app/services/: Core business logic.
    • backend/app/repositories/: Data access layer.
    • backend/cli/: Django-style CLI commands.
    • frontend/src/app/: Next.js App Router pages.
    • frontend/src/components/: React UI components.
    • frontend/src/hooks/: Custom hooks like useChat and useWebSocket.
    • docker-compose.yml & Makefile: Orchestration and task automation.
    my_project/
    ├── backend/
    │   ├── app/
    │   │   ├── main.py              # FastAPI app
    │   │   ├── api/routes/v1/       # Versioned endpoints
    │   │   ├── agents/              # AI agents
    │   │   ├── services/            # Business logic
    │   │   └── repositories/        # Data access
    │   ├── cli/                     # Django-style commands
    │   └── tests/
    ├── frontend/
    │   ├── src/
    │   │   ├── app/                 # Next.js App Router
    │   │   ├── components/          # React components
    │   │   └── hooks/               # useChat, useWebSocket
    │   └── e2e/
    │       └── Playwright tests
    ├── docker-compose.yml
    └── Makefile