How zackha/habit works
Main Components
A. Frontend Layer:
• Client-side Application (Nuxt 3)
• Components Structure
• State Management (Pinia)
• UI Components (Nuxt UI)
B. Server Layer:
• SSR Engine
• API Routes
• Authentication Service
• Database Layer
Detailed Component Breakdown
Frontend Components (Top Layer):
• Core Components (AppHeader, AppFooter)
• Feature Components (HabitCard, HabitForm, HabitHeatmap)
• State Management Layer (Pinia Store)
• Composables (useHabits, useHeatmap, useConfetti)
API Layer (Middle Layer):
• Auth Routes (/api/auth/github)
• Habit Routes (/api/habits/*)
• Authentication flow with GitHub
Database Layer (Bottom Layer):
• SQLite Database with Drizzle ORM
• Schema representation for:
• Habits table
• User data
• Tracking data
Connection Flows
• User authentication flow through GitHub
• Data flow between frontend and API
• Database interactions
• SSR data flow
Technical Stack Indicators
Technology labels:
• Nuxt 3
• Drizzle ORM
• SQLite
• Nuxt UI
• Pinia
• nuxt-auth-utils
Deployment Flow
A section showing:
• NuxtHub deployment process
• Build and compilation process
Key Recommendations:
Authentication flow as a critical path
Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make this application unique, such as the SSR implementation, GitHub authentication, and the habit tracking functionality.