mirror of
https://github.com/mosh-hamedani/expense-tracker-starter.git
synced 2026-05-21 11:58:31 +02:00
1.9 KiB
1.9 KiB
Project Guidelines
Overview
React expense tracker starter app (Vite + React 19). Intentionally contains bugs, poor UI, and messy code — designed as a teaching project for incremental refactoring.
Build and Test
npm install # Install dependencies
npm run dev # Dev server → http://localhost:5173
npm run build # Production build → dist/
npm run lint # ESLint check
Windows note: Use
npm.cmdinstead ofnpmif PowerShell execution policy blocks scripts.
Architecture
- Single-file app — all logic lives in
src/App.jsx(~180 lines) - No component extraction — summary cards, form, filters, and transaction table are all inline
- State: multiple
useStatecalls (no context, no external state library) - Styling: plain CSS files (
App.css,index.css), kebab-case class names, no CSS modules
Known Issues (Intentional)
These are learning targets, not legacy debt:
- Amounts stored as strings — causes string concatenation instead of arithmetic in totals
- Missing table column —
Typeheader exists but no matching<td>in rows - Data error — "Freelance Work" marked as expense, should be income
- No delete feature —
.delete-btnCSS exists but no button in DOM - Monolithic component — everything in one file, no extraction
Conventions
- Components: PascalCase filenames,
.jsxextension - Variables: camelCase
- CSS classes: kebab-case
- Imports: relative paths, CSS imported at component level
- State: React
useStatehooks (keep consistent with existing pattern unless refactoring)
Refactoring Targets
When asked to improve the code, consider these extraction candidates:
<TransactionTable>,<AddTransactionForm>,<SummaryCard>componentsuseTransactionscustom hook for transaction logic- Constants file for hardcoded categories