How bricelgdb/bs-tech-cs-adminhub works
1. Overall shape
This repository is a single-page frontend application built with React + TypeScript + Vite. The UI is organized as a dashboard-style product portal with routes for Dashboard, Products, Product Detail, Licences, Resources, Access, Reports, Login, and a 404 page.
2. Execution boundary
The app runs entirely in the browser as a SPA. There is no custom backend code in the repo; backend integration is done through Supabase. The frontend consumes either local domain data from src/data or Supabase-backed data depending on the feature path.
3. Bootstrap and app shell
src/main.tsx is the entry point. It likely wires together the global providers, router, and global styles. The persistent shell is split into reusable layout pieces such as:
- AppLayout
- AppHeader
- AppSidebar
- NavLink
These define the application frame around the routed page content.
4. Routing and access control
The top-level pages live in src/pages, and auth gating is handled separately via:
- AuthProvider
- AuthGate
- RouteGuard
This suggests the architecture distinguishes between authenticated and unauthenticated routes, with login access isolated from the main app sections.
5. Domain areas
The main domain concepts are visible in the data and page names:
- Products
- Licences
- Users / Access
- Reports
- Activity / Audit
- Resources / Docs / Integrations
These are the main business objects the UI surfaces and likely the key entities in the backend schema.
6. Product detail as a sub-application
src/pages/ProductDetailPage.tsx is decomposed into tab-specific subviews under src/pages/tabs:
- Overview
- Access
- Audit
- Docs
- Integrations
- Licences
- Usage
This indicates a master-detail architecture where the product list is a parent view and the detail page is a tabbed workspace with separate concerns per tab.
7. Presentation components
The app uses a layer of reusable, domain-aware components in src/components, such as:
- ProductCard, ResourceCard
- DataTable
- KpiTile
- Timeline
- StatusBadge, DomainChip
- Modal, AlertStrip, Skeletons
These are higher-level app widgets, distinct from the low-level UI primitives.
8. UI primitive system
src/components/ui contains a large set of reusable primitives typical of a component library layer. These are likely generated or adapted from a design system such as shadcn/ui and provide the base controls for dialogs, tables, tabs, forms, tooltips, selects, etc. The architecture cleanly separates design-system primitives from domain-specific composites.
9. Data layer
src/data contains domain datasets for:
- activity
- licences
- products
- reports
- users
This indicates the app has a clear in-repo data modeling layer, probably used for seeded/demo content, local rendering, or fallback data. useDataHooks centralizes access to this domain data for the UI.
10. State management
src/store/appStore.ts suggests a small global store for app-level state such as selected entities, filters, UI preferences, or cross-page coordination. It is separate from component-local state and separate from the Supabase/auth layer.
11. Supabase integration
The integration boundary lives under src/integrations/supabase with:
- client.ts
- types.ts
The repo also includes supabase/migrations, which means the database schema is managed in-repo. Architecturally, Supabase serves as the external system for authentication and persisted data, while the React app is the client. The presence of generated types implies type-safe access to Supabase data.
12. Supporting infrastructure
- tailwind.config.ts, postcss.config.js, and src/index.css indicate utility-first styling with Tailwind.
- vite.config.ts and vitest.config.ts show Vite-based build/test tooling.
- src/test contains test setup and at least one example test, so the repo includes a lightweight unit test layer.
- public/robots.txt and src/assets/products support static public assets and product imagery.
13. How data flows through the app
Typical flow is:
- User lands on the SPA entry point.
- Auth state is resolved through AuthProvider and guarded by AuthGate / RouteGuard.
- Routed pages load domain data through hooks/store/data modules.
- Pages render via layout components and reuse domain widgets.
- If persistence is required, the app talks to Supabase through the typed client.
14. Architecture summary for a diagram
The cleanest way to diagram this repo is as:
- Browser SPA shell
- Authentication and route protection
- Domain pages and tabbed detail views
- Shared UI/design system layer
- Domain data/store layer
- Supabase backend boundary with client + migrations/types
In short, this is a frontend-first dashboard application with a strong separation between layout, reusable UI, domain-specific views, and Supabase-backed persistence/auth.
Main entry points: AppLayout.tsx AppLayout · useDataHooks.ts useDataHooks · App.tsx App · ProductDetailPage.tsx Product Detail
Components 24
App Shell
Browser SPA entry, routing, auth, and layout framing.
- main.tsx · Browser entry point that boots the React app.
src/main.tsx - App · Top-level app composition and route wiring.
src/App.tsx - AuthProvider · Provides authentication state to the app.
src/providers/AuthProvider.tsx - AuthGate · Controls access to authenticated areas.
src/components/AuthGate.tsx - RouteGuard · Protects routes and handles unauthenticated access.
src/components/RouteGuard.tsx - AppLayout · Persistent application frame around routed content.
src/components/AppLayout.tsx - AppHeader · Top navigation and global actions.
src/components/AppHeader.tsx - AppSidebar · Primary navigation for the dashboard sections.
src/components/AppSidebar.tsx
Pages
Top-level routes and product detail subviews.
- Index · Default landing route for the authenticated app.
src/pages/Index.tsx - Dashboard · High-level dashboard and KPI entry page.
src/pages/DashboardPage.tsx - Products · Product listing and discovery surface.
src/pages/ProductsPage.tsx - Product Detail · Tabbed workspace for a single product.
src/pages/ProductDetailPage.tsx - Licences · Licence management and status view.
src/pages/LicencesPage.tsx - Resources · Resources, docs, and supporting materials.
src/pages/ResourcesPage.tsx - Access · User access and permissions surface.
src/pages/AccessPage.tsx - Reports · Reporting and activity insights surface.
src/pages/ReportsPage.tsx - Login · Unauthenticated sign-in route.
src/pages/LoginPage.tsx - Product Tabs · Product-specific subviews for overview, access, audit, docs, integrations, licences, and usage.
src/pages/tabs
UI Layer
Reusable domain widgets and design-system primitives.
- Domain Widgets · App-specific reusable cards, tables, badges, and charts.
src/components - UI Primitives · Reusable low-level controls and layout primitives.
src/components/ui
Data & Backend
Local domain data, global store, and Supabase integration.
- useDataHooks · Central hook layer for reading domain data.
src/hooks/useDataHooks.ts - appStore · Shared app-level state for selections, filters, or UI coordination.
src/store/appStore.ts - Domain Data · In-repo datasets for activity, licences, products, reports, and users.
src/data - Supabase · External auth and persistence boundary backed by typed client and migrations.
src/integrations/supabase
Connections 31
- main.tsx → App: boots · Main entry mounts the app shell.
- App → AuthProvider: wraps · App composes the auth context around routes.
- App → AppLayout: uses · Authenticated content renders inside the layout shell.
- App → Login: routes · Public sign-in route is separated from the protected app.
- AuthProvider → AuthGate: auth state · Auth provider supplies session state to access gating.
- AuthGate → RouteGuard: protects · Route guard enforces route-level access control.
- RouteGuard → AppLayout: permits · Protected routes enter the main application frame.
- AppLayout → AppHeader: includes · Persistent header is part of the shell.
- AppLayout → AppSidebar: includes · Persistent sidebar provides section navigation.
- AppSidebar → Index: navigates · Primary nav reaches the landing route.
- Index → Dashboard: lands on · Default route resolves to the dashboard.
- AppLayout → Dashboard: hosts · Dashboard is rendered within the app shell.
- AppLayout → Products: hosts · Products page is rendered within the app shell.
- AppLayout → Product Detail: hosts · Product detail is rendered within the app shell.
- AppLayout → Licences: hosts · Licences page is rendered within the app shell.
- AppLayout → Resources: hosts · Resources page is rendered within the app shell.
- AppLayout → Access: hosts · Access page is rendered within the app shell.
- AppLayout → Reports: hosts · Reports page is rendered within the app shell.
- Product Detail → Product Tabs: decomposes · Tabbed subviews make up the product detail workspace.
- Dashboard → Domain Widgets: renders · Dashboard uses reusable domain widgets.
- Products → Domain Widgets: renders · Catalog views reuse shared widgets.
- Product Detail → Domain Widgets: renders · Detail tabs rely on reusable widgets.
- Domain Widgets → UI Primitives: built on · App widgets compose design-system primitives.
- Dashboard → useDataHooks: loads · Pages read domain data through centralized hooks.
- Products → useDataHooks: loads · Catalog pages read domain data through centralized hooks.
- Product Detail → useDataHooks: loads · Detail tabs read domain data through centralized hooks.
- useDataHooks → Domain Data: reads · Hooks consume local domain datasets as a source of truth or fallback.
- useDataHooks → appStore: coordinates · Hooks coordinate with shared app state.
- useDataHooks → Supabase: syncs · Hooks bridge the UI to typed Supabase data when persistence is needed.
- Supabase → AuthProvider: auth · Supabase underpins authentication state.
- Supabase → Domain Data: persists · Database-backed data maps to the app's domain models.