Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ dist-ssr
*.tsbuildinfo
coverage
.vercel

# Local browser verification artifacts
.playwright-cli/
graphify-out/

# Environment & Local
Expand Down
13 changes: 10 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
Guidance for AI coding assistants working on MoneyTrace.

## Project Identity

- Vite + React 19 + TypeScript app for inflation-adjusted portfolio projection and AI-assisted financial Q&A.
- All state persisted in browser localStorage via Zustand `persist`.
- No CI pipeline, no external test runner framework. The only backend piece is the Vercel serverless demo proxy (`api/demo.ts`).

## Commands

- Dev server: `npm run dev` (Vite, default port 5173)
- Typecheck & Build: `npm run build` (`tsc -b && vite build` — `build` is the typecheck step)
- Linting: `npm run lint` / `npm run lint:fix` (ESLint flat config `eslint.config.js`)
Expand All @@ -19,6 +21,7 @@ Guidance for AI coding assistants working on MoneyTrace.
- Must update and run tests when changing `src/engine/*` or Zustand stores.

## Architecture

- `src/config/`: Single source of truth for constants (`src/config/index.ts` exporting `APP_CONFIG`). Holds app metadata, AI provider models, Demo API quotas, security limits, and default engine parameters.
- `src/engine/`: Pure, framework-free math (`compound-growth.ts`, `inflation-adjust.ts`, `currency-convert.ts`) orchestrated by `calculateProjection` in `src/engine/index.ts`. Deterministic outputs rounded to 2 decimal places. UI must not execute financial calculations directly.
- `src/store/`: Zustand stores with `persist`.
Expand All @@ -41,19 +44,23 @@ Guidance for AI coding assistants working on MoneyTrace.
- `portfolio/`: `PortfolioForm`, `AiForecastModal`.
- `projection/`: `ProjectionTable`, `ProjectionSummaryCards`, lazy-loaded `ChartSection`.
- `scenarios/`: `ScenarioManager`, `ScenarioCompareDialog`.
- `src/seo/`: Canonical locale routes, route-level metadata, and browser head synchronization.
- `scripts/`: Build-time static page generation and SEO output verification.
- Paths: `@/*` resolves to `src/*` (configured in `vite.config.ts` and `tsconfig.app.json`).
- Styling: Tailwind CSS v4 via `@tailwindcss/vite`. No `tailwind.config.*`; styles and CSS variables defined in `src/index.css`.

## Conventions

- Commits: Conventional commits (`feat:`, `fix:`, `docs:`, etc.) per `CONTRIBUTING.md`. Run `npm run lint` and `npm run format` prior to committing.
- TypeScript: Strict flags in `tsconfig.app.json`. Avoid `any`.
- i18n: Translations located in `src/locales/<code>/translation.json`. Register new locales with static imports in `src/lib/i18n.ts` (default is `en`). Do not alter translation key names; update values only.
- Deployment: Vercel SPA via `vercel.json` rewrites for client-side routing.
- i18n: Translations located in `src/locales/<code>/translation.json`. Register new locales with static imports in `src/lib/i18n.ts` (default is `tr`). Keep locale URL mappings in `src/seo/site.ts` synchronized.
- Deployment: Vercel serves build-time generated HTML with clean URLs. `npm run build` must generate and verify all localized routes before deployment.
- App Version: Single source of truth is `APP_CONFIG.app.version` in `src/config/index.ts`.

## Gotchas

- Local `dist/` folder is gitignored. Do not commit build artifacts.
- Header comments in some files are in Turkish (e.g., `src/store/index.ts`). Match existing comment language in target file.
- Code comments and file headers are written in English; keep new and updated comments in English.
- AI settings are configured via Settings dialog (`App.tsx`) and stored in `useSettingsStore`.
- Demo API produces server-side enforcement via `api/demo.ts` (Vercel edge function): owns `DEMO_API_KEY` env var, per-user quotas + per-IP daily caps (Upstash Redis if configured, in-memory fallback), chat cooldown. Client-side counters in `settings-store.ts` are display/UX only.
- Demo API availability is controlled by `VITE_DEMO_PROXY_URL`. If unset, demo option is hidden in UI.
11 changes: 4 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,16 @@ MoneyTrace uses `i18next` for internationalization. To add a new language:
language appears properly in the UI language selector:
```typescript
const LANGUAGE_LABELS: Record<string, string> = {
en: "English (EN)",
tr: "Türkçe (TR)",
// Keep all existing language labels.
fr: "Français (FR)",
}
```

5. **Update the central configuration:**
Open `src/config/index.ts` and add the new locale code to
`APP_CONFIG.app.supportedLanguages` (currently `["en", "tr"] as const`):
```typescript
supportedLanguages: ["en", "tr", "fr"] as const,
```
This keeps the config as the single source of truth for supported app locales.
`APP_CONFIG.app.supportedLanguages`. Append the new locale code while preserving
every existing entry. This keeps the config as the single source of truth for
supported app locales rather than assuming a fixed set of languages.

---

Expand Down
14 changes: 3 additions & 11 deletions CONTRIBUTING.tr.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,19 @@ MoneyTrace, `i18next` ve `react-i18next` altyapısını kullanır. Çeviriler `s
3. Dosya içerisindeki metin değerlerini (anahtarları değiştirmeden) yeni dile çevirin.
4. Yeni dili `src/lib/i18n.ts` dosyasında statik import ile tanımlayın ve `resources` nesnesine kaydedin.
5. Dilin görünür adını (örn. `de: "Deutsch (DE)"`) `src/lib/i18n.ts` içindeki `LANGUAGE_LABELS` haritasına ekleyin (Ayarlar'daki dil seçicisi buradan beslenir).
6. **Merkezi yapılandırmayı güncelleyin:** `src/config/index.ts` dosyasındaki `APP_CONFIG.app.supportedLanguages` dizisine yeni dil kodunu ekleyin (şu an `["en", "tr"] as const`):
```typescript
supportedLanguages: ["en", "tr", "de"] as const,
```
Desteklenen dillerin tek kaynağı yapılandırma dosyasıdır.
6. **Merkezi yapılandırmayı güncelleyin:** Yeni dil kodunu `src/config/index.ts` dosyasındaki `APP_CONFIG.app.supportedLanguages` dizisine, mevcut kayıtların tümünü koruyarak ekleyin. Böylece sabit bir dil kümesi varsayılmadan desteklenen dillerin tek kaynağı yapılandırma dosyası olarak kalır.

Örnek `src/lib/i18n.ts` kaydı:
```typescript
import deTranslation from '../locales/de/translation.json';

// resources nesnesine ekleyin:
const resources = {
en: { translation: enTranslation },
tr: { translation: trTranslation },
// Keep all existing language resources.
de: { translation: deTranslation },
};

// LANGUAGE_LABELS haritasına ekleyin:
const LANGUAGE_LABELS = {
en: "English (EN)",
tr: "Türkçe (TR)",
// Keep all existing language labels.
de: "Deutsch (DE)",
};
```
Expand Down
Loading
Loading