# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
**Hello World** is a simple, beautiful task manager built with Skykit. Users can sign in with their Skyscape account and manage their to-do lists with priorities.
## Development Commands
```bash
# Run locally (uses port 5000 by default, or PORT env var)
go run .
# Run on a different port (macOS uses 5000 for AirTunes)
PORT=8080 go run .
# Build
go build -o helloworld .
```
## Architecture
### Project Structure
```
hellow0rld/
├── main.go # Application entry point
├── controllers/
│ └── tasks.go # Task CRUD, auth middleware
├── models/
│ ├── database.go # Database connection
│ └── task.go # Task model and helpers
└── views/
├── home.html # Landing page (sunset theme)
└── tasks.html # Task management (HTMX-powered)
```
### Models
**Task** - User's todo items:
```go
type Task struct {
skykit.Model
OwnerID string // User ID
Title string // Task description
Completed bool // Completion status
Priority int // 0=normal, 1=high, 2=urgent
}
```
### Routes
| Route | Method | Handler | Purpose |
|-------|--------|---------|---------|
| `/` | GET | home.html | Landing page |
| `/tasks` | GET | tasks.html | Task list (requires auth) |
| `/tasks` | POST | createTask | Add new task |
| `/tasks/{id}/toggle` | POST | toggleTask | Toggle completion |
| `/tasks/{id}/delete` | POST | deleteTask | Remove task |
| `/tasks/{id}/edit` | POST | editTask | Update task |
### Controller Template Methods
Available in views via `{{tasks.Method}}`:
| Method | Returns | Description |
|--------|---------|-------------|
| `AllTasks` | `[]*Task` | All user tasks |
| `PendingTasks` | `[]*Task` | Incomplete tasks (sorted by priority) |
| `CompletedTasks` | `[]*Task` | Completed tasks (sorted by date) |
| `PendingCount` | `int` | Number of pending tasks |
| `CompletedCount` | `int` | Number of completed tasks |
## Design
- **Theme**: DaisyUI "sunset" (warm orange/coral on dark)
- **Font**: Outfit (Google Fonts)
- **Features**: HTMX for instant updates, glassmorphism cards, hover animations
## Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| `PORT` | No | Server port (default: 5000) |
| `DB_NAME` | For replica | Database name |
| `DB_URL` | For replica | LibSQL primary URL |
| `DB_TOKEN` | For replica | Database JWT token |
| `APP_ID` | OAuth | OAuth client ID |
| `OAUTH_CLIENT_SECRET` | OAuth | OAuth client secret |
## Key Patterns
1. **IDs are strings** - UUIDs auto-generated
2. **SQL uses PascalCase** - `WHERE OwnerID = ?`
3. **Tasks sorted by priority** - Urgent > High > Normal
4. **HTMX boost enabled** - Fast navigation without full reloads