π 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.
β‘ 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
- Download the ZIP file: Download ONE
- Extract the contents
- Navigate to the project directory
π Option 3: Fork the Repository
- Visit the Fork page
- Create your fork
- Clone your forked repository
βοΈ Quick Start with 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
- 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 panelhalf
: 50% width side panelfull
: Full screen chatfloating
: Floating chat windowicon
: 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
-
Start Development
npm run dev
-
Using React Components in Astro
--- // Always add client:load for interactive components import { Dialog } from "@/components/ui/dialog" --- <Dialog client:load> <!-- Dialog content --> </Dialog>
-
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
-
Component Usage in Astro
--- // Always import in the frontmatter import { Button } from "@/components/ui/button" --- <!-- Use in template --> <Button client:load>Click me!</Button>
-
Styling with Tailwind
<div class="dark:bg-slate-800"> <Button class="m-4">Styled Button</Button> </div>
-
Layout Usage
--- import Layout from '../layouts/Layout.astro'; --- <Layout title="Home"> <!-- Your content --> </Layout>
π Quick Links
π€ Need Help?
- Join Astro Discord
- Check Astro Documentation
- File an Issue on GitHub
AI Book Generation with Pandoc
ONE includes powerful book generation capabilities that combine Astroβs content collections with Pandoc to create beautifully formatted ebooks. This system allows you to:
- Manage book content through Astroβs content collections
- Generate professional EPUB files with proper metadata
- Maintain consistent styling across formats
- Automate the book generation process
Book Content Structure
src/content/book/
βββ chapters/ # Book chapters in markdown
βββ assets/ # Images and resources
βββ epub-style.css # EPUB-specific styling
βββ config.ts # Book configuration
Book Schema Configuration
// src/content/config.ts
const BookSchema = z.object({
...CommonFields,
author: z.string(),
language: z.string(),
publisher: z.string(),
rights: z.string(),
identifier: z.object({
scheme: z.string(),
text: z.string()
}),
creator: z.string(),
contributor: z.string(),
subject: z.string(),
css: z.string().optional(),
coverImage: z.string().optional(),
chapter: z.number().optional(),
order: z.number().optional(),
status: z.enum(['draft', 'review', 'published']).default('draft')
});
EPUB Generation
-
Install Pandoc
# macOS brew install pandoc # Ubuntu/Debian sudo apt-get install pandoc
-
Generate EPUB
pandoc \ --resource-path=.:assets \ --toc \ --toc-depth=2 \ --split-level=1 \ --css=epub-style.css \ --epub-cover-image=assets/cover.png \ -o output.epub \ chapters/*.md
EPUB Styling
/* src/content/book/epub-style.css */
body {
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
line-height: 1.5;
color: #333;
margin: 0;
padding: 1em;
}
h1, h2, h3, h4, h5, h6 {
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
color: #000;
margin-top: 1.5em;
margin-bottom: 0.5em;
line-height: 1.2;
}
Features
- β Content management through Astro collections
- β Automatic table of contents generation
- β Custom styling with CSS
- β Cover image support
- β Proper metadata handling
- β Chapter organization
- β Resource management
- β Multiple output formats
Best Practices
-
Content Organization
- Use clear chapter naming conventions
- Maintain consistent formatting
- Keep images in the assets directory
- Use relative paths for resources
-
Metadata Management
- Define comprehensive book metadata
- Include all required fields
- Use proper identifiers (ISBN, etc.)
- Maintain copyright information
-
Styling
- Use system fonts for best compatibility
- Define consistent typography
- Ensure proper spacing
- Test on multiple devices
-
Build Process
- Automate EPUB generation
- Implement version control
- Add build scripts to package.json
- Include validation steps
For more details and advanced features, check out the book generation documentation.
Built with π Astro, π¨ Shadcn/UI and Vercel AI SDK by ONE