Project Structure

.claude/rules/architecture.md

← Zurück zu Knowledge

Project Structure

.claude/rules/architecture.md · 4.4K

---
paths:
  - "apps/**"
  - "packages/**"
  - "supabase/**"
---

# Project Structure

```
apps/mobile/                     → Expo React Native app (expo-router, file-based routing)
  app/(tabs)/                    → Tab screens: Home (index), Progress, Squad, Profile
  app/onboarding/                → Welcome → Name → Goal → Habits → Done flow
  app/goal/[id].tsx + create.tsx → Goal detail + creation modal
  app/profile/edit.tsx + premium → Edit profile + premium upsell
  app/_layout.tsx                → Root layout with OnboardingGate redirect
  components/                    → ~30 reusable UI components
  hooks/                         → useTheme, useAppData, useGoal, useActiveGoal, useProgressData
  lib/                           → date, storage, streak, xp, progress, achievements,
                                   onboarding-presets, initial-data, mock-data, avatar, notifications
  providers/                     → ThemeProvider, AppDataProvider, OnboardingProvider
  theme/                         → Light + dark color maps from @carrot/shared
  types/                         → All domain types

apps/web/                        → Astro landing page (static, zero JS by default)
  src/layouts/Layout.astro       → Base HTML, fonts, OG, view-transitions
  src/pages/                     → EN at /, DE at /de, /internal noindexed
  src/components/sections/       → Hero, Manifesto, LiveDemo, SquadStory, BentoGrid,
                                   Founders, Pricing, Waitlist, SiteFooter, TopNav
  src/components/                → LandingPage.astro composer + PhoneFrame.astro
  src/i18n/                      → translations.ts (EN + DE)
  src/styles/                    → global.css + animations.css
  src/scripts/                   → reveal.ts (IntersectionObserver) + live-demo.ts (JS island)
  astro.config.mjs               → static output, i18n en + de

apps/admin/                      → Astro 5 admin portal (static, deploys to CF Pages on push)
  src/pages/                     → 9 sections: index, users, waitlist, squads, content,
                                   knowledge (+ [slug].astro dynamic), infrastructure, design-system, settings
  src/pages/404.astro            → 404 page (not-found)
  src/layouts/DashboardLayout.astro → Shared shell (sidebar + topbar + Tailwind globals)
  src/components/                → Sidebar.astro, Topbar.astro, StatCard.astro (all 0KB JS)
                                   ActivityChart.tsx (only React island — recharts client:only="react")
  src/lib/                       → nav (inline lucide SVG paths), mock-data (32 users / 247 waitlist / 4 squads),
                                   content-presets, docs (md reader)
  src/styles/global.css          → Tailwind 4 with @theme tokens
  astro.config.mjs               → react integration + @tailwindcss/vite plugin
  public/_headers + favicon.svg  → Security headers + carrot 🥕 favicon

packages/shared/                 → Shared across all apps
  src/constants/                 → Design tokens (colors, spacing, typography, radii, shadows, animation)
  src/database.types.ts          → Manual stub mirroring supabase/migrations/0001-0009 (replace via npm run db:types when project linked)

supabase/                        → Backend (project not yet created)
  migrations/0001..0009.sql      → Chronological migrations: profiles, goals, habits, xp, badges, squads, squad_features, waitlist, pg_cron jobs
  seed.sql                       → German test data (5 users, 1 squad, sample goals/habits/completions)
  functions/                     → Deno Edge Functions (placeholder)

docs/superpowers/plans/          → Implementation plans (master-overhaul + mobile-plan-2..7 + plan-1-foundation)
docs/superpowers/specs/          → Feature specs (dummy-app-design)
docs/                            → ARCHITECTURE.md, DEPENDENCIES.md, LANDING_PAGE_DESIGN.md, MARKET_RESEARCH.md
```

## Architecture blueprint

Three-app monorepo pattern: mobile + landing + admin. Mobile uses an offline-first AsyncStorage layer
today (interface-first so swap to Supabase is one provider change). Landing and admin are both Astro 5
static sites (zero JS by default — admin has one React island for recharts). All three deploy
independently as Cloudflare Pages projects with auto-deploy on push to `main`.

Based on the proven Hof project (meinhofladen.at) for monorepo patterns and Expo local builds.