mirror of
https://github.com/marcusDenslow/terminalShop.git
synced 2026-10-25 18:08:45 +01:00
296c052fa7923eba16bbc0b03318bfb3cb74e291
previously main.go handled auth directly, it connected to the database, ran migrations, created a JWT manager and SSHAuthService, and authenticated the SSH key before the TUI even started. this commit rips all of that out Auth now happens inside the TUI during the splash screen via splashAuthCmd, which calls the /auth/token endpoint. if no user exists or the fingerprint it auto-creates one using the SSH public ke, so there is no longer a separate registartion flow. The token and user com back in the response. once authed splashViewInitCmd fires a single /view/init request that loads everything needed to start the app, products, cart, addresses, cards, and orders, before switching to the shop page on the model side, User/*models.user and gossh.PublicKey were replaced with plain Fingerprint and SSHPublicKeyStr strings, and NewModelWithAuth was updated too
terminal-shop-source
@ 697730e73c
Terminal Coffee Shop
A terminal-based coffee shop, accessible over SSH. Built with Go, Bubbletea, Wish, Chi, PostgreSQL, Stripe, and Shippo.
ssh localhost -p 23456
Running locally
# Copy and fill in env vars
cp .env.example .env
# Start the API server
go run api/main.go
# Start the SSH server
go run main.go
Stack
| Layer | Tech |
|---|---|
| TUI | Bubbletea + Wish (SSH) |
| HTTP API | Chi router |
| Database | PostgreSQL + GORM |
| Auth | SSH key fingerprint + JWT |
| Payments | Stripe |
| Shipping | Shippo |
What's working
- SSH server — key-based auth, auto user creation
- Shop page — browse products with live detail panel
- Cart — add/remove items, synced to API
- Checkout flow — shipping address → payment → confirmation
- Saved addresses and cards
- Order history in account view
- FAQ page
- Responsive layout (small/medium/large terminal sizes)
- Token refresh
TODO
Features missing vs reference (terminal.shop):
- Splash/loading screen on connect
- Animated logo with blinking cursor
- Subscriptions (recurring orders) — subscribe, manage, cancel
- API token management page
- OAuth app management page
- About page
- Theme system — currently 40+ hardcoded hex colors scattered across files
- Viewport-based scrolling — currently manual scroll math with hardcoded heights
Known bugs:
- Address delete slice bug in
shipping_form.go:386—[m.AddressCursor+1:]...missing - Account page has a placeholder "something" menu item in
models/coffee.go
Code quality:
- Nested state structs (reference uses
state.shop,state.cart, etc. vs flat Model) - Centralized styles file
Description
Languages
Go
95.9%
Shell
3%
JavaScript
0.9%
Makefile
0.2%