How daemonide/expensetracker-frontend works
1. This repository is a single-page frontend application for an expense tracker. It is built with React + TypeScript and bundled with Vite, so the whole system runs in the browser and talks to a separate backend server.
2. The top-level application shell is centered around main.tsx, App.tsx, and layout.tsx. These files define how the app is mounted, how routing/layout are composed, and how the main authenticated UI is wrapped.
3. Routing is split by access level. LoginPage and RegisterPage are public entry points, while PrivateRoute.tsx guards the main application areas such as dashboard, expenses, categories, and account pages.
4. The feature layer is organized by domain under src/pages: DashboardPage, ExpensesPage, CategoriesPage, and AccountPage. This suggests a CRUD-oriented frontend where each page owns a distinct slice of user-facing functionality.
5. All server communication is centralized in src/api. There is a shared Axios client in axios.ts, with domain-specific modules for auth, account, categories, and expenses. The likely data flow is: page/component action → API module → Axios client → backend server → returned data to the page.
6. Authentication is a first-class boundary. src/lib/auth-store.ts likely persists the current session/token client-side, while src/components/PrivateRoute.tsx uses that state to decide whether a user can enter protected screens. Login/register pages feed into this auth state.
7. The UI is composed from reusable components in src/components/ui, which looks like a shadcn-style component set. These primitives are used by higher-level pieces like app-sidebar.tsx, tables, dialogs, inputs, selects, sheets, and tooltips.
8. Navigation and responsive layout are handled separately from page logic. app-sidebar.tsx plus sidebar/sheet primitives indicate a desktop sidebar with a mobile-friendly drawer fallback. src/hooks/use-mobile.ts supports that responsive boundary.
9. Cross-cutting presentation concerns are isolated in theme-provider.tsx and src/index.css. Theme handling is therefore app-wide rather than page-specific, and the CSS layer likely contains the global design tokens/reset.
10. src/lib/utils.ts and src/lib/password.ts hold shared helper logic. The presence of a password utility implies some client-side password handling/validation support, but the core security boundary still lives in the auth/API flow.
11. src/types/pagination.ts shows that list endpoints probably return paginated collections, which fits the expenses/categories management screens and the table-oriented UI components.
12. The external dependency boundary is important: this frontend is explicitly paired with the separate expense tracker server linked in the README. The architecture diagram should show the browser SPA on one side and the backend API as the authoritative data store/auth authority on the other.
Main entry points: layout.tsx Layout · App.tsx App · ui UI primitives · ExpensesPage.tsx Expenses
Components 24
App shell
Bootstraps, routing, and global providers
Auth boundary
Public entry points and protected access control
- Login · Public sign-in screen
src/pages/LoginPage.tsx - Register · Public account creation screen
src/pages/RegisterPage.tsx - PrivateRoute · Protects authenticated application routes
src/components/PrivateRoute.tsx
Feature pages
Top-level user screens by domain
- Dashboard · Overview and summary screen
src/pages/DashboardPage.tsx - Expenses · Expense CRUD and list view
src/pages/ExpensesPage.tsx - Categories · Category management screen
src/pages/CategoriesPage.tsx - Account · User account settings screen
src/pages/AccountPage.tsx
API layer
Centralized server communication
- Axios client · Shared request wrapper and backend connection
src/api/axios.ts - Auth API · Authentication requests
src/api/auth.ts - Account API · Account profile requests
src/api/account.ts - Categories API · Category endpoints
src/api/categories.ts - Expenses API · Expense endpoints
src/api/expenses.ts
UI kit
Reusable presentation primitives
- App sidebar · Primary navigation and responsive drawer behavior
src/components/app-sidebar.tsx - UI primitives · Reusable shadcn-style inputs, tables, dialogs, sheets, and related controls
src/components/ui
Shared logic
Cross-cutting client helpers and state
- Auth store · Client-side auth/session persistence
src/lib/auth-store.ts - useMobile · Viewport breakpoint helper
src/hooks/use-mobile.ts - Utils · Shared utility functions
src/lib/utils.ts - Password util · Client-side password helper logic
src/lib/password.ts - Pagination type · Shared paginated collection shape
src/types/pagination.ts
Other components
- Backend API · Separate expense tracker server that owns data and auth
Connections 38
- main.tsx → App: mounts · Bootstraps the React application
- App → Theme: wraps · Applies global theme context
- App → Layout: composes · Builds the main application shell
- App → Login: routes · Public authentication entry point
- App → Register: routes · Public account creation entry point
- App → PrivateRoute: guards · Protects the authenticated section
- PrivateRoute → Auth store: checks · Reads client session state
- Layout → App sidebar: uses · Provides navigation chrome
- App sidebar → useMobile: adapts · Switches between sidebar and drawer behavior
- Layout → Dashboard: contains · Default authenticated landing page
- Layout → Expenses: contains · Expense management page
- Layout → Categories: contains · Category management page
- Layout → Account: contains · Account settings page
- Login → Auth API: calls · Submits credentials to the auth API
- Register → Auth API: calls · Creates a new account through the auth API
- Dashboard → Expenses API: reads · Loads expense data for summary views
- Expenses → Expenses API: crud · Manages expense records
- Expenses → Categories API: enriches · Uses categories for selection and display
- Categories → Categories API: crud · Manages category records
- Account → Account API: updates · Reads and updates account data
- Auth API → Axios client: uses · Shares the common HTTP client
- Account API → Axios client: uses · Shares the common HTTP client
- Categories API → Axios client: uses · Shares the common HTTP client
- Expenses API → Axios client: uses · Shares the common HTTP client
- Axios client → Backend API: requests · Sends API calls to the separate server
- Auth store → Auth API: supports · Stores session state established by auth flows
- Layout → UI primitives: renders · Uses shared UI primitives for shell composition
- Login → UI primitives: renders · Builds forms from shared UI components
- Register → UI primitives: renders · Builds forms from shared UI components
- Dashboard → UI primitives: renders · Uses cards, tables, and other primitives
- Expenses → UI primitives: renders · Uses tables, dialogs, and form controls
- Categories → UI primitives: renders · Uses tables and form controls
- Account → UI primitives: renders · Uses form and profile controls
- Layout → Utils: shares · Uses common helpers across the app
- Login → Password util: validates · Supports password handling and validation
- Register → Password util: validates · Supports password handling and validation
- Expenses → Pagination type: types · Consumes paginated list shapes
- Categories → Pagination type: types · Consumes paginated list shapes