aboutsummaryrefslogtreecommitdiffhomepage
path: root/CLAUDE.md
blob: 13faf40a8b368230119b11ccaf9aba768348f315 (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
# CLAUDE.md

## Project Overview

Feedaka is a personal RSS/Atom feed reader. Monorepo with a Go backend and React/TypeScript frontend, communicating via REST API.

## Tech Stack

- **Backend:** Go 1.24+, Echo v4, oapi-codegen (OpenAPI server stubs), SQLite with sqlc
- **Frontend:** React 19, TypeScript, Vite, Tailwind CSS, openapi-fetch (REST client), wouter (routing)
- **API Schema:** TypeSpec → OpenAPI 3.x → oapi-codegen (Go) + openapi-typescript (TS)
- **Task Runner:** [just](https://github.com/casey/just) (justfiles at root and `backend/`)
- **Linting/Formatting:** Biome (frontend), go fmt (backend)
- **Code Generation:** TypeSpec + oapi-codegen + openapi-typescript + sqlc

## Common Commands

### Build & Dev

```sh
just build       # Build both frontend and backend
just dev         # Start dev servers (frontend + backend)
just fmt         # Format all code
just check       # Type-check all code
just generate    # Regenerate API and DB code (TypeSpec → OpenAPI → Go/TS)
```

### Frontend (run from `frontend/`)

```sh
npm run build    # Build with TypeScript + Vite
npm run dev      # Start Vite dev server
npm run check    # Run Biome checks
npm run fix      # Auto-fix with Biome
npm run generate # Generate TypeScript types from OpenAPI
```

### Backend (run from `backend/`)

```sh
just build       # Compile Go binary
just fmt         # go fmt
just check       # Verify build compiles
just generate    # Run go generate (oapi-codegen + sqlc)
```

## Code Generation

Generated files — do not edit by hand:

- `openapi/openapi.yaml` — TypeSpec output (OpenAPI 3.x)
- `backend/api/generated.go` — oapi-codegen output (Echo server stubs + models)
- `backend/db/users.sql.go`, `backend/db/articles.sql.go`, `backend/db/feeds.sql.go` — sqlc output
- `frontend/src/api/generated.d.ts` — openapi-typescript output

Regenerate with `just generate` from the repo root.

## Project Structure

```
typespec/
  main.tsp                # API schema definition (source of truth)
  tspconfig.yaml          # TypeSpec compiler config
openapi/
  openapi.yaml            # Generated OpenAPI 3.x spec
backend/
  cmd/                    # CLI commands (serve, migrate, create-user)
  api/                    # REST API handlers + generated server stubs
  db/                     # Database layer, migrations, sqlc queries
  feed/                   # Feed fetching logic
  auth/                   # Authentication
  config/                 # Configuration
  context/                # Context helpers
  sqlc.yaml               # sqlc config
frontend/
  src/
    api/                  # Generated TypeScript types
    components/           # React components
    pages/                # Page components
    contexts/             # React contexts (auth)
    hooks/                # Custom hooks
    services/             # API client setup
  biome.json              # Biome config
```

## CI

CI (`just check`, `just build`, `just fmt`) runs on pushes and PRs to main. Formatting changes must be committed before pushing — CI fails if `just fmt` produces uncommitted changes.