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!

Architecture

No Services Diagrams Yet

Architecture diagrams will be automatically generated when the Project Manager creates tasks for your project.

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