How woon-woo/original-otomotiv works
1. Overall shape: this repo is a three-surface system built around a single Supabase backend. The surfaces are: the public/admin web app in apps/web, the internal iOS/macOS-style terminal app in apps/ogot, and the shared database/auth/storage layer in supabase.
2. Public + admin web app (apps/web): Next.js App Router is used for both the public storefront and the protected admin panel. The site has public routes for the homepage, about page, product/part listings, and store pages, while the panel lives under /panel and is split into many domain areas such as catalog, products, members, suppliers, records, deletion requests, and store management.
3. Authentication and session flow on the web: login and account-recovery flows are separated into dedicated routes and server actions (/giris, /sifremi-unuttum, /sifre-belirle, /auth/confirm). There is also a multi-factor authentication section under /panel/mfa, which includes setup, email challenge/verification, and verification display screens. The web app uses Supabase client/server/admin helpers to enforce this boundary.
4. Protected operations in the web panel: the protected layout under /panel/(protected) indicates that most mutation-heavy behavior is server-side and gated. Each major admin area has its own actions.ts, so form submissions and record changes happen through server actions rather than direct client-side API calls. There is also a dedicated export route for Sahibinden integration, which matches the repository’s “Sahibinden taxonomy 1:1” model.
5. Frontend domain model: the public catalog and admin panel are centered on automotive inventory concepts: parts/products, brands, categories, lists, stores, members, suppliers, shelves, depots, and vehicle filters. The presence of CatalogUI, VehicleFilter, ProductRow, and rich-text/photo components suggests the UI is built around structured product metadata plus media and search/filtering.
6. Backend data layer (supabase): Supabase is the system of record and contains the schema evolution for auth profiles, audit logging, catalog data, vehicles, inventory, suppliers/printing, multi-tenant stores, store owner privacy, account deletion, email 2FA, category trees/sorting, and denormalized storefront views. RLS is a core architectural boundary: the README states all tables use RLS, with soft delete and audit logs everywhere important.
7. How data is exposed from the backend: the migration set shows a deliberate split between authoritative tables and derived/public-facing shapes. That includes denormalized storefront data, category trees, store-only anonymous columns, and RPCs for read/search operations. This is a strong signal that the web and OGOT clients consume curated views and RPCs rather than raw tables for many paths.
8. Internal staff app (apps/ogot): OGOT is a separate Swift/SwiftUI app for internal warehouse or counter workflows. Its screens suggest login, depot management, product browsing, shelf/location operations, QR scanning, label printing, and add-product flows. It is not just a thin web wrapper; it is its own client with native UI and device capabilities.
9. Printing subsystem (NiimbotKit): this Swift package isolates Niimbot B1 label printing. The package has packet/command/printer abstractions plus QR rendering and bitmap conversion, with separate debug and verification executables and tests. In architecture terms, it is a device-driver-like boundary used by OGOT for QR label output over Bluetooth/CoreBluetooth.
10. Operational integrations: the product flow avoids online checkout; the purchase path is a WhatsApp handoff, reflected by whatsapp.ts and static wa.me links. There are also support utilities for email, thumbnails, sanitization, logging, and anti-bot protection via Turnstile, which all sit around the core catalog/auth flows.
11. Security and governance: the repo emphasizes admin MFA, audit history, account deletion, and store-owner privacy. The combination of RLS, login tracking, audit tables, and soft delete means the system is designed for traceability and controlled access rather than a simple CRUD app.
12. Repo boundaries for a diagram: draw the web app and OGOT app as separate clients, both talking to the same Supabase backend; draw NiimbotKit as a native-printing submodule only used by OGOT; and show public storefront reads separated from protected admin mutations by auth/RLS/server-actions boundaries. The most important shared domain is catalog/inventory/store management, with web focused on public commerce/admin and OGOT focused on in-person operations and label printing.
Main entry points: supabase Supabase Helpers · migrations Schema · OGOT OGOT App · 0009_rpc.sql RPC & Views
Components 29
Web App
Next.js storefront and admin panel
- Public Site · Homepage, about, listings, and store pages
apps/web/src/app/(site) - Auth Flows · Login, recovery, password setup, and confirm routes
apps/web/src/app/giris - Admin Panel · Authenticated panel shell and domain areas
apps/web/src/app/panel/(protected) - Catalog Admin · Brands, categories, lists, and catalog management
apps/web/src/app/panel/(protected)/katalog - Products · Part and product editing, creation, and detail actions
apps/web/src/app/panel/(protected)/parca - Members · Store members and store-specific member management
apps/web/src/app/panel/(protected)/uyeler - Suppliers · Supplier management and related mutations
apps/web/src/app/panel/(protected)/tedarikciler - Records · Operational record views and actions
apps/web/src/app/panel/(protected)/kayitlar - Store Ops · Store management and store-owner workflows
apps/web/src/app/panel/(protected)/magazam - MFA · Setup, email challenge, and verification screens
apps/web/src/app/panel/mfa - Sahibinden Export · Specialized export endpoint for marketplace integration
apps/web/src/app/panel/export/sahibinden/route.ts - Supabase Helpers · Client, server, admin, session, and update helpers
apps/web/src/lib/supabase - UI Components · Catalog, forms, filters, auth gates, and media widgets
apps/web/src/components
Supabase
Database, auth, storage, and RPC layer
- Schema · Core tables for profiles, catalog, inventory, stores, and auth
supabase/migrations - RLS & Grants · Row-level security, role hardening, and service grants
supabase/migrations/0008_rls_policies.sql - RPC & Views · Search, read, denormalized storefront, and helper RPCs
supabase/migrations/0009_rpc.sql - Storage · File storage and hardening for media assets
supabase/migrations/0010_storage.sql - MFA Data · Database support for email two-factor authentication
supabase/migrations/0016_data_layer_mfa.sql - Audit Log · Audit history, revert support, and login tracking
supabase/migrations/0003_audit.sql - Privacy & Deletion · Store-owner privacy and account deletion controls
supabase/migrations/0017_store_owner_privacy.sql
OGOT
Native internal warehouse app
- OGOT App · Native internal login, depot, product, and workflow app
apps/ogot/OGOT/OGOT - Backend Client · App-side Supabase access and session handling
apps/ogot/OGOT/OGOT/Backend.swift - Depot · Depot and warehouse management screens
apps/ogot/OGOT/OGOT/DepotView.swift - Products · Product browsing and operational item lookup
apps/ogot/OGOT/OGOT/ProductsView.swift - QR Scan · QR scanning for item and location workflows
apps/ogot/OGOT/OGOT/QRScannerView.swift - Print Labels · Label printing flow used by warehouse staff
apps/ogot/OGOT/OGOT/PrintLabelView.swift
Printing
Niimbot label-printing package
- NiimbotKit · Label printer driver package with QR and bitmap support
apps/ogot/NiimbotKit/Package.swift - Printer Core · Packet, command, printer, and bitmap primitives
apps/ogot/NiimbotKit/Sources/NiimbotKit - Debug Tools · Verification and debug executables for printer output
apps/ogot/NiimbotKit/Sources/NiimbotDebug
Connections 33
- Public Site → Supabase Helpers: read data · Public pages consume Supabase through shared helpers
- Auth Flows → Supabase Helpers: session · Auth routes use server/client helpers and session updates
- Admin Panel → Supabase Helpers: guarded data · Protected panel uses server-side Supabase access
- Admin Panel → UI Components: compose ui · Panel shells and domain pages use shared UI components
- Catalog Admin → Supabase Helpers: mutate data · Catalog admin submits through server actions and helpers
- Products → Supabase Helpers: mutate data · Product detail and creation actions flow through helpers
- Members → Supabase Helpers: mutate data · Member management uses protected server actions
- Suppliers → Supabase Helpers: mutate data · Supplier workflows are handled server-side
- Records → Supabase Helpers: read/update · Operational records are loaded and changed through actions
- Store Ops → Supabase Helpers: admin ops · Store management depends on authenticated Supabase access
- MFA → Supabase Helpers: verify · MFA setup and challenge screens use shared auth helpers
- Sahibinden Export → RPC & Views: export · Export route likely reads curated catalog data via backend APIs
- Supabase Helpers → Schema: tables · Web helpers target the shared system-of-record schema
- Supabase Helpers → RPC & Views: rpc/views · Read/search flows use derived API shapes
- Supabase Helpers → Storage: media · Uploads and thumbnails depend on storage
- Admin Panel → RLS & Grants: enforced by · Protected admin operations rely on RLS and grants
- OGOT App → Backend Client: session data · Native screens depend on the app backend layer
- OGOT App → Depot: shows · Depot management is a major OGOT surface
- OGOT App → Products: shows · Product browsing is a major OGOT surface
- OGOT App → QR Scan: uses · OGOT includes device QR scanning workflows
- OGOT App → Print Labels: uses · Label printing is exposed in the native app
- Print Labels → NiimbotKit: prints via · OGOT delegates label output to the printer package
- NiimbotKit → Printer Core: implements · Core package contains printer protocols and QR rendering
- NiimbotKit → Debug Tools: verifies · Debug executables exercise the printing stack
- Backend Client → Schema: reads · OGOT uses the same backend system of record
- Backend Client → RPC & Views: queries · Native workflows likely consume curated RPCs and views
- OGOT App → MFA Data: mfa · Internal login supports multi-factor auth data flows
- Schema → Audit Log: tracked by · Important tables are covered by audit and login tracking
- Schema → Privacy & Deletion: governed by · Profiles, deletion, and store-owner privacy are enforced in SQL
- Schema → RLS & Grants: protected by · Core data is guarded by row-level security
- Schema → RPC & Views: served through · Curated read/search and storefront views sit on top of tables
- Schema → Storage: uploads · Catalog media and assets are stored separately from tables
- Schema → MFA Data: auth 2fa · Email 2FA extends the auth/profile data layer