How sbktckp/clipency-finance-tracker works
Purpose and entry points
Clipency Finance Tracker is an internal Next.js finance-operations dashboard consolidating marketplace revenue and operational costs. The public landing route is app/page.tsx; authenticated users enter through app/login/page.tsx. The App Router root layout and global styling are defined in app/layout.tsx and app/globals.css.
Application shell and shared state
Authenticated finance modules are expected to share a consistent navigation and page frame through components/app-shell.tsx and components/sidebar.tsx. Cross-page currency selection/state is centralized in components/currency-context.tsx, exposed through components/currency-switch.tsx, and mounted with application-level providers in components/providers.tsx.
Authentication and security boundary
Supabase is the backend and identity boundary, initialized by lib/supabase.ts. Access beyond login is gated by Supabase Auth plus membership/role checks in the shared admin_users data model. Client-side money-moving operations must not write tables directly: mutations are delegated to protected Supabase SECURITY DEFINER RPCs guarded by cx_is_admin().
Finance operations modules
The principal accounting surfaces are route-level App Router pages: incoming money at app/credits/page.tsx, outgoing spending at app/debits/page.tsx, account/fund balances at app/funds/page.tsx, and campaign-linked spend at app/campaigns/page.tsx. These modules consolidate data from the Supabase project shared with the main Clipency marketplace, separating operational presentation from backend financial authorization.
Analysis, calculation, and audit stages
The dashboard summary is served by app/dashboard/page.tsx; forward cash-flow views and reporting are represented by app/projections/page.tsx and app/reports/page.tsx. Core aggregation/calculation workflows have a dedicated surface in app/engine/page.tsx. Financial governance is split into point-in-time records (app/snapshots/page.tsx), tax preparation (app/tax/page.tsx), and action auditing (app/logs/page.tsx).
Administrative and people operations
Privileged administration is isolated at app/admin/page.tsx, consistent with the admin-role access model. Team and payroll-related finance records are handled through app/team/page.tsx. This separation makes admin controls, personnel costs, and transaction/accounting workflows distinct operational domains.
Runtime and presentation infrastructure
The runtime is Next.js 16 App Router with React 19 and TypeScript, deployed with environment-held credentials (not repository secrets), likely Vercel per the README. Tailwind CSS v4 provides styling; financial visualization is concentrated in components/finance-charts.tsx using Recharts. The marketing/landing composition is separate from internal operations under components/landing/, including components/landing/FinanceDashboard.tsx and components/landing/HeroSection.tsx.
Main entry points: sidebar.tsx Sidebar navigation · supabase.ts Supabase client · page.tsx Calculation engine · layout.tsx Root layout
Components 20
App Shell & Presentation
- Root layout · Mounts global styles and application structure.
app/layout.tsx - App providers · Mounts shared application-level state.
components/providers.tsx - Currency state · Cross-page currency selection state.
components/currency-context.tsx - Authenticated shell · Provides the finance navigation and page frame.
components/app-shell.tsx - Sidebar navigation
components/sidebar.tsx - Public landing · Public entry route.
app/page.tsx - Login · Authentication entry route.
app/login/page.tsx - Finance charts · Recharts-based financial visualization.
components/finance-charts.tsx
Finance Operations
- Dashboard summary · Consolidated finance overview.
app/dashboard/page.tsx - Credits, debits & funds · Incoming money, spending, and account balances.
- Campaign spend · Campaign-linked spending records.
app/campaigns/page.tsx - Team & payroll · Personnel-related finance records.
app/team/page.tsx
Analysis & Governance
- Calculation engine · Dedicated aggregation and calculation workflow.
app/engine/page.tsx - Cash-flow projections
app/projections/page.tsx - Reports
app/reports/page.tsx - Snapshots, tax & logs · Point-in-time records, tax preparation, and action auditing.
- Administration · Privileged administration surface.
app/admin/page.tsx
Supabase Security Boundary
- Supabase client · Backend and identity integration.
lib/supabase.ts - Auth & admin membership · Supabase Auth plus admin_users role checks gate access.
- Protected finance RPCs · Money-moving mutations require cx_is_admin().
Connections 25
- Root layout → App providers: mounts
- App providers → Currency state: provides
- Root layout → Public landing: routes
- Login → Supabase client: authenticates with
- Supabase client → Auth & admin membership: enforces
- Auth & admin membership → Authenticated shell: permits access to
- Authenticated shell → Sidebar navigation: contains
- Sidebar navigation → Dashboard summary: navigates to
- Sidebar navigation → Credits, debits & funds: navigates to
- Sidebar navigation → Campaign spend: navigates to
- Sidebar navigation → Team & payroll: navigates to
- Sidebar navigation → Cash-flow projections: navigates to
- Sidebar navigation → Reports: navigates to
- Sidebar navigation → Snapshots, tax & logs: navigates to
- Sidebar navigation → Administration: navigates to
- Credits, debits & funds → Supabase client: reads finance data
- Campaign spend → Supabase client: reads finance data
- Team & payroll → Supabase client: reads finance data
- Calculation engine → Supabase client: aggregates data
- Calculation engine → Cash-flow projections: feeds
- Calculation engine → Reports: feeds
- Dashboard summary → Finance charts: renders
- Credits, debits & funds → Protected finance RPCs: mutates through
- Protected finance RPCs → Auth & admin membership: requires admin check
- Administration → Auth & admin membership: requires