A modern, AI-powered pregnancy companion platform designed to support expecting mothers throughout their journey with personalized insights, daily tips, and comprehensive tracking tools.
Birdie (ΠΠ΅Π»Π΅ΠΊΠ°) is a comprehensive pregnancy companion application that helps expecting mothers track their journey, manage daily tasks, maintain a personal diary, and receive AI-powered insights tailored to their pregnancy week. The application provides a seamless, user-friendly experience with both authenticated and guest access modes.
- Personalized Experience: Week-by-week pregnancy journey tracking with customized content
- Daily Support: Daily tips, baby development information, and emotional wellness tracking
- Task Management: Organize and track pregnancy-related tasks and reminders
- AI Assistance: Google Gemini AI integration for intelligent support and insights
- Privacy-First: Secure authentication with session management and protected routes
- Next.js 15.5.2 - React framework with App Router
- React 19.1.0 - UI library
- TypeScript 5 - Type safety and developer experience
- Zustand 5.0.8 - Lightweight state management
- TanStack Query 5.87.4 - Server state management and caching
- Axios 1.11.0 - HTTP client with interceptors
- Formik 2.4.6 - Form management
- Yup 1.7.0 - Schema validation
- @google/generative-ai 0.24.1 - Google Gemini AI integration
- CSS Modules - Scoped styling
- Radix UI - Accessible component primitives
- React Hot Toast 2.6.0 - Toast notifications
- Flatpickr 4.6.13 - Date picker component
- ESLint - Code linting
- Prettier - Code formatting
- Turbopack - Fast bundler for development
The application follows Next.js 15 App Router conventions with a clear separation of concerns:
birdie/
βββ app/ # Next.js App Router pages and API routes
β βββ (auth routes)/ # Authentication pages (login, register)
β βββ (sidebar routes)/ # Main application pages (dashboard, diary, journey, profile)
β βββ api/ # Next.js API routes (proxies to backend)
βββ components/ # Reusable React components
βββ lib/ # Utilities, hooks, and shared logic
βββ services/ # External service integrations
βββ types/ # TypeScript type definitions
βββ styles/ # Global styles and theme tokens
- Public Routes:
/auth/*- Authentication pages - Protected Routes:
/diary,/journey,/profile- Require authentication - Public Dashboard:
/- Accessible to all users with limited features
- Session Management: Cookie-based authentication with access and refresh tokens
- Middleware Protection: Route-level authentication via Next.js middleware
- Token Refresh: Automatic token refresh on 401 responses
- State Synchronization: Zustand store for client-side auth state
- Server Components: Initial data fetching with React Query prefetching
- Client Components: Real-time updates and mutations
- Caching: TanStack Query for intelligent caching and background refetching
- Optimistic Updates: Enhanced UX with optimistic UI updates
- Personalized greeting based on user profile
- Daily baby development information
- Pregnancy tips and advice
- Task reminders and management
- Emotional wellness check-in
- Week-by-week pregnancy progression
- Detailed information for each pregnancy week
- Visual journey timeline
- Personalized content based on due date
- Create and manage diary entries
- Tag-based organization
- Search and filter functionality
- Emotion tracking integration
- Rich text support
- Create, update, and complete tasks
- Date-based task scheduling
- Task reminders
- Integration with dashboard
- Google Gemini AI-powered assistant
- Context-aware responses based on pregnancy week
- Multiple interaction modes:
- Chat interface
- Insights and recommendations
- Reminder suggestions
- Diary entry assistance
- Task management help
- Draggable floating interface
- User profile editing
- Avatar upload and management
- Pregnancy information tracking
- Account settings
- Secure registration and login
- Session persistence
- Protected route access
- Guest mode with limited features
- Node.js 20.x or higher
- npm or compatible package manager
- Git for version control
-
Clone the repository
git clone <repository-url> cd birdie
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env.local
See Environment Variables for required configuration.
-
Start the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
npm run dev- Start development server with Turbopacknpm run build- Build production bundlenpm run start- Start production servernpm run lint- Run ESLint
Next.js App Router structure:
(auth routes)/auth/- Authentication pages(sidebar routes)/- Main application pagespage.tsx- Dashboarddiary/- Diary pagesjourney/[weekNumber]/- Journey pagesprofile/- Profile pages
api/- API route handlers (proxies to backend)
Reusable React components organized by feature:
AuthProvider/- Authentication contextGeminiAssistant/- AI assistant componentDiaryEntryCard/,DiaryList/- Diary componentsTasksReminderCard/,AddTaskForm/- Task componentsSideBar/,Header/- Navigation components- And many more...
Shared utilities and configurations:
api/- API client functions (server and client)hooks/- Custom React hooksstore/- Zustand stores (auth, UI state)pregnancy/- Pregnancy calculation utilitiesaxios.ts- Axios instance with interceptors
External service integrations:
gemini-ai.service.ts- Google Gemini AI serviceemotionsService.ts- Emotion tracking service
TypeScript type definitions for:
- User, Baby, Diary, Task, Week, Tip, and Gemini AI types
Create a .env.local file in the root directory with the following variables:
# Backend API Configuration
API_BASE_URL=https://lehlehka.b.goit.study
NEXT_PUBLIC_API_URL=http://localhost:3000
# Google Gemini AI (Optional - for AI Assistant feature)
NEXT_PUBLIC_GEMINI_API_KEY=your_gemini_api_key_hereAPI_BASE_URL: Backend API base URL (used in server-side API routes)NEXT_PUBLIC_API_URL: Public API URL (used in client-side requests)NEXT_PUBLIC_GEMINI_API_KEY: Required for AI Assistant functionality (optional)
- TypeScript: Strict mode enabled, prefer explicit types
- Components: Use functional components with TypeScript
- Styling: CSS Modules for component-scoped styles
- Naming: PascalCase for components, camelCase for functions/variables
// Component structure example
export default function ComponentName() {
// 1. Hooks and state
// 2. Data fetching
// 3. Event handlers
// 4. Render
}- Zustand: Global application state (auth, UI)
- TanStack Query: Server state and caching
- Local State: React useState for component-specific state
- Server Components: Use
lib/api/serverApi.tsfunctions - Client Components: Use
lib/api/clientApi.tsfunctions - API Routes: Proxy pattern in
app/api/directory - Error Handling: Consistent error handling with axios interceptors
- Use semantic HTML elements
- Include ARIA labels where appropriate
- Ensure keyboard navigation support
- Test with screen readers
- Leverage Next.js Image optimization
- Use React Query caching strategies
- Implement code splitting where appropriate
- Optimize bundle size with dynamic imports
The application connects to a backend API at https://lehlehka.b.goit.study. All API communication is proxied through Next.js API routes for security and cookie handling.
The application provides the following API endpoints:
/api/auth/*- Authentication (login, register, logout, session)/api/users/*- User management/api/diary/*- Diary entries/api/tasks/*- Task management/api/notes/*- Notes management/api/emotions/*- Emotion tracking/api/weeks/*- Pregnancy week information
- User credentials sent to
/api/auth/login - Backend returns access and refresh tokens (cookies)
- Tokens stored in HTTP-only cookies
- Middleware validates tokens for protected routes
- Automatic token refresh on expiration
- Pregnancy Calculations: Week calculations based on due date in
lib/pregnancy/week.ts - Theme System: CSS custom properties in
styles/theme-tokens.css - Icon System: SVG sprite system in
components/Icon/ - Logo System: Brand logo components in
components/Logo/