summaryrefslogtreecommitdiff
path: root/PROJECT_SUMMARY.md
blob: de7cd00bb4db051469533c7f176ae72424d3b664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# Project Summary

## What This Is

A **unified personal dashboard** that aggregates your productivity data into one place:
- 📋 **Trello boards** (your primary task system)
- ✓ **Todoist tasks**
- 📝 **Obsidian notes** (optional)
- 🍽️ **PlanToEat meals** (optional)

Plus a dedicated **AI agent API** for Claude.ai to access your data.

## Current Status: ✅ Phase 1 Complete

### What Works
- ✅ Trello integration (all boards + cards)
- ✅ Todoist integration (tasks + projects)
- ✅ Obsidian integration (20 most recent notes)
- ✅ PlanToEat integration (optional - API not public)
- ✅ Mobile-responsive web UI
- ✅ SQLite caching (5-min TTL)
- ✅ Auto-refresh (5 min)
- ✅ AI agent endpoint (`/api/claude/snapshot`)
- ✅ Full test coverage (9/9 tests passing)

### Statistics
- **Binary size:** 17MB
- **Code:** 2,667 lines
- **Dependencies:** chi router, sqlite3, Go 1.21+
- **Tests:** 5 unit tests, 4 acceptance tests

## Quick Start

### 1. Get API Keys (5 minutes)

**Todoist:**
1. Go to https://todoist.com/app/settings/integrations
2. Copy API token

**Trello:**
1. Go to https://trello.com/power-ups/admin
2. Create a Power-Up
3. Go to **API Key** tab → Generate new API key (NOT Secret!)
4. Follow "testing/for-yourself" instructions → Click **Token** link
5. Copy both API Key + Token

### 2. Configure

```bash
cp .env.example .env
# Edit .env:
TODOIST_API_KEY=your_todoist_token
TRELLO_API_KEY=your_trello_key
TRELLO_TOKEN=your_trello_token
```

### 3. Run

```bash
go run cmd/dashboard/main.go
```

### 4. Open

http://localhost:8080

**That's it!** 🎉

## Documentation

- **[QUICKSTART.md](QUICKSTART.md)** - Get running in 5 minutes
- **[SETUP_GUIDE.md](SETUP_GUIDE.md)** - Detailed setup instructions
- **[AI_AGENT_SETUP.md](AI_AGENT_SETUP.md)** - Claude.ai integration guide
- **[CLAUDE.md](CLAUDE.md)** - For future Claude Code instances
- **[README.md](README.md)** - Full project documentation

## Architecture

### Request Flow
```
Browser → chi Router → Handler
                         ↓
              Check SQLite Cache (5min TTL)
                         ↓
           Fresh? → Return cached data
           Stale? → Fetch from APIs in parallel
                    ↓
         Trello + Todoist + Obsidian + PlanToEat
                    ↓
              Save to cache → Return data
```

### Key Files
```
cmd/dashboard/main.go              Entry point
internal/
  ├── api/                         API clients
  │   ├── trello.go               Trello (PRIORITY)
  │   ├── todoist.go              Todoist tasks
  │   ├── obsidian.go             Markdown notes
  │   └── plantoeat.go            Meal planning
  ├── handlers/
  │   ├── handlers.go             Web handlers
  │   └── ai_handlers.go          AI endpoint
  ├── middleware/
  │   └── ai_auth.go              Bearer token auth
  ├── config/config.go            Environment config
  └── store/sqlite.go             Database ops
web/
  ├── templates/index.html        Dashboard UI
  └── static/                     CSS/JS
```

## API Endpoints

### Web Dashboard
- `GET /` - Main dashboard view
- `POST /api/refresh` - Force refresh all data
- `GET /api/tasks` - Tasks JSON
- `GET /api/notes` - Notes JSON
- `GET /api/meals` - Meals JSON
- `GET /api/boards` - Trello boards JSON

### AI Agent
- `GET /api/claude/snapshot` - AI-optimized JSON
  - Auth: `Authorization: Bearer <token>`
  - Returns: tasks (today/overdue/week), meals (7 days), notes (10 recent), all Trello boards

## What's Optional

### Optional Features
- **PlanToEat:** API not publicly available - leave blank
- **Obsidian:** Only if you use Obsidian notes
- **AI Access:** Only if you want Claude.ai integration

### Required Features
- **Todoist:** Yes - tasks integration
- **Trello:** Yes - your primary task system

## Configuration

All via `.env` file:

```bash
# Required
TODOIST_API_KEY=...
TRELLO_API_KEY=...
TRELLO_TOKEN=...

# Optional
OBSIDIAN_VAULT_PATH=/path/to/vault
AI_AGENT_API_KEY=...

# Server (with defaults)
PORT=8080
CACHE_TTL_MINUTES=5
DEBUG=false
```

## Development

### Run Tests
```bash
go test ./...
```

### Build Binary
```bash
go build -o dashboard cmd/dashboard/main.go
```

### Run with Live Reload
```bash
go install github.com/cosmtrek/air@latest
air
```

## For Claude.ai

### Setup
1. Generate API key: `openssl rand -hex 32`
2. Add to `.env`: `AI_AGENT_API_KEY=...`
3. Share with Claude:
   - URL: `http://localhost:8080/api/claude/snapshot`
   - Token: (your key)

### Usage Examples
- "What tasks do I have today?"
- "What's for dinner?"
- "Show me my overdue items"
- "What have I been working on?"

Claude fetches your dashboard and answers naturally.

## Troubleshooting

### "TODOIST_API_KEY is required"
Make sure `.env` has all three required keys:
```bash
TODOIST_API_KEY=something
TRELLO_API_KEY=something
TRELLO_TOKEN=something
```

### "No boards showing"
- Check Trello credentials at https://trello.com/power-ups/admin
- Need **both** API key (from Power-Up's API Key tab) and token (click "Token" link)

### "PlanToEat not working"
- Expected - API not public
- Just leave `PLANTOEAT_API_KEY` empty
- Dashboard works fine without it

## What's Next

### Phase 2 (Future)
- Create tasks via AI
- Mark tasks complete
- Quick note capture
- Create Trello cards

### Phase 3 (Future)
- Unified search
- Daily digest
- PWA support
- Rate limiting for AI

## License

MIT License - personal use project

## Support

- Check logs: Terminal where you ran `go run cmd/dashboard/main.go`
- Test endpoints: `curl http://localhost:8080/api/tasks`
- Verify API keys: Try them directly in curl (see SETUP_GUIDE.md)

---

**Built with:** Go 1.21+ • SQLite • chi router • Tailwind CSS • HTMX

**Last Updated:** January 2026