How indigomac/snapshark works
SnapShark combines a browser-based image-processing suite with a dive logbook and subscription features. The main processing workflow is selecting images, configuring format and processing options, previewing results, then downloading them; specialized background-removal and underwater tools are separate branches. The logbook workflow records trips, dive sites, dives, and photos, with sharing and account export/deletion capabilities. README documents processing and worker capabilities; sampled source confirms selected logbook and billing flows, but does not establish every UI-to-service connection.
Main entry points: db.ts Application database · LogbookClient.tsx Logbook interface · auth.ts Authentication · route.ts Photo endpoints
Components 30
Image tools
- Image processor
src/app/page.tsx - Processing hook
src/hooks/useImageProcessor.ts - Image worker
src/workers/imageWorker.ts - Canvas processing
src/lib/canvas.ts - Formats and presets
src/lib/formats.ts - Format converter
src/app/convert/page.tsx - Background removal
src/app/background-removal/page.tsx - Segmentation logic
src/lib/background-removal.ts - Underwater correction
src/app/underwater/page.tsx - Underwater processing
src/lib/underwater-video.ts
Dive logbook
- Logbook interface
src/app/logbook/LogbookClient.tsx - Trip endpoints
src/app/api/trips/route.ts - Dive-site endpoints
src/app/api/dive-sites/route.ts - Dive endpoints
src/app/api/dives/route.ts - Photo endpoints
src/app/api/photos/route.ts - Photo storage helper
src/lib/store-logbook-photo.ts - Shared logbook view
src/app/s/[token]/page.tsx - Logbook export/delete
src/app/api/account/logbook/route.ts
Account and billing
- Account dashboard
src/app/account/page.tsx - Checkout endpoint
src/app/api/stripe/checkout/route.ts - Subscription cancellation
src/app/api/stripe/cancel/route.ts - Stripe webhook
src/app/api/stripe/webhook/route.ts - Entitlements
src/lib/entitlements.ts
Shared services
- Authentication
src/lib/auth.ts - Application database
src/lib/db.ts - Subscription service
src/lib/subscription.ts
Other components
- Visitor
- Clerk
- Stripe
- Nominatim
Connections 42
- Visitor → Image processor: selects images
- Visitor → Format converter: converts images
- Visitor → Background removal: removes background
- Visitor → Underwater correction: corrects photos
- Image processor → Processing hook: configures processing
- Processing hook → Image worker: dispatches work
- Image worker → Canvas processing: processes pixels
- Processing hook → Formats and presets: uses options
- Background removal → Segmentation logic: runs removal
- Underwater correction → Underwater processing: runs correction
- Visitor → Logbook interface: records dives
- Logbook interface → Trip endpoints: requests trips
- Logbook interface → Dive-site endpoints: requests sites
- Logbook interface → Dive endpoints: requests dives
- Logbook interface → Photo endpoints: requests photos
- Trip endpoints → Authentication: authenticates user
- Dive-site endpoints → Authentication: authenticates user
- Dive endpoints → Authentication: authenticates user
- Photo endpoints → Authentication: authenticates user
- Trip endpoints → Application database: reads and writes
- Dive-site endpoints → Application database: reads and writes
- Dive endpoints → Application database: reads and writes
- Photo endpoints → Application database: reads and writes
- Photo endpoints → Photo storage helper: stores photo
- Visitor → Shared logbook view: opens shared logbook
- Visitor → Logbook export/delete: exports or erases
- Logbook export/delete → Authentication: authenticates user
- Logbook export/delete → Application database: reads and deletes
- Logbook export/delete → Photo storage helper: deletes stored photos
- Visitor → Account dashboard: manages account
- Account dashboard → Checkout endpoint: starts subscription
- Account dashboard → Subscription cancellation: cancels subscription
- Checkout endpoint → Stripe: creates checkout
- Subscription cancellation → Stripe: updates subscription
- Stripe → Stripe webhook: sends events
- Stripe webhook → Subscription service: syncs subscription
- Subscription cancellation → Subscription service: syncs subscription
- Subscription service → Application database: stores subscription
- Stripe webhook → Clerk: updates metadata
- Subscription cancellation → Clerk: updates metadata
- Account dashboard → Entitlements: checks access
- Visitor → Nominatim: searches location