A powerful monorepo-based system that automates the creation, building, and deployment of multiple Astro-based websites from CSV data, featuring a Next.js dashboard for management and Cloudflare Pages deployment.
# Clone the repository
git clone https://github.com/rejoan121615/website-generator.git
cd website-generator
# Install and build everything
pnpm run ready
# Start generating websites
pnpm run generate- Node.js: Version 22.0.0 or higher
- PNPM: Version 10.0.0 or higher
- Git: For cloning the repository
- Cloudflare Account: For website deployment
git clone https://github.com/rejoan121615/website-generator.git
cd website-generatorpnpm run readyThis command will:
- Install all packages and prepare the system for use
Create a .env file in the root directory and add your Cloudflare credentials:
# Required for deployment
CLOUDFLARE_API_TOKEN=your_cloudflare_api_token
CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id
# Optional
CLOUDFLARE_EMAIL=your_email
WRANGLER_LOG_PATH=logs/wrangler.log
GITHUB_USERNAME=your_github_username
GITHUB_REPOSITORY=website-generator
DEPLOYMENT_BRANCH=main- Go to Cloudflare Dashboard
- Click "Create Token" β "Custom Token"
- Add permissions:
- Zone:Zone:Read
- Zone:DNS:Edit
- Account:Cloudflare Pages:Edit
- Go to Cloudflare Dashboard
- Select any domain
- Copy "Account ID" from the right sidebar
Create data/websites.csv with the required columns:
template,domain,name,service_name,address,phone,email,site_title,meta_title,meta_description,logo_url
base-template,example.com,Example Business,consulting,"{""street"":""123 Main St"",""city"":""London"",""state"":""England"",""country"":""UK""}",020-1234-5678,info@example.com,Example Business in London,London's Best Consulting,Professional consulting services in London,logo.pngNote: Template name must exactly match a folder in the templates/ directory.
# Generate all websites from CSV
pnpm run generate
# Generate a single website
pnpm run generate:single --domain example.com# Preview all generated websites locally
pnpm run preview
# Preview a single website locally
pnpm run preview:single --domain example.com# Deploy all websites to Cloudflare Pages
pnpm run deploy
# Deploy a single website
pnpm run deploy:single --domain example.com# Start web dashboard
pnpm run dashboard
# Access at: http://localhost:3000
# Undeploy websites from Cloudflare
pnpm run undeploy # All websites
pnpm run undeploy:single --domain example.com # Single website
# Delete generated websites
pnpm run delete # All websites
pnpm run delete:single --domain example.com # Single websiteLaunch the web-based management interface:
pnpm run dashboardAccess at: http://localhost:3000
- Websites Page: Manage all websites, trigger builds/deployments
- Domains Page: Connect custom domains to Cloudflare projects
- CSV Data Page: Upload/edit website data
Your data/websites.csv controls website generation. Each row creates one website.
| Column | Description | Example |
|---|---|---|
template |
Template folder name | base-template |
domain |
Website domain | example.com |
name |
Business name | Example Business |
service_name |
Type of service | consulting |
address |
JSON address data | {"street":"123 Main St",...} |
phone |
Contact phone | 020-1234-5678 |
email |
Contact email | info@example.com |
site_title |
Full site title | Example Business in London |
meta_title |
SEO title | London's Best Consulting |
meta_description |
SEO description | Professional consulting services |
logo_url |
Logo filename | logo.png |
- base-template: General business template
- agency-template: Marketing agency design
- astropie-template: Restaurant/food business
- idol-template: SaaS/software product
- kreativ-template: Creative agency
- preline-template: Corporate business
- Setup: Clone repo, run
pnpm run ready, configure.env - Data: Add your websites to
data/websites.csv - Generate: Run
pnpm run generateto create all sites - Preview: Use
pnpm run previewto test locally - Deploy: Run
pnpm run deployto publish to Cloudflare Pages - Manage: Use
pnpm run dashboardfor ongoing management
website-generator/
βββ data/ # CSV data files
β βββ websites.csv # Your website data
β βββ sample-data.csv # Example data
βββ templates/ # Astro template projects
β βββ base-template/
β βββ agency-template/
β βββ ...
βββ packages/ # Core system packages
β βββ app-generator/ # Website generation engine
β βββ cf/ # Cloudflare deployment
β βββ dashboard/ # Next.js management UI
β βββ ...
βββ apps/ # Generated websites (created by system)
βββ reports/ # Deployment reports
βββ logs/ # System logs
Create unique content variations using spintax syntax:
<h1>[[Professional|Expert|Certified]] {{service_name}} Services</h1>Use CSV data tokens throughout templates:
<h1>Welcome to {{name}}</h1>
<p>Contact us at {{phone}} or {{email}}</p>
<p>Located in {{city}}, {{state}}</p>Control variation probability:
[[Emergency~3|Urgent~2|Fast~1]] Service Available- Template not found: Ensure template name in CSV matches folder in
templates/ - Deployment fails: Check
.envfile has valid Cloudflare credentials - Tokens not replacing: Verify token names match CSV column names exactly
- Build fails: Check logs in
logs/general/directory
- Check
logs/general/for detailed error logs - View deployment reports in
reports/*/deploy/ - Use the dashboard for visual debugging
- Complete User Guide: Detailed usage instructions
- Technical Architecture Guide: System architecture and development
- Template Development Guide: Creating custom templates
- Environment Variables: Never commit your
.envfile to version control - Domain Matching: Domain names in commands must exactly match CSV entries
- Template Names: Template names are case-sensitive and must match folder names
- CSV Format: Address column must be valid JSON string
- GitHub Repository: rejoan121615/website-generator
- Issues: Report bugs or request features via GitHub Issues
- Documentation: Check the
guidelines/directory for detailed guides
System Version: 1.0.0
Compatible with: Node.js 22+, PNPM 10+
Last Updated: January 2025