From 4d48142752bc025ac5cff0696f4692b48f9c6ad8 Mon Sep 17 00:00:00 2001 From: Justn Ursan Date: Mon, 17 Nov 2025 22:33:59 +0100 Subject: [PATCH] chore: initial project setup with modular architecture - Add React Native project structure - Configure TypeScript with path aliases - Setup Zustand state management - Integrate Supabase for backend - Implement design system and shared components - Add navigation structure (Auth & App stacks) - Configure versioning tools (husky, commitlint, standard-version) - Setup CI/CD workflows - Add comprehensive documentation --- .commitlintrc.js | 28 ++ .env.example | 14 + .eslintrc.js | 16 + .github/workflows/ci.yml | 94 ++++ .github/workflows/release.yml | 46 ++ .gitignore | 72 +++ .husky/commit-msg | 4 + .husky/pre-commit | 4 + .prettierrc | 10 + .prettierrc.js | 9 + .releaserc.js | 22 + ARCHITECTURE.md | 254 +++++++++++ App.tsx | 44 ++ CHANGELOG.md | 40 ++ GETTING_STARTED.md | 300 +++++++++++++ GITEA_SETUP.md | 248 ++++++++++ GIT_WORKFLOW.md | 423 ++++++++++++++++++ README.md | 79 ++++ VERSIONING.md | 337 ++++++++++++++ VERSIONING_SETUP.md | 242 ++++++++++ babel.config.js | 21 + package.json | 83 ++++ src/config/index.ts | 14 + src/config/supabase.ts | 10 + src/modules/auth/services/authService.ts | 128 ++++++ .../contracts/services/contractService.ts | 181 ++++++++ src/navigation/RootNavigation.tsx | 142 ++++++ src/navigation/index.ts | 1 + src/shared/components/Button.tsx | 132 ++++++ src/shared/components/ContractCard.tsx | 195 ++++++++ src/shared/components/Input.tsx | 71 +++ src/shared/components/index.ts | 3 + src/shared/constants/index.ts | 37 ++ src/shared/theme/index.ts | 96 ++++ src/shared/types/index.ts | 74 +++ src/store/authStore.ts | 29 ++ src/store/contractStore.ts | 103 +++++ src/store/index.ts | 2 + tsconfig.json | 30 ++ 39 files changed, 3638 insertions(+) create mode 100644 .commitlintrc.js create mode 100644 .env.example create mode 100644 .eslintrc.js create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .husky/commit-msg create mode 100644 .husky/pre-commit create mode 100644 .prettierrc create mode 100644 .prettierrc.js create mode 100644 .releaserc.js create mode 100644 ARCHITECTURE.md create mode 100644 App.tsx create mode 100644 CHANGELOG.md create mode 100644 GETTING_STARTED.md create mode 100644 GITEA_SETUP.md create mode 100644 GIT_WORKFLOW.md create mode 100644 README.md create mode 100644 VERSIONING.md create mode 100644 VERSIONING_SETUP.md create mode 100644 babel.config.js create mode 100644 package.json create mode 100644 src/config/index.ts create mode 100644 src/config/supabase.ts create mode 100644 src/modules/auth/services/authService.ts create mode 100644 src/modules/contracts/services/contractService.ts create mode 100644 src/navigation/RootNavigation.tsx create mode 100644 src/navigation/index.ts create mode 100644 src/shared/components/Button.tsx create mode 100644 src/shared/components/ContractCard.tsx create mode 100644 src/shared/components/Input.tsx create mode 100644 src/shared/components/index.ts create mode 100644 src/shared/constants/index.ts create mode 100644 src/shared/theme/index.ts create mode 100644 src/shared/types/index.ts create mode 100644 src/store/authStore.ts create mode 100644 src/store/contractStore.ts create mode 100644 src/store/index.ts create mode 100644 tsconfig.json diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 0000000..2491366 --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1,28 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [ + 2, + 'always', + [ + 'feat', // Neues Feature + 'fix', // Bugfix + 'docs', // Dokumentation + 'style', // Formatierung + 'refactor', // Code-Refactoring + 'perf', // Performance-Verbesserung + 'test', // Tests + 'build', // Build-System + 'ci', // CI/CD + 'chore', // Sonstiges + 'revert', // Revert eines Commits + ], + ], + 'type-case': [2, 'always', 'lower-case'], + 'type-empty': [2, 'never'], + 'scope-case': [2, 'always', 'lower-case'], + 'subject-empty': [2, 'never'], + 'subject-full-stop': [2, 'never', '.'], + 'header-max-length': [2, 'always', 100], + }, +}; diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..9d92652 --- /dev/null +++ b/.env.example @@ -0,0 +1,14 @@ +# Environment Variables + +# Supabase +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_ANON_KEY=your-anon-key-here + +# Gitea (NICHT IN GIT COMMITEN!) +GITEA_URL=http://192.168.1.142:3000 +GITEA_TOKEN=ec01d92db7f02dec1089cbb00076d9cbd533fd3f +GITEA_USER=Firstly + +# App Configuration +NODE_ENV=development +API_BASE_URL=http://localhost:3000/api diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..9dd57a7 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,16 @@ +module.exports = { + root: true, + extends: '@react-native', + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + overrides: [ + { + files: ['*.ts', '*.tsx'], + rules: { + '@typescript-eslint/no-shadow': ['error'], + 'no-shadow': 'off', + 'no-undef': 'off', + }, + }, + ], +}; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ecd67b8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,94 @@ +name: CI + +on: + pull_request: + branches: [main, develop] + push: + branches: [develop] + +jobs: + test: + name: Test & Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run linter + run: npm run lint + + - name: Type check + run: npm run type-check + + - name: Run tests + run: npm test + + build-ios: + name: Build iOS + runs-on: macos-latest + needs: test + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: npm ci + + - name: Install Pods + run: | + cd ios + pod install + + - name: Build iOS + run: | + cd ios + xcodebuild -workspace Fristy.xcworkspace \ + -scheme Fristy \ + -configuration Release \ + -sdk iphonesimulator \ + -destination 'platform=iOS Simulator,name=iPhone 14' \ + build + + build-android: + name: Build Android + runs-on: ubuntu-latest + needs: test + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: npm ci + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Build Android + run: | + cd android + ./gradlew assembleRelease diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8fcfe26 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Release + +on: + push: + branches: + - main + - develop + - beta + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + - name: Type check + run: npm run type-check + + - name: Lint + run: npm run lint + + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..55c1438 --- /dev/null +++ b/.gitignore @@ -0,0 +1,72 @@ +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Dependencies +node_modules/ +.pnp/ +.pnp.js + +# Testing +coverage/ +*.test.ts.snap +*.test.tsx.snap + +# Production +build/ +dist/ + +# Environment +.env +.env.local +.env.development.local +.env.test.local +.env.production.local +.netrc + +# IDE +.vscode/ +.idea/ +*.swp +*.swo +*~ +.DS_Store + +# React Native +.expo/ +.expo-shared/ + +# iOS +ios/Pods/ +ios/build/ +*.xcuserstate +*.xcworkspace/xcuserdata/ +ios/.xcode.env.local + +# Android +android/app/build/ +android/.gradle/ +android/gradle/ +android/local.properties +*.apk +*.aab + +# Buck +.buckconfig.local +.buckd/ +buck-out/ + +# Misc +.bundle/ +*.jsbundle +*.bak +*.tmp + +# Metro +.metro-health-check* + +# CocoaPods +ios/Pods/ +Podfile.lock diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..c160a77 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx --no -- commitlint --edit ${1} diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..7e15468 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run lint-staged diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..986405d --- /dev/null +++ b/.prettierrc @@ -0,0 +1,10 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "semi": true, + "singleQuote": true, + "printWidth": 100, + "arrowParens": "avoid", + "bracketSpacing": true, + "endOfLine": "lf" +} diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..11fb671 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,9 @@ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: true, + singleQuote: true, + trailingComma: 'es5', + tabWidth: 2, + semi: true, +}; diff --git a/.releaserc.js b/.releaserc.js new file mode 100644 index 0000000..2fb32fc --- /dev/null +++ b/.releaserc.js @@ -0,0 +1,22 @@ +module.exports = { + branches: ['main', 'develop', { name: 'beta', prerelease: true }], + plugins: [ + '@semantic-release/commit-analyzer', + '@semantic-release/release-notes-generator', + [ + '@semantic-release/changelog', + { + changelogFile: 'CHANGELOG.md', + }, + ], + '@semantic-release/npm', + [ + '@semantic-release/git', + { + assets: ['CHANGELOG.md', 'package.json'], + message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}', + }, + ], + '@semantic-release/github', + ], +}; diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md new file mode 100644 index 0000000..05e52a3 --- /dev/null +++ b/ARCHITECTURE.md @@ -0,0 +1,254 @@ +# Fristy - Vertrags-Management App +## Architektur-Dokumentation + +### đŸ“± Übersicht +Eine modulare iOS/Android-App zur Verwaltung aller persönlichen VertrĂ€ge (Handy, DSL, Netflix, Wasser, etc.) + +### đŸ—ïž Tech Stack +- **Frontend**: React Native (iOS & Android Support) +- **Navigation**: React Navigation +- **State Management**: Zustand (leichtgewichtig & modular) +- **Backend**: Supabase (Auth, Database, Storage) +- **Styling**: NativeWind (Tailwind CSS fĂŒr React Native) +- **Icons**: React Native Vector Icons +- **Notifications**: React Native Push Notifications + +### 📐 Modulare Architektur + +``` +app-v0.0.1/ +├── src/ +│ ├── modules/ # Feature-Module (unabhĂ€ngig) +│ │ ├── auth/ # Authentifizierung +│ │ │ ├── screens/ +│ │ │ ├── components/ +│ │ │ ├── hooks/ +│ │ │ ├── services/ +│ │ │ └── types/ +│ │ ├── contracts/ # Vertrags-Verwaltung +│ │ │ ├── screens/ +│ │ │ ├── components/ +│ │ │ ├── hooks/ +│ │ │ ├── services/ +│ │ │ └── types/ +│ │ ├── dashboard/ # Übersicht +│ │ ├── notifications/ # Erinnerungen +│ │ ├── profile/ # Benutzerprofil +│ │ └── analytics/ # Statistiken (optional) +│ ├── shared/ # Gemeinsame Ressourcen +│ │ ├── components/ # UI-Komponenten +│ │ ├── hooks/ # Wiederverwendbare Hooks +│ │ ├── utils/ # Hilfsfunktionen +│ │ ├── constants/ # Konstanten +│ │ ├── types/ # TypeScript Typen +│ │ └── theme/ # Design System +│ ├── navigation/ # App-Navigation +│ ├── store/ # Globaler State +│ └── config/ # Konfiguration +├── assets/ # Bilder, Fonts, etc. +├── ios/ # iOS-spezifisch +├── android/ # Android-spezifisch +└── __tests__/ # Tests +``` + +### 🎯 Core-Module + +#### 1. **Auth-Modul** (`src/modules/auth/`) +- Login/Registrierung +- Passwort-Reset +- Session-Management +- Biometrische Authentifizierung (Face ID/Touch ID) + +#### 2. **Contracts-Modul** (`src/modules/contracts/`) +- Vertrag hinzufĂŒgen/bearbeiten/löschen +- Kategorien (Internet, Mobilfunk, Streaming, Versicherungen, etc.) +- Dokumente hochladen (PDF-Scans) +- KĂŒndigungsfristen-Tracking +- KostenĂŒbersicht + +#### 3. **Dashboard-Modul** (`src/modules/dashboard/`) +- Übersicht aller VertrĂ€ge +- Monatskosten-Zusammenfassung +- NĂ€chste KĂŒndigungsfristen +- Schnellaktionen + +#### 4. **Notifications-Modul** (`src/modules/notifications/`) +- Push-Benachrichtigungen +- KĂŒndigungsfristen-Erinnerungen +- Zahlungserinnerungen +- Custom Reminder + +#### 5. **Profile-Modul** (`src/modules/profile/`) +- Benutzereinstellungen +- App-Einstellungen +- Datenschutz +- Export/Backup + +### đŸ—„ïž Datenmodell + +#### User +```typescript +interface User { + id: string; + email: string; + name: string; + createdAt: Date; + updatedAt: Date; +} +``` + +#### Contract +```typescript +interface Contract { + id: string; + userId: string; + name: string; // z.B. "Vodafone Handyvertrag" + provider: string; // z.B. "Vodafone" + category: ContractCategory; + startDate: Date; + endDate?: Date; + cancellationDeadline?: Date; // KĂŒndigungsfrist + noticePeriod: number; // KĂŒndigungsfrist in Monaten + cost: number; // Monatliche Kosten + billingCycle: 'monthly' | 'quarterly' | 'yearly'; + autoRenewal: boolean; + notes?: string; + documents: Document[]; // PDF-AnhĂ€nge + reminderEnabled: boolean; + reminderDays: number; // Tage vor KĂŒndigungsfrist + status: 'active' | 'cancelled' | 'expired'; + createdAt: Date; + updatedAt: Date; +} +``` + +#### ContractCategory +```typescript +enum ContractCategory { + MOBILE = 'mobile', + INTERNET = 'internet', + STREAMING = 'streaming', + INSURANCE = 'insurance', + UTILITIES = 'utilities', // Strom, Wasser, Gas + GYM = 'gym', + SUBSCRIPTIONS = 'subscriptions', // Magazine, etc. + OTHER = 'other' +} +``` + +### 🔄 State Management (Zustand) + +```typescript +// src/store/contractStore.ts +interface ContractStore { + contracts: Contract[]; + loading: boolean; + error: string | null; + + // Actions + fetchContracts: () => Promise; + addContract: (contract: Omit) => Promise; + updateContract: (id: string, data: Partial) => Promise; + deleteContract: (id: string) => Promise; + filterByCategory: (category: ContractCategory) => Contract[]; + getTotalMonthlyCost: () => number; + getUpcomingDeadlines: (days: number) => Contract[]; +} +``` + +### 🎹 Design System + +#### Farben +- Primary: `#6366F1` (Indigo) +- Secondary: `#10B981` (Green) +- Warning: `#F59E0B` (Amber) +- Danger: `#EF4444` (Red) +- Background: `#F9FAFB` (Light Gray) +- Text: `#111827` (Dark Gray) + +#### Kategorien-Farben +- Mobile: `#3B82F6` (Blue) +- Internet: `#8B5CF6` (Purple) +- Streaming: `#EC4899` (Pink) +- Insurance: `#10B981` (Green) +- Utilities: `#F59E0B` (Amber) + +### 🚀 Entwicklungs-Roadmap + +#### Phase 1: MVP (Minimum Viable Product) +- [ ] User Authentication (Email/Password) +- [ ] VertrĂ€ge erstellen/bearbeiten/löschen +- [ ] Dashboard mit Übersicht +- [ ] Kategorisierung +- [ ] Basis-Benachrichtigungen + +#### Phase 2: Enhanced Features +- [ ] Dokumenten-Upload +- [ ] Erweiterte Benachrichtigungen +- [ ] Kostenanalyse & Charts +- [ ] Export-Funktion (PDF/CSV) +- [ ] Biometrische Authentifizierung + +#### Phase 3: Advanced +- [ ] OCR fĂŒr automatisches Auslesen von VertrĂ€gen +- [ ] KĂŒndigungs-Assistent (automatische KĂŒndigungen) +- [ ] Vergleichsportal-Integration +- [ ] Familie/Team-Sharing +- [ ] Cloud-Backup + +### 🔐 Sicherheit +- Alle sensiblen Daten verschlĂŒsselt +- Row Level Security (RLS) in Supabase +- Biometrische Authentifizierung +- Automatischer Logout nach InaktivitĂ€t +- Keine lokale Speicherung von Passwörtern + +### đŸ“± Navigation-Struktur + +``` +Stack Navigator +├── Auth Stack (nicht eingeloggt) +│ ├── Login +│ ├── Register +│ └── ForgotPassword +└── App Stack (eingeloggt) + └── Tab Navigator + ├── Dashboard (Home) + ├── Contracts (Liste) + ├── Add Contract + ├── Notifications + └── Profile +``` + +### đŸ§Ș Testing-Strategie +- Unit Tests: Services & Utils +- Integration Tests: Stores & Hooks +- E2E Tests: Kritische User Flows +- Snapshot Tests: UI Components + +### 📩 Deployment +- **iOS**: TestFlight → App Store +- **Android**: Google Play Console +- **CI/CD**: GitHub Actions +- **Versionierung**: Semantic Versioning + +### 🔧 Modulare Erweiterbarkeit + +**Neues Feature hinzufĂŒgen:** +1. Neuen Ordner in `src/modules/` erstellen +2. Eigene screens, components, services implementieren +3. In Navigation einbinden +4. Optional: Eigener Store + +**Feature entfernen:** +1. Module-Ordner löschen +2. Navigation-EintrĂ€ge entfernen +3. Store-Referenzen entfernen + +**Vorteile dieser Architektur:** +- ✅ Jedes Modul ist unabhĂ€ngig +- ✅ Einfaches Testing einzelner Module +- ✅ Team-Arbeit möglich (jeder an anderem Modul) +- ✅ Features können aktiviert/deaktiviert werden +- ✅ Code-Wiederverwendung durch shared/ +- ✅ Skalierbar fĂŒr große Apps diff --git a/App.tsx b/App.tsx new file mode 100644 index 0000000..5d59cb1 --- /dev/null +++ b/App.tsx @@ -0,0 +1,44 @@ +import React, { useEffect } from 'react'; +import { SafeAreaProvider } from 'react-native-safe-area-context'; +import { RootNavigation } from './src/navigation'; +import { authService } from './src/modules/auth/services/authService'; +import { useAuthStore } from './src/store'; + +function App(): React.JSX.Element { + const { setLoading } = useAuthStore(); + + useEffect(() => { + // Session wiederherstellen beim App-Start + const initAuth = async () => { + setLoading(true); + await authService.restoreSession(); + setLoading(false); + }; + + initAuth(); + + // Auth State Listener + const { data: subscription } = authService.onAuthStateChange((session) => { + if (session) { + // Session aktiv + console.log('User authenticated'); + } else { + // Keine Session + console.log('User logged out'); + } + }); + + // Cleanup + return () => { + subscription?.subscription?.unsubscribe(); + }; + }, [setLoading]); + + return ( + + + + ); +} + +export default App; diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..44e3578 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,40 @@ +# Changelog + +Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentiert. + +Das Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.0.0/), +und dieses Projekt folgt [Semantic Versioning](https://semver.org/lang/de/). + +## [Unreleased] + +### Geplant +- Auth Screens (Login, Register, Passwort Reset) +- Contract Management Screens +- Dashboard mit Statistiken +- Push-Benachrichtigungen +- Dokumenten-Upload + +## [0.0.1] - 2025-11-17 + +### HinzugefĂŒgt +- Initiales Projekt-Setup +- Modulare Architektur-Struktur +- TypeScript-Konfiguration mit Path-Aliases +- Shared Components (Button, Input, ContractCard) +- Design System (Colors, Spacing, Typography) +- Zustand State Management (Auth & Contracts) +- Supabase Integration +- Services Layer (Auth & Contract Services) +- Navigation Structure (Auth Stack & App Tabs) +- VollstĂ€ndige TypeScript-Type-Definitionen +- Dokumentation (Architecture, Getting Started, README) + +### Technologie-Stack +- React Native 0.73.0 +- TypeScript 5.3.3 +- Zustand 4.4.7 +- Supabase 2.38.4 +- React Navigation 6.x + +[Unreleased]: http://192.168.1.142:3000/Firstly/fristy/compare/v0.0.1...HEAD +[0.0.1]: http://192.168.1.142:3000/Firstly/fristy/releases/tag/v0.0.1 diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md new file mode 100644 index 0000000..0e67b65 --- /dev/null +++ b/GETTING_STARTED.md @@ -0,0 +1,300 @@ +# Fristy - Getting Started Guide + +## 🚀 Installation & Setup + +### Voraussetzungen +- Node.js >= 18 +- npm >= 9 +- Xcode (fĂŒr iOS) +- Android Studio (fĂŒr Android) +- CocoaPods (fĂŒr iOS): `sudo gem install cocoapods` + +### 1. Dependencies installieren + +```bash +npm install +``` + +### 2. iOS Setup + +```bash +cd ios +pod install +cd .. +``` + +### 3. Supabase konfigurieren + +1. Gehe zu [supabase.com](https://supabase.com) und erstelle ein neues Projekt +2. Erstelle die folgende Tabellen-Struktur: + +**Users Tabelle** (wird automatisch von Supabase Auth erstellt) + +**Contracts Tabelle:** +```sql +CREATE TABLE contracts ( + id UUID DEFAULT gen_random_uuid() PRIMARY KEY, + user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE, + name TEXT NOT NULL, + provider TEXT NOT NULL, + category TEXT NOT NULL, + start_date TIMESTAMP WITH TIME ZONE NOT NULL, + end_date TIMESTAMP WITH TIME ZONE, + cancellation_deadline TIMESTAMP WITH TIME ZONE, + notice_period INTEGER NOT NULL, + cost NUMERIC(10,2) NOT NULL, + billing_cycle TEXT NOT NULL, + auto_renewal BOOLEAN DEFAULT false, + notes TEXT, + documents JSONB DEFAULT '[]', + reminder_enabled BOOLEAN DEFAULT true, + reminder_days INTEGER DEFAULT 30, + status TEXT DEFAULT 'active', + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Index fĂŒr bessere Performance +CREATE INDEX contracts_user_id_idx ON contracts(user_id); +CREATE INDEX contracts_status_idx ON contracts(status); +CREATE INDEX contracts_cancellation_deadline_idx ON contracts(cancellation_deadline); + +-- Row Level Security aktivieren +ALTER TABLE contracts ENABLE ROW LEVEL SECURITY; + +-- Policy: Benutzer können nur ihre eigenen VertrĂ€ge sehen +CREATE POLICY "Users can view own contracts" + ON contracts FOR SELECT + USING (auth.uid() = user_id); + +-- Policy: Benutzer können nur ihre eigenen VertrĂ€ge erstellen +CREATE POLICY "Users can insert own contracts" + ON contracts FOR INSERT + WITH CHECK (auth.uid() = user_id); + +-- Policy: Benutzer können nur ihre eigenen VertrĂ€ge aktualisieren +CREATE POLICY "Users can update own contracts" + ON contracts FOR UPDATE + USING (auth.uid() = user_id); + +-- Policy: Benutzer können nur ihre eigenen VertrĂ€ge löschen +CREATE POLICY "Users can delete own contracts" + ON contracts FOR DELETE + USING (auth.uid() = user_id); +``` + +3. Kopiere deine Supabase Credentials: + - Project URL + - Anon Key + +4. Erstelle `.env` Datei im Root-Verzeichnis: +```env +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_ANON_KEY=your-anon-key-here +``` + +5. Aktualisiere `src/config/index.ts` mit deinen Credentials + +### 4. App starten + +**iOS:** +```bash +npm run ios +``` + +**Android:** +```bash +npm run android +``` + +**Metro Bundler (Development Server):** +```bash +npm start +``` + +## 📁 Projekt-Struktur + +``` +app-v0.0.1/ +├── src/ +│ ├── modules/ # Feature-Module +│ │ ├── auth/ # Authentifizierung +│ │ ├── contracts/ # Vertrags-Verwaltung +│ │ ├── dashboard/ # Übersicht +│ │ ├── notifications/ # Erinnerungen +│ │ └── profile/ # Benutzerprofil +│ ├── shared/ # Gemeinsame Ressourcen +│ │ ├── components/ # UI-Komponenten +│ │ ├── hooks/ # Custom Hooks +│ │ ├── utils/ # Hilfsfunktionen +│ │ ├── constants/ # Konstanten +│ │ ├── types/ # TypeScript Typen +│ │ └── theme/ # Design System +│ ├── navigation/ # Navigation +│ ├── store/ # Zustand State Management +│ └── config/ # Konfiguration +├── assets/ # Bilder, Fonts +├── ios/ # iOS-spezifisch +├── android/ # Android-spezifisch +└── App.tsx # Entry Point +``` + +## 🔧 NĂ€chste Schritte + +### Phase 1: MVP Features entwickeln + +1. **Auth Screens erstellen** + - Login Screen + - Register Screen + - Passwort Reset + +2. **Contract Screens erstellen** + - VertrĂ€ge Liste + - Vertrag hinzufĂŒgen + - Vertrag bearbeiten + - Vertrag Details + +3. **Dashboard erstellen** + - Übersicht aller VertrĂ€ge + - Monatliche Kosten + - Anstehende KĂŒndigungsfristen + +4. **Notifications implementieren** + - Push-Benachrichtigungen Setup + - Erinnerungen fĂŒr KĂŒndigungsfristen + +### Neues Feature hinzufĂŒgen + +1. Erstelle einen neuen Ordner in `src/modules/` +2. Struktur: + ``` + src/modules/mein-feature/ + ├── screens/ + ├── components/ + ├── hooks/ + ├── services/ + └── types/ + ``` +3. Implementiere deine Screens und Komponenten +4. FĂŒge Navigation in `src/navigation/RootNavigation.tsx` hinzu +5. Optional: Erstelle einen Store in `src/store/` + +### Komponenten verwenden + +```tsx +import { Button, Input, ContractCard } from '@shared/components'; + +// Button +