Skip to content
/ one Public template

Build AI powered websites with Astro, Shadcn and Vercel AI SDK

License

Notifications You must be signed in to change notification settings

one-ie/one

Repository files navigation

πŸš€ ONE - Build Your AI Brand

ONE is a modern web and AI agent development toolkit that combines the blazing-fast performance of Astro with the elegant components of Shadcn/UI. This enterprise-class starter kit empowers developers to build AI-powered applications with:

  • ⚑ High Performance: Astro's partial hydration ensures minimal JavaScript
  • 🎨 Beautiful UI: Pre-configured Shadcn components with full TypeScript support
  • πŸ€– AI Integration: Built-in tools for AI-powered features and automation
  • πŸ“± Responsive Design: Mobile-first approach with Tailwind CSS
  • πŸ”’ Type Safety: Full TypeScript support throughout the codebase
  • πŸ› οΈ Developer Experience: Hot reloading, intuitive project structure, and comprehensive documentation

Perfect for building modern web applications, from simple landing pages to complex AI-powered platforms.

ONE Screenshot

⚑ Quick Start

This guide will help you set up and start building AI-powered applications with ONE. ONE combines Astro, React, and modern AI capabilities to create intelligent web applications.

Prerequisites

Before you begin, ensure you have:

  • Node.js 18 or higher installed
  • pnpm package manager (npm install -g pnpm)
  • An OpenAI API key (for AI capabilities)
  • Basic knowledge of Astro and React

Quick Start

1. Get the Project πŸš€

Choose your preferred way to get started with ONE:

πŸ“¦ Option 1: Clone the Repository
git clone https://github.com/one-ie/one.git
cd one
πŸ’Ύ Option 2: Download ZIP
  1. Download the ZIP file: Download ONE
  2. Extract the contents
  3. Navigate to the project directory
πŸ”„ Option 3: Fork the Repository
  1. Visit the Fork page
  2. Create your fork
  3. Clone your forked repository

☁️ Quick Start with GitHub Codespaces

Open in GitHub Codespaces

Click the button above to instantly start developing in a cloud environment.

2. Install Dependencies

# Navigate to project directory
cd one

# Install dependencies
pnpm install

3. Configure Environment Variables

Make a copy .env.example file in located at the top level of your project and call it .env

Add the keys to

OPENAI_API_KEY=your_api_key_here

4. Start Development Server

pnpm dev

Visit http://localhost:4321 to see your application running.

Project Structure

one/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/     # UI components
β”‚   β”œβ”€β”€ layouts/       # Page layouts
β”‚   β”œβ”€β”€ pages/         # Routes and pages
β”‚   β”œβ”€β”€ content/       # Markdown content
β”‚   └── styles/        # Global styles
└── public/           # Static assets

Adding AI Chat to a Page

  1. Create a new page (e.g., src/pages/chat.astro):
---
import Layout from "../layouts/Layout.astro";
import { ChatConfigSchema } from '../schema/chat';

const chatConfig = ChatConfigSchema.parse({
  systemPrompt: [{
    type: "text",
    text: "You are a helpful assistant."
  }],
  welcome: {
    message: "πŸ‘‹ How can I help you today?",
    avatar: "/icon.svg",
    suggestions: [
      {
        label: "Get Started",
        prompt: "How do I get started with ONE?"
      }
    ]
  }
});
---

<Layout 
  title="Chat Page"
  chatConfig={chatConfig}
  rightPanelMode="quarter"
>
  <main>
    <h1>Welcome to the Chat</h1>
    <!-- Your page content here -->
  </main>
</Layout>

Customizing the Chat Interface

Chat Configuration Options

const chatConfig = {
  provider: "openai",          // AI provider
  model: "gpt-4o-mini",       // Model to use
  apiEndpoint: "https://api.openai.com/v1",
  temperature: 0.7,           // Response creativity (0-1)
  maxTokens: 2000,           // Maximum response length
  systemPrompt: "...",       // AI behavior definition
  welcome: {
    message: "...",          // Welcome message
    avatar: "/path/to/icon.svg",
    suggestions: [...]       // Quick start prompts
  }
};

Panel Modes

The chat interface can be displayed in different modes:

  • quarter: 25% width side panel
  • half: 50% width side panel
  • full: Full screen chat
  • floating: Floating chat window
  • icon: Minimized chat button

Adding Page-Specific Knowledge

Make your AI assistant knowledgeable about specific pages:

---
const pageContent = "Your page content here";

const chatConfig = ChatConfigSchema.parse({
  systemPrompt: [{
    type: "text",
    text: `You are an expert on ${pageContent}. Help users understand this content.`
  }],
  // ... other config options
});
---

Basic Customization

1. Styling

Customize the appearance using Tailwind CSS classes:

/* src/styles/global.css */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Your custom styles here */

2. Layout

Adjust the layout using the Layout component props:

<Layout
  title="Your Page"
  description="Page description"
  header={true}        // Show/hide header
  footer={true}        // Show/hide footer
  rightPanelMode="quarter"
>
  <!-- Your content -->
</Layout>

3. Chat Features

Enable or disable specific chat features:

const chatConfig = ChatConfigSchema.parse({
  // ... other options
  features: {
    textToSpeech: true,    // Enable voice synthesis
    codeHighlight: true,   // Enable code syntax highlighting
    markdown: true,        // Enable markdown rendering
    suggestions: true      // Enable quick suggestions
  }
});

🎨 Pre-installed Components

All Shadcn/UI components are pre-configured for Astro:

---
// Example usage in .astro file
import { Button } from "@/components/ui/button"
import { Card } from "@/components/ui/card"
---

<Button>Click me!</Button>

Available Components

  • βœ… Accordion
  • βœ… Alert Dialog
  • βœ… Avatar
  • βœ… Badge
  • βœ… Button
  • βœ… Card
  • βœ… Dialog
  • ... and more!

πŸ› οΈ Project Structure

src/
β”œβ”€β”€ components/                # UI Components
β”‚   β”œβ”€β”€ ui/                   # Shadcn/UI components
β”‚   β”œβ”€β”€ chat/                 # Chat-related components
β”‚   └── magicui/              # Enhanced UI components
β”‚
β”œβ”€β”€ content/                  # Content Collections
β”‚   β”œβ”€β”€ blog/                 # Blog posts
β”‚   β”œβ”€β”€ docs/                 # Documentation
β”‚   └── prompts/              # AI prompts
β”‚
β”œβ”€β”€ hooks/                    # React hooks
β”‚   β”œβ”€β”€ use-mobile.tsx
β”‚   β”œβ”€β”€ use-theme.ts
β”‚   └── use-toast.ts
β”‚
β”œβ”€β”€ layouts/                  # Page layouts
β”‚   β”œβ”€β”€ Blog.astro
β”‚   β”œβ”€β”€ Docs.astro
β”‚   β”œβ”€β”€ Layout.astro
β”‚   └── LeftRight.astro
β”‚
β”œβ”€β”€ lib/                      # Utility functions
β”‚   β”œβ”€β”€ utils.ts
β”‚   └── icons.ts
β”‚
β”œβ”€β”€ pages/                    # Routes and pages
β”‚   β”œβ”€β”€ api/                  # API endpoints
β”‚   β”œβ”€β”€ blog/                 # Blog routes
β”‚   β”œβ”€β”€ docs/                 # Documentation routes
β”‚   └── index.astro          # Homepage
β”‚
β”œβ”€β”€ schema/                   # Data schemas
β”‚   └── chat.ts              # Chat-related schemas
β”‚
β”œβ”€β”€ stores/                   # State management
β”‚   └── layout.ts            # Layout state
β”‚
β”œβ”€β”€ styles/                   # Global styles
β”‚   └── global.css           # Global CSS
β”‚
└── types/                    # TypeScript types
    └── env.d.ts             # Environment types

πŸš€ Development Workflow

  1. Start Development

    npm run dev
  2. Using React Components in Astro

    ---
    // Always add client:load for interactive components
    import { Dialog } from "@/components/ui/dialog"
    ---
    
    <Dialog client:load>
      <!-- Dialog content -->
    </Dialog>
  3. Build for Production

    npm run build
    npm run preview # Test the production build

πŸ” Troubleshooting

Common Issues Solved

βœ… Component Hydration: All interactive components use client:load βœ… Build Warnings: Suppressed in configuration βœ… Path Aliases: Pre-configured for easy imports βœ… React Integration: Properly set up for Shadcn

πŸ’‘ Pro Tips

  1. Component Usage in Astro

    ---
    // Always import in the frontmatter
    import { Button } from "@/components/ui/button"
    ---
    
    <!-- Use in template -->
    <Button client:load>Click me!</Button>
  2. Styling with Tailwind

    <div class="dark:bg-slate-800">
      <Button class="m-4">Styled Button</Button>
    </div>
  3. Layout Usage

    ---
    import Layout from '../layouts/Layout.astro';
    ---
    
    <Layout title="Home">
      <!-- Your content -->
    </Layout>

πŸ“š Quick Links

🀝 Need Help?


Built with πŸš€ Astro, 🎨 Shadcn/UI and Vercel AI SDK by ONE