Skip to content

Swakhar/onepager-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OnePager Starter (Next.js + Tailwind + Supabase)

A production-ready one-page website builder with AI-powered design features.

✨ Features

  • Next.js + TypeScript - Modern React framework with type safety
  • Tailwind CSS - Utility-first styling
  • Supabase Integration - Authentication & database (or localStorage fallback)
  • Multiple Templates - Business card, portfolio, resume, and more
  • AI Visual Builder - ChatGPT-like design commands, screenshot analysis, style transfer
  • Smart Suggestions - Expert UX/UI improvements with WCAG compliance
  • Voice Commands - Design with your voice
  • Before/After Comparison - Compare and restore AI changes
  • Keyboard Shortcuts - Power user friendly
  • Export Options - HTML, React, Vue, Angular, Svelte

πŸš€ Quickstart

1. Install Dependencies

npm install

2. Set Up Environment Variables

Create .env.local in project root:

NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
OPENAI_API_KEY=your-openai-api-key

3. Run Development Server

npm run dev

Open http://localhost:3000 to see your app!

πŸ“ Project Structure

pages/
β”œβ”€β”€ index.tsx              # Landing page
β”œβ”€β”€ editor.tsx             # Main editor workspace
β”œβ”€β”€ dashboard.tsx          # User dashboard
β”œβ”€β”€ templates.tsx          # Template gallery
└── api/                   # API routes
    └── ai/                # AI features
        β”œβ”€β”€ visual-builder.ts           # Main AI router (67 lines)
        └── helpers/                    # Modular helpers
            β”œβ”€β”€ prompts.ts              # AI prompts
            β”œβ”€β”€ design-audit.ts         # WCAG checks
            β”œβ”€β”€ screenshot-analyzer.ts  # Image analysis
            β”œβ”€β”€ style-transfer.ts       # Style transfer
            β”œβ”€β”€ natural-command.ts      # Command processing
            └── smart-suggestions.ts    # UX suggestions

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ editor/
β”‚   β”‚   β”œβ”€β”€ VisualAIBuilder.tsx        # Main AI component (438 lines)
β”‚   β”‚   β”œβ”€β”€ AIAssistant.tsx            # AI chat assistant
β”‚   β”‚   β”œβ”€β”€ ImageSuggestions.tsx       # Image recommendations
β”‚   β”‚   └── ai-builder/                # Mode components
β”‚   β”‚       β”œβ”€β”€ NaturalCommandMode.tsx
β”‚   β”‚       β”œβ”€β”€ ScreenshotMode.tsx
β”‚   β”‚       β”œβ”€β”€ StyleTransferMode.tsx
β”‚   β”‚       β”œβ”€β”€ SmartSuggestionsMode.tsx
β”‚   β”‚       └── BeforeAfterComparison.tsx
β”‚   β”œβ”€β”€ templates/         # Template components
β”‚   └── ui/                # Reusable UI components
β”œβ”€β”€ hooks/                 # Custom React hooks
β”‚   β”œβ”€β”€ useVoiceCommand.ts
β”‚   β”œβ”€β”€ useCommandHistory.ts
β”‚   β”œβ”€β”€ useSnapshot.ts
β”‚   └── useKeyboardShortcuts.ts
β”œβ”€β”€ lib/                   # Utilities
β”œβ”€β”€ types/                 # TypeScript types
└── config/                # Configuration files

πŸ“š Documentation

Core Documentation

🎨 AI Visual Builder

The AI Visual Builder provides 4 powerful modes:

1. Natural Commands (ChatGPT-like)

"Make it blue"
"Change hero title to 'Welcome to my portfolio'"
"Remove the about section"
"Reorder sections: hero, projects, contact"

2. Screenshot Analysis

  • Upload any website screenshot
  • AI extracts colors, fonts, layout patterns
  • One-click apply to your design
  • Cost: ~$0.01 per screenshot (GPT-4o-mini vision)

3. Style Transfer

  • Upload a reference design
  • Choose what to transfer (colors, fonts, layout, spacing)
  • AI adapts style to your template
  • Works with ANY website screenshot

4. Smart Suggestions

  • AI analyzes your design
  • WCAG compliance checks (contrast, readability)
  • Expert UX/UI improvements
  • One-click apply suggestions
  • Cost: ~$0.002 per analysis (GPT-3.5-turbo)

All modes include:

  • βͺ Before/After comparison with restore
  • 🎀 Voice commands (browser-supported)
  • πŸ“ Command history and favorites
  • ⚑ Real-time preview updates

πŸ§ͺ Testing Checklist

Before deploying, test these core features:

  • Create new site from template
  • Edit content in panels
  • Use natural command: "Make it blue"
  • Upload screenshot and analyze
  • Transfer style from reference
  • Generate smart suggestions
  • Compare before/after and restore
  • Test voice commands (Chrome/Safari)
  • Export to HTML/React/Vue
  • Publish site and view preview

πŸ”§ Development

Key Files to Understand

Main Editor:

  • pages/editor.tsx - Editor workspace and layout
  • src/components/editor/VisualAIBuilder.tsx - AI builder orchestrator

Templates:

  • src/components/templates/ - All template components
  • src/config/templates.ts - Template registry

API Routes:

  • pages/api/ai/visual-builder.ts - Main AI router
  • pages/api/ai/helpers/ - Modular AI helpers

Custom Hooks:

  • src/hooks/useVoiceCommand.ts - Voice input
  • src/hooks/useCommandHistory.ts - History management
  • src/hooks/useSnapshot.ts - Before/after snapshots

Adding a New Template

  1. Create Template Component:

    // src/components/templates/my-template/index.tsx
    export const MyTemplate = ({ data, colors, fonts }) => {
      return <div>...</div>
    }
  2. Register Template:

    // src/config/templates.ts
    export const templates = [
      {
        id: 'my-template',
        name: 'My Template',
        description: 'Description here',
        category: 'business',
        component: MyTemplate
      }
    ]
  3. Add Template Purpose (for AI):

    // pages/api/ai/helpers/prompts.ts
    export function getTemplatePurpose(templateType: string): string {
      switch (templateType) {
        case 'my-template':
          return 'A professional template for XYZ with sections: hero, about, services'
        // ...
      }
    }
  4. Done! All AI modes automatically work with your new template.

Adding a New AI Mode

  1. Create Mode Component:

    // src/components/editor/ai-builder/MyNewMode.tsx
    interface MyNewModeProps {
      isProcessing: boolean
      onGenerate: () => void
      // ... other props
    }
    
    export const MyNewMode: React.FC<MyNewModeProps> = ({ ... }) => {
      return <div>Mode UI here</div>
    }
  2. Add to Main Component:

    // src/components/editor/VisualAIBuilder.tsx
    
    // Add to mode type
    type BuilderMode = 'screenshot' | 'style-transfer' | 'natural-command' | 'suggestions' | 'my-mode'
    
    // Add to mode selector
    { id: 'my-mode', label: 'πŸ†• My Mode', desc: 'Does cool stuff' }
    
    // Add to mode content
    {mode === 'my-mode' && <MyNewMode {...props} />}
  3. Add API Handler:

    // pages/api/ai/helpers/my-feature.ts
    export async function processMyFeature(params: any) {
      // Your logic here
    }
  4. Update Router:

    // pages/api/ai/visual-builder.ts
    case 'my-feature':
      return await processMyFeature(body)

πŸš€ Deployment

Vercel (Recommended)

  1. Push code to GitHub
  2. Import project in Vercel
  3. Add environment variables
  4. Deploy!

Other Platforms

Works with any Next.js hosting:

  • Netlify
  • AWS Amplify
  • Railway
  • Render

🀝 Contributing

Contributions welcome! Please read the documentation first to understand the architecture.

πŸ“„ License

MIT License - feel free to use for personal or commercial projects.


Built with ❀️ using Next.js, TypeScript, Tailwind CSS, and OpenAI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages