Directory Overview
Key Directories
/app - Pages and API Routes
The app/ directory uses Next.js App Router conventions:
page.tsxfiles define route pageslayout.tsxfiles define shared layoutsapi/contains server-side API route handlers
/components - Reusable Components
Components are organized by scope:
- Root level: App-wide components (
Header,TTAIIframe) auth/: Authentication-related componentsui/: shadcn/ui primitive components
/lib - Utilities and Configuration
Core application logic:
config.ts: Centralized environment variablesconstants.ts: App-wide constants and MBTI datastore.ts: Zustand state managementttai/: ToughTongue AI integration module
Key Files Explained
lib/config.ts
Centralizes all environment configuration:
lib/constants.ts
Contains routes and static data:
lib/store.ts
Zustand store with localStorage persistence:
lib/ttai/
ToughTongue integration module - see ToughTongue Integration.
Adding New Features
Adding a New Page
- Create directory in
app/:
- Add route to
lib/constants.ts:
- Add navigation link in
components/Header.tsx
Adding a New Component
- Shared component: Add to
components/ - Feature-specific: Keep in the feature’s directory
- UI primitive: Add to
components/ui/using shadcn/ui patterns
Adding a New API Route
Create route handler inapp/api/:
Next Steps
ToughTongue Integration
Learn the integration patterns
State & Auth
State management and authentication