Getting Started Guide
Getting Started Guide
This guide will help you set up your development environment and get started with the theme.
Quick Start
Prerequisites
- Node.js 18+ or Bun 1.0+
- Docker (recommended)
- Git
- Code editor (VS Code recommended)
Installation
-
Clone the Repository
git clone https://github.com/your-org/theme-name.git cd theme-name
-
Using Docker (Recommended)
# Start development environment docker compose up -d # View logs (optional) docker compose logs -f # Stop environment docker compose down
-
Local Development
# Install dependencies bun install # Start development server bun run dev
-
Access the Site
- Development: http://localhost:4322
- Documentation: http://localhost:4322/showcase
Development Environment
Docker Setup
We use Docker for consistent development environments:
# docker-compose.yml
services:
app:
build:
context: .
target: development
ports:
- "4322:4322"
volumes:
- .:/app
- node_modules:/app/node_modules
Development Commands
# Add a new UI component
docker compose exec app bun run ui:add button
# Run tests
docker compose exec app bun run test
# Build for production
docker compose exec app bun run build
Local Setup
If you prefer local development:
-
Environment Variables
# Copy example env cp .env.example .env
-
IDE Setup (VS Code)
// Recommended extensions { "recommendations": [ "astro-build.astro-vscode", "bradlc.vscode-tailwindcss", "dbaeumer.vscode-eslint" ] }
-
Development Commands
# Start dev server bun run dev # Type checking bun run typecheck # Linting bun run lint
Project Structure
src/
├── components/ # UI Components
│ ├── ui/ # Base UI components
│ ├── layout/ # Layout components
│ └── forms/ # Form components
├── content/ # Content collections
│ ├── posts/ # Blog posts
│ └── showcase/ # Documentation
├── styles/ # Global styles
│ └── tokens/ # Design tokens
└── types/ # TypeScript types
Configuration Files
1. TypeScript (tsconfig.json
)
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
}
}
2. Tailwind (tailwind.config.mjs
)
export default {
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
theme: {
extend: {
// Theme extensions
}
}
}
3. Astro (astro.config.mjs
)
export default defineConfig({
integrations: [
react(),
tailwind(),
mdx()
],
output: 'static'
})
Development Workflow
-
Start Development
# With Docker docker compose up -d # Local bun run dev
-
Adding Components
# Add shadcn/ui component bun run ui:add button # Create custom component touch src/components/ui/MyComponent.tsx
-
Content Updates
# Add new post touch src/content/posts/my-post.mdx # Add documentation touch src/content/showcase/my-guide.mdx
-
Testing Changes
# Type checking bun run typecheck # Run tests bun run test # Build check bun run build
Common Tasks
Adding a New Page
-
Create the page:
touch src/pages/my-page.astro
-
Basic page structure:
--- import BaseLayout from '@/layouts/BaseLayout.astro'; --- <BaseLayout title="My Page"> <main class="container"> <h1>My Page</h1> </main> </BaseLayout>
Creating a New Component
-
Create component file:
touch src/components/ui/MyComponent.tsx
-
Component template:
import { cn } from "@/lib/utils"; interface Props { className?: string; } export function MyComponent({ className }: Props) { return ( <div className={cn("base-styles", className)}> {/* Content */} </div> ); }
Adding Content
-
Create content file:
touch src/content/posts/my-post.mdx
-
Content template:
--- title: "My Post" description: "Post description" publicationDate: 2025-01-19 --- # My Post Content goes here...
Build & Deployment
Production Build
# Build the site
bun run build
# Preview build
bun run preview
Environment Variables
Required environment variables:
# Required
PUBLIC_SITE_URL=https://example.com
# Optional
PUBLIC_GA_ID=G-XXXXXXXXXX
Troubleshooting
Common Issues
-
Build Errors
- Check Node.js/Bun version
- Verify all dependencies are installed
- Run
bun install
to refresh dependencies
-
Type Errors
- Run
bun run typecheck
for detailed errors - Check import paths and types
- Verify component props
- Run
-
Docker Issues
- Ensure Docker is running
- Try rebuilding:
docker compose build --no-cache
- Check container logs:
docker compose logs
Getting Help
- Check documentation in
/showcase
- Search GitHub issues
- Create a new issue with:
- Environment details
- Steps to reproduce
- Expected vs actual behavior
Next Steps
- Review the Theme System Guide
- Explore Component Variants
- Read the Module System Guide
- Check Token System documentation
development
documentation
setup