project-5326fa2c

byq12

Please engineer a complete, production-ready B2B SaaS application called "DemoCraft AI." DemoCraft AI allows sales representatives to automatically generate tailored, fully functional software sandboxes (frontend UIs and mock API backends) for enterprise prospects by leveraging Gemini 3.5 Flash and a RAG pipeline over technical documentation. STACK REQUIREMENTS: - Frontend: Next.js (App Router), React, Tailwind CSS, Lucide Icons. - Backend: Python FastAPI. - Database: PostgreSQL with pgvector extension. - AI Integration: google-genai SDK (gemini-3.5-flash and text-embedding-004). - Infrastructure: Docker, Docker Compose, and Kubernetes Helm charts for deployment. - Authentication: Clerk (or equivalent JWT-based multi-tenant auth). - Monetization: Stripe API (Subscription billing & Webhooks). CORE ARCHITECTURE & DATA MODEL: Implement a strict multi-tenant architecture where every table includes an `org_id` foreign key. 1. `Organization`: id (UUID), company_name, stripe_customer_id, subscription_status. 2. `User`: id, org_id, email, role. 3. `KnowledgeDocument`: id, org_id, file_name, raw_content. 4. `DocumentChunk`: id, org_id, doc_id, content_chunk, embedding (vector(768)). 5. `SandboxInstance`: id, org_id, prospect_name, sandbox_subdomain, ai_blueprint (JSONB), status. BACKEND REQUIREMENTS (FastAPI): 1. Auth Middleware: All endpoints must strictly validate JWTs and filter database queries by the user's `org_id`. 2. RAG Ingestion API (`/api/docs/upload`): Accept PDF/TXT files, chunk the text, call Google GenAI `text-embedding-004` to generate vectors, and store them in PostgreSQL `DocumentChunk`. 3. AI Generation Engine (`/api/sandbox/generate`): - Accept user inputs: Prospect Industry and Technical Requirements. - Perform a vector similarity search in `DocumentChunk` filtered by `org_id` to retrieve context. - Call Gemini 3.5 Flash using the `google-genai` SDK. - You MUST use Pydantic classes and `response_schema` to enforce Structured Outputs. The output must conform to a master Pydantic model containing: `database_schemas` (table names and SQL CREATE statements), `mock_datasets` (table names and JSON rows), and `simulated_endpoints` (HTTP method, route, and mock JSON response). 4. Sandbox Provisioner (`/api/sandbox/launch`): Write the logic to take the generated AI blueprint, save it locally, and spin up a new Docker container (using a base Python image) running a dynamic mock server based on that blueprint. Expose this container to an available host port. 5. Stripe Webhook (`/api/webhooks/stripe`): Listen for `invoice.payment_succeeded` and update the Organization's `subscription_status` to active. FRONTEND REQUIREMENTS (Next.js): 1. Build a professional SaaS dashboard with a sidebar navigation (Home, Knowledge Base, Active Demos, Billing). 2. Protect all routes behind authentication. 3. 'Knowledge Base' View: Drag-and-drop file uploader for documents. 4. 'Generate Demo' View: A form for Prospect Name, Industry, and Requirements. Show a loading state during the AI generation process. 5. 'Active Demos' View: Display cards for generated sandboxes with a "Launch URL" button that points to the dynamically provisioned Docker container port. 6. 'Billing' View: Integrate Stripe Checkout for a $500/month subscription tier. QA & DEVOPS REQUIREMENTS: 1. Write Pytest unit tests for the RAG ingestion and AI generation logic, mocking the Google GenAI SDK calls. 2. Provide a `docker-compose.yml` for local development encompassing the backend, frontend, and PostgreSQL (with pgvector). 3. Provide Kubernetes Helm charts for deploying the application to a cloud provider, including horizontal pod autoscaling configurations for the FastAPI backend. Please act as a senior engineering team. Ensure the codebase is clean, well-abstracted, observable, and strictly isolated between tenants.

LandingDashboardLogin
Landing

Comments (0)

No comments yet. Be the first!

System Requirements

System Requirement Document
Page 1 of 5

System Requirements Document for project-5326fa2c

1. Introduction

This document outlines the system requirements for "DemoCraft AI," a B2B SaaS application designed to enable sales representatives to automatically generate tailored, fully functional software sandboxes for enterprise prospects. The application leverages Gemini 3.5 Flash and a RAG pipeline over technical documentation to achieve this functionality.

2. System Overview

DemoCraft AI is a sophisticated platform that integrates AI capabilities to streamline the process of creating software demos for enterprise clients. It is built on a multi-tenant architecture to ensure data isolation and security across different organizations. The application includes a robust authentication system, AI-driven sandbox generation, and a subscription-based monetization model.

2a. Source Content Inventory

  • Content Source: Technical documentation and user inputs for generating sandboxes.
  • Authority: Google GenAI SDK for AI integration, Stripe API for monetization.
Page 2 of 5

3. Functional Requirements as Story Points

  • As a Sales Representative, I should be able to upload technical documents to the Knowledge Base.
  • As a Sales Representative, I should be able to generate a demo sandbox by specifying the prospect's industry and technical requirements.
  • As a Sales Representative, I should be able to view and launch active demo sandboxes.
  • As a Sales Representative, I should be able to manage billing and subscription through the Billing view.
  • As an Admin, I should be able to ensure all routes are protected by authentication.
  • As a Developer, I should be able to write unit tests for the RAG ingestion and AI generation logic.
  • As a DevOps Engineer, I should be able to deploy the application using Kubernetes Helm charts with horizontal pod autoscaling.

4. User Personas

  • Sales Representative: Responsible for generating and managing demo sandboxes for prospects.
  • Admin: Manages user access and ensures secure authentication.
  • Developer: Focuses on developing and testing the application features.
  • DevOps Engineer: Handles deployment and infrastructure management.

5. Core User Flows

  • Sales Representative uploads document -> AI processes document -> Sandbox is generated -> Sales Representative launches sandbox.
  • Admin configures authentication -> User logs in -> Access to dashboard is granted.
  • DevOps Engineer sets up Kubernetes -> Deploys application -> Monitors application performance.
Page 3 of 5

6. Visuals Colors and Theme

  • primary: #1E3A8A (Deep Blue)
  • primary_light: #3B82F6 (Light Blue)
  • secondary: #F59E0B (Amber)
  • accent: #EF4444 (Red)
  • highlight: #FBBF24 (Gold)
  • bg: #F3F4F6 (Light Gray)
  • surface: rgba(255, 255, 255, 0.8)
  • text: #111827 (Dark Gray)
  • text_muted: #6B7280 (Muted Gray)
  • border: rgba(209, 213, 219, 0.2)

7. Signature Design Concept

Interactive Sandbox Showcase

The homepage will feature an interactive sandbox showcase where users can drag and drop elements to simulate the creation of a software demo. This feature will use motion/react for smooth animations and transitions. The sandbox will dynamically update to reflect changes, providing a real-time preview of the demo environment.

Page 4 of 5

Landing Hero Motion Brief

The landing hero will depict a transformation of raw technical documents into a polished software demo. Using motion/react, the animation will show documents being ingested, processed, and transformed into a vibrant, interactive UI. The animation will loop every 10 seconds, highlighting the seamless transition from input to output.

8. Interaction Model & Motion Direction

  • Interaction Model: Animated
  • The landing page will feature moderate scroll-triggered reveals and hover transitions, enhancing user engagement without overwhelming them.

9. Non-Functional Requirements

  • Ensure strict tenant isolation in the database and application logic.
  • Implement robust JWT-based authentication for secure access.
  • Provide comprehensive logging and monitoring for observability.

10. Tech Stack

  • Frontend: Next.js (App Router), React, Tailwind CSS, Lucide Icons
  • Backend: Python FastAPI
  • Database: PostgreSQL with pgvector extension
  • AI Integration: google-genai SDK (gemini-3.5-flash and text-embedding-004)
  • Infrastructure: Docker, Docker Compose, Kubernetes Helm charts
  • Authentication: Clerk or equivalent JWT-based multi-tenant auth
  • Monetization: Stripe API
Page 5 of 5

11. Assumptions and Constraints

  • The application will support multi-tenancy with strict data isolation.
  • The AI models will be integrated using the google-genai SDK.
  • The application will be deployed using Kubernetes for scalability.

12. Glossary

  • RAG: Retrieval-Augmented Generation
  • JWT: JSON Web Token
  • AI: Artificial Intelligence
  • SDK: Software Development Kit
  • UI: User Interface
  • API: Application Programming Interface
Landing design preview
Landing: View Info
Login: Sign In
Dashboard: View Home
Admin: Configure Auth
Admin: Manage Users
Admin: Protect Routes
Billing: View Org Subscription
Dashboard: View Tenant Status
Landing design preview
Landing: View Info
Login: Sign In
Dashboard: View Home
Admin: Configure Auth
Admin: Manage Users
Admin: Protect Routes
Billing: View Org Subscription
Dashboard: View Tenant Status