The first open-source project coded 100% by Claude has garnered over 200 stars

3 weeks ago 1

Next.js TypeScript PostgreSQL Kubernetes Claude Code

FullStack Agent is an innovative AI-powered platform that enables users to create, develop, and deploy full-stack web applications through natural language interaction. Built on top of Claude Code CLI and Kubernetes, it provides isolated sandbox environments for secure and scalable application development.

image
  • 🤖 AI-Powered Development: Leverage Claude Code to build applications using natural language
  • 🔒 Isolated Sandboxes: Each project runs in its own Kubernetes-managed container environment
  • 🗄️ Automatic Database Provisioning: PostgreSQL databases created on-demand using KubeBlocks
  • 🌐 Web-Based Terminal: Integrated ttyd terminal for direct environment access
  • 🔐 GitHub Integration: Seamless code repository management and version control
  • ⚡ Real-time Progress Tracking: Visual feedback during sandbox creation and deployment
  • 🎨 Modern UI: Built with Next.js 15, Tailwind CSS v4, and Shadcn/UI components
  • Framework: Next.js 15.5.4 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS v4
  • UI Components: Shadcn/UI
  • State Management: React Hooks
  • Runtime: Node.js
  • API: Next.js API Routes
  • Database ORM: Prisma
  • Authentication: NextAuth v5 with GitHub OAuth
  • Container Orchestration: Kubernetes
  • Database: PostgreSQL (via KubeBlocks)
  • Web Terminal: ttyd
  • Container Image: fullstack-web-runtime (Custom Docker image with development tools)
  • Node.js 20.x or higher
  • PostgreSQL database
  • Kubernetes cluster with KubeBlocks installed
  • GitHub OAuth application credentials
  1. Clone the repository:
git clone https://github.com/FullstackAgent/FullstackAgent.git cd FullstackAgent
  1. Install dependencies:
cd fullstack-agent npm install
  1. Set up environment variables:

Create .env.local file:

# Database DATABASE_URL="postgresql://user:password@localhost:5432/fullstackagent" # GitHub OAuth GITHUB_CLIENT_ID="your-github-client-id" GITHUB_CLIENT_SECRET="your-github-client-secret" # NextAuth NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="your-nextauth-secret" # Kubernetes KUBECONFIG_PATH="./.secret/kubeconfig"
  1. Set up Kubernetes configuration:

Place your kubeconfig file in .secret/kubeconfig

  1. Set up Claude Code environment:

Create .secret/.env file with your Anthropic API credentials:

ANTHROPIC_API_KEY="your-anthropic-api-key"
  1. Initialize the database:
npx prisma generate npx prisma db push
  1. Run the development server:

Open http://localhost:3000 to access the application.

┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ │ │ │ │ Web Browser │────▶│ Next.js App │────▶│ Kubernetes │ │ │ │ │ │ Cluster │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ │ │ ▼ │ ┌─────────────────┐ │ │ PostgreSQL │ │ │ (KubeBlocks) │ │ └─────────────────┘ │ │ ▼ ▼ ┌─────────────────┐ ┌─────────────────┐ │ GitHub │ │ Sandbox Pods │ │ Repositories │ │ (with Claude) │ └─────────────────┘ └─────────────────┘
model User { id String @id @default(cuid()) email String @unique name String? image String? githubId String @unique accessToken String? // Encrypted projects Project[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Project { id String @id @default(cuid()) name String description String? githubRepo String? status String @default("active") databaseUrl String? userId String user User @relation(fields: [userId], references: [id], onDelete: Cascade) sandboxes Sandbox[] environmentVariables EnvironmentVariable[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Sandbox { id String @id @default(cuid()) projectId String project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) k8sNamespace String k8sDeploymentName String k8sServiceName String publicUrl String? ttydUrl String? status String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }

The platform creates the following Kubernetes resources for each project:

  1. Database Cluster (KubeBlocks):

    • PostgreSQL 14.8.0
    • 3Gi storage
    • Auto-generated credentials
  2. Sandbox Deployment:

    • Custom fullstack-web-runtime image
    • Claude Code CLI pre-installed
    • Web terminal (ttyd) on port 7681
    • Application ports: 3000, 5000, 8080
  3. Services & Ingress:

    • Internal service for pod networking
    • HTTPS ingress with SSL termination
    • WebSocket support for terminal

Default resource allocation per sandbox:

  • CPU: 200m limit, 20m request
  • Memory: 256Mi limit, 25Mi request
  • Storage: 3Gi for database
fullstack-agent/ ├── app/ # Next.js App Router pages │ ├── api/ # API routes │ ├── projects/ # Project management pages │ └── layout.tsx # Root layout ├── components/ # React components │ ├── ui/ # Shadcn/UI components │ └── ... # Feature components ├── lib/ # Core libraries │ ├── auth.ts # NextAuth configuration │ ├── db.ts # Prisma client │ ├── kubernetes.ts # Kubernetes service │ └── github.ts # GitHub integration ├── prisma/ # Database schema ├── yaml/ # Kubernetes templates └── public/ # Static assets

KubernetesService (lib/kubernetes.ts)

  • Manages all Kubernetes operations
  • Creates databases and sandboxes
  • Handles pod lifecycle management

Authentication (lib/auth.ts)

  • GitHub OAuth integration
  • Session management
  • User authorization
  • Prisma ORM configuration
  • Connection pooling
POST /api/sandbox/[projectId] Content-Type: application/json { "envVars": { "KEY": "value" } }
GET /api/sandbox/[projectId]
DELETE /api/sandbox/[projectId]
POST /api/projects Content-Type: application/json { "name": "project-name", "description": "Project description" }
  • Authentication: GitHub OAuth ensures only authorized users can access the platform
  • Isolation: Each sandbox runs in its own Kubernetes namespace
  • Secrets Management: Sensitive data stored in Kubernetes secrets
  • Network Policies: Sandboxes isolated from each other
  • Resource Limits: Prevents resource exhaustion attacks

We welcome contributions! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: npm test
  5. Submit a pull request

This project is licensed under the MIT License - see the LICENSE file for details.


100% AI-generated code. Prompted by fanux. Thanks for Claude code & Opus & Sonnet 4.5 & GLM

Read Entire Article