An AI-powered module for building customized Next.js and Tailwind CSS websites using natural language descriptions. This tool leverages LangChain and OpenRouter with Claude-3.5-Sonnet to generate high-quality, production-ready code.
# Clone the repository
git clone https://github.com/nazareai/nextjs-builder.git
cd nextjs-builder
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env to add your OpenRouter API key
# Generate a basic website
python test.py "Build a company website with a home page, about page, and contact form"
# Generate with a specific template
python test.py "Create a handmade jewelry store" --template=ecommerce
# Include authentication
python test.py "Build a travel blog with user comments" --template=blog --auth
# Specify database integration
python test.py "Create a photographer portfolio" --template=portfolio --db=mongodb
The Next.js & Tailwind Website Builder consists of several key components:
graph TD
A[CLI Interface] --> B[Config Parser]
B --> C[Next.js Project Creator]
C --> D[Template Selection]
D --> E[LLM-Powered Code Generation]
E --> F1[Pages Generator]
E --> F2[Components Generator]
E --> F3[State Management Generator]
F1 --> G[Integration Layer]
F2 --> G
F3 --> G
G --> H[Validation & Testing]
H --> I[Output]
J[LangChain + OpenRouter] -.-> E
K[Templates Library] -.-> D
L[Prompts Library] -.-> E
nextjs-builder/
โโโ README.md # This file
โโโ requirements.txt # Python dependencies
โโโ setup.py # Package setup
โโโ test.py # CLI entry point
โ
โโโ prompts/ # LLM prompt templates
โ โโโ system/ # System prompts
โ โโโ components/ # Component generation prompts
โ โโโ pages/ # Page generation prompts
โ โโโ templates/ # Website type templates
โ
โโโ templates/ # Starting point templates
โ โโโ base/ # Common components for all sites
โ โโโ blog/ # Blog-specific components
โ โโโ ecommerce/ # E-commerce components
โ โโโ portfolio/ # Portfolio components
โ
โโโ src/ # Module source code
โโโ cli.py # CLI argument handling
โโโ config.py # Configuration management
โโโ installer/ # Next.js project installation
โโโ generator/ # Code generation
โโโ llm/ # LangChain integration
โโโ utils/ # Utility functions
โโโ features/ # Optional feature integrations
Create a .env
file with the following variables:
OPENROUTER_API_KEY=your_api_key_here
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
You can also create a nextjs-builder.config.json
file for additional configuration:
{
"llm": {
"model": "anthropic/claude-3.5-sonnet-20240620",
"temperature": 0.7,
"max_tokens": 10000
},
"templates": {
"default": "general"
},
"validation": {
"run_eslint": true,
"run_typescript_check": true
}
}
Option | Description | Default |
---|---|---|
description | Description of the website to build | (required) |
--template | Website template (general, blog, ecommerce, portfolio) | "general" |
--auth | Include authentication | false |
--db | Database integration (none, mongodb, postgres, supabase) | "none" |
--output | Output directory for the generated website | "./website" |
--verbose | Enable verbose logging | false |
A multi-purpose website suitable for businesses, organizations, or personal sites.
Key Features:
A content-focused blog website optimized for readability and SEO.
Key Features:
A complete online store with product showcase and checkout flow.
Key Features:
A showcase website for creative professionals and their work.
Key Features:
When enabled with --auth
, the module will add:
Available options with --db
:
Run the test suite to validate the module:
# Run all tests
pytest
# Run specific test categories
pytest tests/unit/
pytest tests/integration/
pytest tests/e2e/
For more detailed documentation, see:
This project is currently in alpha status. Core functionality is being finalized and the API may change.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
# Clone the repository
git clone https://github.com/nazareai/nextjs-builder.git
cd nextjs-builder
# Install dependencies
pip install -e ".[dev]"
# Set up pre-commit hooks
pre-commit install
This project is licensed under the MIT License - see the LICENSE file for details.