How brs2026/autoexpense works
Purpose and Runtime
This is a Next.js App Router application for managing financial transactions, dashboard summaries, reports, users, and settings. It runs as a React/TypeScript web application, with Next.js server routing and Supabase integration. Progressive-web-app assets are present in public/sw.js and public/workbox-4754cb34.js.
Application Entry and Route Structure
The root application boundary is src/app/layout.tsx; src/app/page.tsx is the base route and src/app/login/page.tsx provides the login route. Protected or main-product pages are grouped under src/app/(app)/layout.tsx, which scopes the dashboard-oriented application shell without affecting URL paths.
Authenticated Application Shell
The app-area layout is supported by reusable navigation and page framing components:
• src/components/layout/app-shell.tsx
• src/components/layout/bottom-nav.tsx
• src/components/layout/page-header.tsx
These establish the shared control boundary between global navigation/layout and individual business pages, including mobile-oriented navigation implied by the bottom-nav component.
Financial Transaction Domain
Transaction management is the primary domain flow. The transaction landing page is src/app/(app)/transactions/page.tsx; income and expense are modeled as parallel route families. Each supports listing/detail, creation, and editing through route parameters:
• src/app/(app)/transactions/income/[id]/page.tsx
• src/app/(app)/transactions/income/add/page.tsx
• src/app/(app)/transactions/expense/edit/[id]/page.tsx
The [id] routes form the record-identity boundary for viewing or mutating a specific transaction. Category presentation is centralized in src/lib/category-icons.ts.
Dashboard, Reporting, and Administration
The operational views are separated into top-level app routes:
• src/app/(app)/dashboard/page.tsx
• src/app/(app)/reports/page.tsx
• src/app/(app)/users/page.tsx
• src/app/(app)/settings/page.tsx
Dashboard has its own local layout at src/app/(app)/dashboard/layout.tsx, indicating dashboard-specific framing or behavior distinct from other app pages. Users are the only exposed server API surface in the tree, via src/app/api/users/create/route.ts.
Data and Service Boundary
Supabase is the external backend/data service. Its access modes are explicitly separated:
• src/lib/supabase/browser-client.ts for browser-side access
• src/lib/supabase/client.ts for general/shared client setup
• src/lib/supabase/server-admin.ts for privileged server-side operations
Server-admin access should remain confined to server execution paths such as route handlers, especially user provisioning at src/app/api/users/create/route.ts; it must not cross into client-rendered components.
UI, Localization, and Offline Delivery
The presentation layer uses shared UI primitives under src/components/ui, while global styling begins at src/app/globals.css. Language state is managed through src/context/language-context.tsx, with English and Bengali message catalogs in src/messages/en.json and src/messages/bn.json. PWA metadata is supplied by src/app/manifest.ts, and the service-worker artifacts in public/ enable offline/cache behavior at the browser boundary.
Main entry points: app/layout.tsx Root application · (app)/layout.tsx Protected app shell · transactions/page.tsx Transactions · [id]/page.tsx Income records
Components 19
Client experience
- App shell
src/components/layout/app-shell.tsx - Navigation and header · Bottom navigation and shared page framing.
src/components/layout/bottom-nav.tsx - Category presentation
src/lib/category-icons.ts - Language state · Selects English or Bengali messages.
src/context/language-context.tsx
Next.js routes
- Root application
src/app/layout.tsx - Home and login
src/app/page.tsx - Login
src/app/login/page.tsx - Protected app shell · Scopes the main product without changing URLs.
src/app/(app)/layout.tsx - Dashboard
src/app/(app)/dashboard/page.tsx - Dashboard framing
src/app/(app)/dashboard/layout.tsx - Transactions
src/app/(app)/transactions/page.tsx - Income records · Listing, creation, and record detail flow.
src/app/(app)/transactions/income/[id]/page.tsx - Expense editing · Mutates an identified expense record.
src/app/(app)/transactions/expense/edit/[id]/page.tsx - Reports, users, settings · Operational and administrative views.
src/app/(app)/reports/page.tsx - User provisioning API · Server-only user creation endpoint.
src/app/api/users/create/route.ts
Data and delivery
- Browser Supabase client
src/lib/supabase/browser-client.ts - Shared Supabase client
src/lib/supabase/client.ts - Supabase admin client · Restricted to server execution paths.
src/lib/supabase/server-admin.ts - PWA offline delivery · Browser caching and install metadata.
src/app/manifest.ts
Connections 19
- Root application → Home and login: serves
- Root application → Login: serves
- Root application → Protected app shell: mounts
- Root application → Language state: provides
- Protected app shell → App shell: uses
- App shell → Navigation and header: composes
- Protected app shell → Dashboard: hosts
- Dashboard framing → Dashboard: frames
- Protected app shell → Transactions: hosts
- Transactions → Income records: routes to
- Transactions → Expense editing: routes to
- Income records → Category presentation: renders categories
- Protected app shell → Reports, users, settings: hosts
- Income records → Browser Supabase client: reads and writes
- Expense editing → Browser Supabase client: updates
- Dashboard → Shared Supabase client: loads summaries
- Reports, users, settings → Browser Supabase client: accesses data
- User provisioning API → Supabase admin client: provisions with
- Root application → PWA offline delivery: publishes