Skip to content
RosRendoPublic

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

75 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StackGen AI — Intelligent Full-Stack Architecture Synthesizer & Code Scaffolder

License Next.js React XYFlow NestJS Better-Auth Prisma PostgreSQL LemonSqueezy pnpm

An AI-driven software architecture studio that transforms product specifications into interactive system topology graphs, execution task trees, and production-ready full-stack boilerplates.

System Architecture • Database ERD • Synthesis Flow • Quick Start


⚡ Overview

StackGen AI replaces weeks of preliminary engineering setup with minutes of intelligent synthesis. Developers input high-level product briefs and requirements; StackGen computes the optimal technology stack, generates interactive system topology diagrams on a drag-and-drop canvas powered by @xyflow/react, compiles a 4-phase execution task roadmap, and packages clean, boilerplate repository archives ready for immediate download.


🏗 System Architecture

flowchart TD
    subgraph UIStudio["🎨 Visual Architecture Studio (Next.js 16 + React 19)"]
        Canvas["Interactive Topology Canvas (@xyflow/react)"]
        PromptPanel["Product Brief & Spec Input Form"]
        TaskRoadmap["4-Phase Execution Task Tree (TODO/DONE)"]
        BillingDrawer["Lemon Squeezy Token & Tier Drawer"]
        ZipDownload["JSZip Archive Downloader & Exporter"]
        
        PromptPanel --> Canvas
        Canvas --> TaskRoadmap
        Canvas --> ZipDownload
    end

    subgraph BackendAPI["⚡ NestJS 11 Synthesis Core"]
        NestEngine["NestJS API Controller & Pipeline"]
        AuthModule["Better-Auth Session & Guard"]
        Throttler["Nest Throttler Rate Limiter"]
        AIEngine["LLM Architecture Synthesis Engine"]
        ZipPackager["Dynamic Codebase File Packager"]
        
        UIStudio <-->|"REST APIs"| NestEngine
        NestEngine --> AuthModule
        NestEngine --> Throttler
        NestEngine --> AIEngine
        NestEngine --> ZipPackager
    end

    subgraph LLMProviders["🧠 Multi-Provider AI Synthesis"]
        Gemini["Google Gemini Pro / Flash"]
        Claude["Anthropic Claude 3.5 Sonnet"]
        OpenAI["OpenAI GPT-4o"]
        
        AIEngine <--> Gemini & Claude & OpenAI
    end

    subgraph Persistence["💾 Database & Subscriptions"]
        PrismaClient["Prisma 6 ORM Client"]
        Postgres[(PostgreSQL Database)]
        LemonSqueezy["Lemon Squeezy Webhook Listener"]
        
        NestEngine <--> PrismaClient
        PrismaClient <--> Postgres
        LemonSqueezy --> NestEngine
    end
Loading

📊 Database Entity-Relationship Diagram

erDiagram
    user ||--o{ session : "maintains"
    user ||--o{ account : "links"
    user ||--o{ project : "authors"
    user ||--o{ customer : "subscribes_as"
    customer ||--o{ subscriptions : "owns"
    project ||--|{ task : "contains"

    user {
        string id PK "cuid"
        string name
        string email UK
        boolean emailVerified
        string image
        string squeezyCustomerId
        string subscriptionTier "Free | Pro | Enterprise"
        string subscriptionStatus "active | inactive"
        int tokenBalance
        datetime createdAt
        datetime updatedAt
    }

    session {
        string id PK "cuid"
        string token UK
        string userId FK
        string ipAddress
        string userAgent
        datetime expiresAt
        datetime createdAt
    }

    account {
        string id PK "cuid"
        string userId FK
        string providerId
        string accountId
        string accessToken
        string refreshToken
        datetime createdAt
    }

    project {
        string id PK "cuid"
        string userId FK
        string name
        string description
        string industry
        string targetUsers
        string traffic
        string budget
        string level "MVP | Startup | Professional | Enterprise"
        json techStack
        json architectureNodes
        json architectureEdges
        json costEstimate
        json masterPlan
        datetime createdAt
        datetime updatedAt
    }

    task {
        string id PK "cuid"
        string projectId FK
        string category "Frontend | Backend | Security | DevOps"
        string title
        string description
        string status "TODO | IN_PROGRESS | DONE"
        string priority "LOW | MEDIUM | HIGH"
        string estimatedTime
        string phase
        json relatedTech
        json checklist
        json commands
        json files
        datetime createdAt
        datetime updatedAt
    }

    customer {
        string id PK "Lemon Squeezy ID"
        string email
        string userId FK
        datetime createdAt
        datetime updatedAt
    }

    subscriptions {
        string id PK "Lemon Squeezy ID"
        string customerId FK
        string status "active | on_trial | past_due | cancelled"
        string priceId
        string productId
        string portalUrl
        datetime createdAt
        datetime updatedAt
    }
Loading

🔄 Architecture Synthesis Workflow

sequenceDiagram
    autonumber
    actor Developer
    participant Studio as Next.js Canvas Studio
    participant API as NestJS Backend
    participant LLM as Multi-Model AI Engine
    participant DB as PostgreSQL (Prisma)
    participant Zip as JSZip Exporter

    Developer->>Studio: Enter Product Prompt (e.g., "Healthcare Telemedicine App")
    Studio->>API: POST /api/projects/generate (Brief, Industry, Scale: Startup)
    API->>API: Verify User Token Balance (Better-Auth)
    
    API->>LLM: Dispatch Architecture Spec & Node Synthesis
    LLM-->>API: Synthesized Nodes, Connectors, DDL Schema & Tasks
    
    API->>DB: Save `project` (Nodes JSON, Edges JSON, MasterPlan)
    API->>DB: Batch Insert `task` (Phased Roadmap)
    API-->>Studio: Return Generated Topology & Task Tree
    
    Studio->>Developer: Render Interactive @xyflow/react Canvas Graph
    Developer->>Studio: Inspect, Drag, Add Nodes, Modify Tech Stack
    Developer->>Studio: Click "Export Full-Stack Boilerplate (.zip)"
    
    Studio->>Zip: Bundle Codebase Files (Frontend, Backend, Configs, Readme)
    Zip-->>Developer: Download Ready-to-Run Codebase Archive
Loading

📦 Key Capabilities

  • Visual Architecture Studio: Manipulate frontend, backend, database, and cloud microservices on a fluid drag-and-drop canvas.
  • AI-Powered Stack Advisory: Automatic recommendation of database types, caching tiers, and auth providers tailored to traffic and budget.
  • Automated Roadmap Generation: Breaks down the synthesized system into structured, actionable engineering tasks across 4 build phases.
  • Instant Project Scaffolding: Produces clean, compilable project folders with package manifests, environment templates, and Docker configs.
  • Subscription & Token Economy: Fully integrated with Lemon Squeezy for tiered developer billing and token usage metering.

🚀 Quick Start

1. Backend Setup (NestJS)

cd backend
pnpm install

# Setup Environment
cp .env.example .env
# Set DATABASE_URL, BETTER_AUTH_SECRET, LEMON_SQUEEZY_API_KEY, AI_API_KEY

# Push Database Schema
pnpm prisma db push

# Start Backend
pnpm run start:dev

2. Frontend Setup (Next.js)

cd ../frontend
pnpm install

# Start Studio Interface
pnpm run dev

Visit http://localhost:3000 to begin generating software architectures.


📄 License

Proprietary & Confidential — Engineered by Ros Rendo

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages