Skip to content

Repository files navigation

⚑ BlinkBuild

Describe it. Generate it. Ship it β€” all from your browser.

An AI-powered website generator that turns natural language prompts into production-ready, live-previewed web applications in seconds β€” powered by Gemini 2.5 Flash and WebContainers.


Next.js TypeScript React Gemini Tailwind CSS WebContainers Docker License: MIT


✨ Features Β· πŸ› οΈ Tech Stack Β· πŸ“¦ Project Structure Β· πŸš€ Getting Started Β· πŸ’» Usage Β· 🀝 Contributing


✨ Features

  • πŸ€– AI-Powered Code Generation β€” Generates complete, production-ready React or Node.js projects from plain English descriptions using Google's Gemini 2.5 Flash model.
  • 🌐 In-Browser Execution β€” Runs a full Node.js dev environment entirely inside the browser via WebContainers β€” zero backend servers, zero cloud VMs.
  • πŸ‘οΈ Instant Live Preview β€” Preview your generated website in a real embedded iframe with a live dev server β€” see it the moment it's built.
  • πŸ“ Integrated Code Editor β€” View and inspect generated source code in a Monaco Editor (the engine behind VS Code) with full syntax highlighting.
  • πŸ“‚ Interactive File Explorer β€” Navigate the generated project's file tree with collapsible folders, language-aware icons, and one-click file selection.
  • πŸ’¬ Iterative Refinement via Chat β€” Don't like something? Send follow-up prompts to tweak, extend, or restyle your website conversationally.
  • πŸ“₯ One-Click Export β€” Download the entire generated project as a bundled file, ready to run locally or deploy to any host.
  • 🎨 Premium Glassmorphism UI β€” Stunning dark-mode interface with floating orbs, gradient effects, animated transitions, and micro-interactions throughout.
  • ⚑ Smart Template Detection β€” AI automatically decides whether to scaffold a React or Node.js project based on the user's intent.
  • πŸ”’ Secure by Default β€” COOP/COEP headers pre-configured for WebContainer compatibility across all deployment targets.

πŸ“Έ Screenshots / Demo

Screenshots and demo GIFs coming soon!

Landing Page Generation Workspace
Landing Page Generation UI

πŸŽ₯ Live Demo: Coming Soon


πŸ› οΈ Tech Stack

Layer Technology Purpose
Framework Next.js 16 App Router, Server Actions, Turbopack
Language TypeScript 5 End-to-end type safety
UI Library React 19 Component rendering
AI Model Gemini 2.5 Flash Code generation & prompt analysis
Browser Runtime WebContainers API In-browser Node.js environment
Code Editor Monaco Editor Syntax-highlighted code viewer
UI Components shadcn/ui + Radix UI Accessible, composable primitives
Styling Tailwind CSS 4 Utility-first CSS
Icons Lucide React Beautiful open-source icons
HTTP Client Axios API requests
Containerization Docker Multi-stage Alpine-based builds

πŸ“¦ Project Structure

BlinkBuild/
β”‚
β”œβ”€β”€ app/                            # Next.js App Router
β”‚   β”œβ”€β”€ page.tsx                    # Landing page β€” hero + prompt form
β”‚   β”œβ”€β”€ layout.tsx                  # Root layout (Geist fonts, metadata)
β”‚   β”œβ”€β”€ actions.ts                  # Server Action β€” redirect to /generate
β”‚   β”œβ”€β”€ globals.css                 # Global styles & CSS variables
β”‚   β”‚
β”‚   β”œβ”€β”€ generate/                   # Generation workspace
β”‚   β”‚   β”œβ”€β”€ page.tsx                # Suspense wrapper
β”‚   β”‚   └── generation-content.tsx  # Core UI: steps, editor, preview, chat
β”‚   β”‚
β”‚   β”œβ”€β”€ api/                        # API Routes
β”‚   β”‚   β”œβ”€β”€ template/route.ts       # POST β€” AI selects React vs Node scaffold
β”‚   β”‚   β”œβ”€β”€ chat/route.ts           # POST β€” Gemini multi-turn code generation
β”‚   β”‚   └── gemini/route.ts         # POST β€” Streaming Gemini endpoint (Edge)
β”‚   β”‚
β”‚   └── lib/                        # Shared logic
β”‚       β”œβ”€β”€ prompt.ts               # System prompts & instruction templates
β”‚       β”œβ”€β”€ steps.ts                # boltArtifact XML β†’ Step[] parser
β”‚       β”œβ”€β”€ constants.ts            # WORK_DIR, allowed HTML elements
β”‚       β”œβ”€β”€ stripindents.ts         # Template literal dedent utility
β”‚       └── defaults/
β”‚           β”œβ”€β”€ react.ts            # React + Vite starter scaffold
β”‚           └── node.ts             # Node.js starter scaffold
β”‚
β”œβ”€β”€ components/                     # React components
β”‚   β”œβ”€β”€ CodeEditor.tsx              # Monaco Editor wrapper (read-only)
β”‚   β”œβ”€β”€ FileExplorer.tsx            # Recursive file tree browser
β”‚   β”œβ”€β”€ PreviewFrame.tsx            # WebContainer β†’ iframe live preview
β”‚   └── ui/                         # shadcn/ui primitives
β”‚       β”œβ”€β”€ badge.tsx
β”‚       β”œβ”€β”€ button.tsx
β”‚       β”œβ”€β”€ card.tsx
β”‚       β”œβ”€β”€ label.tsx
β”‚       β”œβ”€β”€ progress.tsx
β”‚       β”œβ”€β”€ scroll-area.tsx
β”‚       β”œβ”€β”€ tabs.tsx
β”‚       └── textarea.tsx
β”‚
β”œβ”€β”€ hooks/
β”‚   └── useWebcontainers.ts         # Singleton WebContainer boot hook
β”‚
β”œβ”€β”€ lib/
β”‚   └── utils.ts                    # cn() β€” clsx + tailwind-merge helper
β”‚
β”œβ”€β”€ public/                         # Static assets (SVGs, favicon)
β”œβ”€β”€ DockerFile                      # Multi-stage production build
β”œβ”€β”€ docker-compose.yml              # Compose config (1 CPU, 1 GB RAM limit)
β”œβ”€β”€ vercel.json                     # COOP/COEP headers for WebContainers
β”œβ”€β”€ next.config.ts                  # Standalone output + security headers
β”œβ”€β”€ tailwind.config.js              # Tailwind configuration
β”œβ”€β”€ tsconfig.json                   # TypeScript config
β”œβ”€β”€ components.json                 # shadcn/ui configuration
└── package.json                    # Dependencies & scripts

πŸš€ Getting Started

Prerequisites

Tool Version Notes
Node.js β‰₯ 20.x Download
npm β‰₯ 9.x Bundled with Node.js
Gemini API Key β€” Get a free key
Docker (optional) β‰₯ 24.x Only for containerized deployment

Step 1 β€” Clone the Repository

git clone https://github.com/SinghalSahab/BlinkBuild.git
cd BlinkBuild

Step 2 β€” Install Dependencies

npm install

Step 3 β€” Configure Environment Variables

Create a .env.local file in the project root:

# .env.local
# ─────────────────────────────────────────────
# Required: Google Gemini API key
API_KEY=your_gemini_api_key_here

Tip

You can get a free Gemini API key at aistudio.google.com/apikey.

Step 4 β€” Start the Dev Server

npm run dev

Open http://localhost:3000 in your browser. πŸŽ‰

Important

WebContainers require these HTTP headers to function. They are already configured in next.config.ts and vercel.json:

Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin

πŸ’» Usage

Running in Development

# Start with Turbopack (fast HMR)
npm run dev

# Lint the codebase
npm run lint

Building for Production

# Create an optimized production build
npm run build

# Start the production server
npm run start

Docker Deployment

# Build and run with Docker Compose
docker compose up -d --build

# Or build and run manually
docker build -t blinkbuild .
docker run -p 3000:3000 -e API_KEY=your_gemini_api_key blinkbuild

The Dockerfile uses a 3-stage build (deps β†’ builder β†’ runner) with Next.js standalone output for a minimal image size (~150 MB).

Vercel Deployment

Deploy with Vercel

# Or deploy via CLI
npx vercel --prod

Set API_KEY in your Vercel project's Settings β†’ Environment Variables.

How It Works

sequenceDiagram
    participant User
    participant Landing as Landing Page
    participant Template as /api/template
    participant Chat as /api/chat
    participant Gemini as Gemini 2.5 Flash
    participant WC as WebContainer

    User->>Landing: Types a prompt
    Landing->>Template: POST { prompt }
    Template->>Gemini: "React or Node?"
    Gemini-->>Template: "react"
    Template-->>Landing: Base prompts + UI scaffold
    Landing->>Chat: POST { messages }
    Chat->>Gemini: Generate full project
    Gemini-->>Chat: boltArtifact XML response
    Chat-->>Landing: Parsed steps & file tree
    Landing->>WC: Mount files to in-browser FS
    WC->>WC: npm install && npm run dev
    WC-->>User: Live preview in iframe ✨
Loading

🀝 Contributing

Contributions, issues, and feature requests are warmly welcome!

How to Contribute

  1. Fork the repository
  2. Create your feature branch
    git checkout -b feature/your-amazing-feature
  3. Commit your changes with a descriptive message
    git commit -m "feat: add your amazing feature"
  4. Push to your branch
    git push origin feature/your-amazing-feature
  5. Open a Pull Request against main

Guidelines

  • Follow existing code style and conventions
  • Write meaningful commit messages (Conventional Commits preferred)
  • Test your changes locally before submitting
  • Keep PRs focused β€” one feature or fix per PR

Note

Not sure where to start? Check out the open issues or suggest a new feature!


πŸ“ License

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

MIT License β€” Copyright (c) 2025 Prakhar Singhal

πŸ™ Acknowledgments

Bolt.new β€” Inspiration for AI-powered dev workflows Β· StackBlitz β€” WebContainers technology Β· Vercel β€” Next.js & hosting Β· Google AI β€” Gemini models


Built with ⚑ by Prakhar Singhal

If this project helped you, consider giving it a ⭐ β€” it means a lot!

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages