···48484949# Development files
5050known-dids.txt
5151+5252+node_modules
5353+web/static/app/assets
+1
BACKLOG.md
···1616 - Private mode -- don't show in community feed (records are still public via pds api though)
1717 - Dev mode -- show did, copy did in profiles (remove "logged in as <did>" from home page)
1818 - Toggle for table view vs future post-style view
1919+ - Toggle for "for" and "at" in pours view
19202021## Far Future Considerations
2122
+4-4
CLAUDE.md
···1414## Project Structure
15151616```
1717-cmd/server/main.go # Application entry point
1717+cmd/arabica-server/main.go # Application entry point
1818internal/
1919 atproto/ # AT Protocol integration
2020 client.go # Authenticated PDS client (XRPC calls)
···112112113113```bash
114114# Run server (uses firehose mode by default)
115115-go run cmd/server/main.go
115115+go run cmd/arabica-server/main.go
116116117117# Backfill known DIDs on startup
118118-go run cmd/server/main.go --known-dids known-dids.txt
118118+go run cmd/arabica-server/main.go --known-dids known-dids.txt
119119120120# Using nix
121121nix run
···130130### Build
131131132132```bash
133133-go build -o arabica cmd/server/main.go
133133+go build -o arabica cmd/arabica-server/main.go
134134```
135135136136## Command-Line Flags
+1-1
Dockerfile
···1414COPY . .
15151616# Build the binary
1717-RUN CGO_ENABLED=0 GOOS=linux go build -o arabica cmd/server/main.go
1717+RUN CGO_ENABLED=0 GOOS=linux go build -o arabica cmd/arabica-server/main.go
18181919# Runtime stage
2020FROM alpine:3.23
+215
MIGRATION.md
···11+# Alpine.js → Svelte Migration Complete! 🎉
22+33+## What Changed
44+55+The entire frontend has been migrated from Alpine.js + HTMX + Go templates to a **Svelte SPA**.
66+77+### Before
88+- **Frontend**: Go HTML templates + Alpine.js + HTMX
99+- **State**: Alpine global components + DOM manipulation
1010+- **Routing**: Server-side (Go mux)
1111+- **Data**: Mixed (HTMX partials + JSON API)
1212+1313+### After
1414+- **Frontend**: Svelte SPA (single-page application)
1515+- **State**: Svelte stores (reactive)
1616+- **Routing**: Client-side (navaid)
1717+- **Data**: JSON API only
1818+1919+## Architecture
2020+2121+```
2222+/
2323+├── cmd/arabica-server/main.go # Go backend entry point
2424+├── internal/ # Go backend (unchanged)
2525+│ ├── handlers/
2626+│ │ ├── handlers.go # Added /api/me and /api/feed-json
2727+│ │ └── ...
2828+│ └── routing/
2929+│ └── routing.go # Added SPA fallback route
3030+├── frontend/ # NEW: Svelte app
3131+│ ├── src/
3232+│ │ ├── App.svelte # Root component with router
3333+│ │ ├── main.js # Entry point
3434+│ │ ├── routes/ # Page components
3535+│ │ │ ├── Home.svelte
3636+│ │ │ ├── Login.svelte
3737+│ │ │ ├── Brews.svelte
3838+│ │ │ ├── BrewView.svelte
3939+│ │ │ ├── BrewForm.svelte
4040+│ │ │ ├── Manage.svelte
4141+│ │ │ ├── Profile.svelte
4242+│ │ │ ├── About.svelte
4343+│ │ │ ├── Terms.svelte
4444+│ │ │ └── NotFound.svelte
4545+│ │ ├── components/ # Reusable components
4646+│ │ │ ├── Header.svelte
4747+│ │ │ ├── Footer.svelte
4848+│ │ │ ├── FeedCard.svelte
4949+│ │ │ └── Modal.svelte
5050+│ │ ├── stores/ # Svelte stores
5151+│ │ │ ├── auth.js # Authentication state
5252+│ │ │ ├── cache.js # Data cache (replaces data-cache.js)
5353+│ │ │ └── ui.js # UI state (notifications, etc.)
5454+│ │ └── lib/
5555+│ │ ├── api.js # Fetch wrapper
5656+│ │ └── router.js # Client-side routing
5757+│ ├── index.html
5858+│ ├── vite.config.js
5959+│ └── package.json
6060+└── web/static/app/ # Built Svelte output (served by Go)
6161+```
6262+6363+## Development
6464+6565+### Run Frontend Dev Server (with hot reload)
6666+6767+```bash
6868+cd frontend
6969+npm install
7070+npm run dev
7171+```
7272+7373+Frontend runs on http://localhost:5173 with Vite proxy to Go backend
7474+7575+### Run Go Backend
7676+7777+```bash
7878+go run cmd/arabica-server/main.go
7979+```
8080+8181+Backend runs on http://localhost:18910
8282+8383+### Build for Production
8484+8585+```bash
8686+cd frontend
8787+npm run build
8888+```
8989+9090+This builds the Svelte app into `web/static/app/`
9191+9292+Then run the Go server normally:
9393+9494+```bash
9595+go run cmd/arabica-server/main.go
9696+```
9797+9898+The Go server will serve the built Svelte SPA from `web/static/app/`
9999+100100+## Key Features Implemented
101101+102102+### ✅ Authentication
103103+- Login with AT Protocol handle
104104+- Handle autocomplete
105105+- User profile dropdown
106106+- Persistent sessions
107107+108108+### ✅ Brews
109109+- List all brews
110110+- View brew details
111111+- Create new brew
112112+- Edit brew
113113+- Delete brew
114114+- Dynamic pours list
115115+- Rating slider
116116+117117+### ✅ Equipment Management
118118+- Tabs for beans, roasters, grinders, brewers
119119+- CRUD operations for all entity types
120120+- Inline entity creation from brew form
121121+- Tab state persisted to localStorage
122122+123123+### ✅ Social Feed
124124+- Community feed on homepage
125125+- Feed items with author info
126126+- Real-time updates (via API polling)
127127+128128+### ✅ Data Caching
129129+- Stale-while-revalidate pattern
130130+- localStorage persistence
131131+- Automatic invalidation on writes
132132+133133+## API Changes
134134+135135+### New Endpoints
136136+137137+- `GET /api/me` - Current user info
138138+- `GET /api/feed-json` - Feed items as JSON
139139+140140+### Existing Endpoints (unchanged)
141141+142142+- `GET /api/data` - All user data
143143+- `POST /api/beans`, `PUT /api/beans/{id}`, `DELETE /api/beans/{id}`
144144+- `POST /api/roasters`, `PUT /api/roasters/{id}`, `DELETE /api/roasters/{id}`
145145+- `POST /api/grinders`, `PUT /api/grinders/{id}`, `DELETE /api/grinders/{id}`
146146+- `POST /api/brewers`, `PUT /api/brewers/{id}`, `DELETE /api/brewers/{id}`
147147+- `POST /brews`, `PUT /brews/{id}`, `DELETE /brews/{id}`
148148+149149+### Deprecated Endpoints (HTML partials, no longer needed)
150150+151151+- `GET /api/feed` (HTML)
152152+- `GET /api/brews` (HTML)
153153+- `GET /api/manage` (HTML)
154154+- `GET /api/profile/{actor}` (HTML)
155155+156156+## Files to Delete (Future Cleanup)
157157+158158+These can be removed once you're confident the migration is complete:
159159+160160+```bash
161161+# Old Alpine.js JavaScript
162162+web/static/js/alpine.min.js
163163+web/static/js/manage-page.js
164164+web/static/js/brew-form.js
165165+web/static/js/data-cache.js
166166+web/static/js/handle-autocomplete.js
167167+168168+# Go templates (entire directory)
169169+templates/
170170+171171+# Template rendering helpers
172172+internal/bff/
173173+```
174174+175175+## Testing Checklist
176176+177177+- [ ] Login with AT Protocol handle
178178+- [ ] View homepage with feed
179179+- [ ] Create new brew with dynamic pours
180180+- [ ] Edit existing brew
181181+- [ ] Delete brew
182182+- [ ] Manage beans/roasters/grinders/brewers
183183+- [ ] Tab navigation with localStorage persistence
184184+- [ ] Inline entity creation from brew form
185185+- [ ] Navigate between pages (client-side routing)
186186+- [ ] Logout
187187+188188+## Browser Support
189189+190190+- Chrome/Edge (latest)
191191+- Firefox (latest)
192192+- Safari (latest)
193193+194194+## Performance
195195+196196+The Svelte bundle is **~136KB** (before gzip, ~35KB gzipped), which is excellent for a full-featured SPA.
197197+198198+Compared to Alpine.js (+ individual page scripts):
199199+- **Before**: ~50KB Alpine + ~20KB per page = 70-90KB
200200+- **After**: ~35KB gzipped for entire app
201201+202202+## Next Steps
203203+204204+1. Test thoroughly in development
205205+2. Deploy to production
206206+3. Monitor for any issues
207207+4. Delete old template files once confident
208208+5. Update documentation
209209+210210+## Notes
211211+212212+- OAuth flow still handled by Go backend
213213+- Sessions stored in BoltDB (unchanged)
214214+- User data stored in PDS via AT Protocol (unchanged)
215215+- All existing Go handlers remain functional
+3-3
README.md
···3232nix run
33333434# Or with Go
3535-go run cmd/server/main.go
3535+go run cmd/arabica-server/main.go
3636```
37373838Access at http://localhost:18910
···9393nix develop
94949595# Run server
9696-go run cmd/server/main.go
9696+go run cmd/arabica-server/main.go
97979898# Run tests
9999go test ./...
100100101101# Build
102102-go build -o arabica cmd/server/main.go
102102+go build -o arabica cmd/arabica-server/main.go
103103```
104104105105## Deployment
···11+<div class="max-w-4xl mx-auto">
22+ <div class="bg-white rounded-xl p-8 shadow-lg">
33+ <h1 class="text-3xl font-bold text-brown-900 mb-6">Terms of Service</h1>
44+55+ <div class="prose prose-brown max-w-none text-brown-800 space-y-4">
66+ <p class="text-sm text-brown-600 italic">
77+ Last updated: {new Date().toLocaleDateString()}
88+ </p>
99+1010+ <h2 class="text-2xl font-bold text-brown-900 mt-8">
1111+ 1. Acceptance of Terms
1212+ </h2>
1313+ <p>
1414+ By accessing and using Arabica, you accept and agree to be bound by the
1515+ terms and provision of this agreement.
1616+ </p>
1717+1818+ <h2 class="text-2xl font-bold text-brown-900 mt-8">
1919+ 2. Alpha Software Notice
2020+ </h2>
2121+ <p>
2222+ Arabica is currently in alpha testing. Features, data structures, and
2323+ functionality may change without notice. We recommend backing up your
2424+ data regularly.
2525+ </p>
2626+2727+ <h2 class="text-2xl font-bold text-brown-900 mt-8">3. Data Storage</h2>
2828+ <p>
2929+ Your brewing data is stored in your Personal Data Server (PDS) via the
3030+ AT Protocol. Arabica does not store your brewing records on its servers.
3131+ You are responsible for the security and backup of your PDS.
3232+ </p>
3333+3434+ <h2 class="text-2xl font-bold text-brown-900 mt-8">
3535+ 4. User Responsibilities
3636+ </h2>
3737+ <p>
3838+ You are responsible for maintaining the confidentiality of your account
3939+ credentials and for all activities that occur under your account.
4040+ </p>
4141+4242+ <h2 class="text-2xl font-bold text-brown-900 mt-8">
4343+ 5. Limitation of Liability
4444+ </h2>
4545+ <p>
4646+ Arabica is provided "as is" without warranty of any kind. We are not
4747+ liable for any data loss, service interruptions, or other damages
4848+ arising from your use of the application.
4949+ </p>
5050+5151+ <h2 class="text-2xl font-bold text-brown-900 mt-8">
5252+ 6. Changes to Terms
5353+ </h2>
5454+ <p>
5555+ We reserve the right to modify these terms at any time. Continued use of
5656+ Arabica after changes constitutes acceptance of the modified terms.
5757+ </p>
5858+ </div>
5959+ </div>
6060+</div>