Implemented comprehensive voice command understanding system: **Intent Classification:** - Feeding intent (bottle, breastfeeding, solid food) - Sleep intent (naps, nighttime sleep) - Diaper intent (wet, dirty, both, dry) - Unknown intent handling **Entity Extraction:** - Amounts with units (ml, oz, tbsp): "120 ml", "4 ounces" - Durations in minutes: "15 minutes", "for 20 mins" - Time expressions: "at 3:30 pm", "30 minutes ago", "just now" - Breast feeding side: "left", "right", "both" - Diaper types: "wet", "dirty", "both" - Sleep types: "nap", "night" **Structured Data Output:** - FeedingData: type, amount, unit, duration, side, timestamps - SleepData: type, duration, start/end times - DiaperData: type, timestamp - Ready for direct activity creation **Pattern Matching:** - 15+ feeding patterns (bottle, breast, solid) - 8+ sleep patterns (nap, sleep, woke up) - 8+ diaper patterns (wet, dirty, bowel movement) - Robust keyword detection with variations **Confidence Scoring:** - High: >= 0.8 (strong match) - Medium: 0.5-0.79 (probable match) - Low: < 0.5 (uncertain) - Minimum threshold: 0.3 for validation **API Endpoint:** - POST /api/voice/transcribe - Classify text or audio - GET /api/voice/transcribe - Get supported commands - JSON response with intent, confidence, entities, structured data - Audio transcription placeholder (Whisper integration ready) **Implementation Files:** - lib/voice/intentClassifier.ts - Core classification (600+ lines) - app/api/voice/transcribe/route.ts - API endpoint - scripts/test-voice-intent.mjs - Test suite (25 tests) - lib/voice/README.md - Complete documentation **Test Coverage:** 25 tests, 100% pass rate ✅ Bottle feeding (3 tests) ✅ Breastfeeding (3 tests) ✅ Solid food (2 tests) ✅ Sleep tracking (6 tests) ✅ Diaper changes (7 tests) ✅ Edge cases (4 tests) **Example Commands:** - "Fed baby 120 ml" → bottle, 120ml - "Nursed on left breast for 15 minutes" → breast_left, 15min - "Changed wet and dirty diaper" → both - "Napped for 45 minutes" → nap, 45min System converts natural language to structured tracking data with high accuracy for common parenting voice commands. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Maternal App - AI-Powered Parenting Assistant
An AI-powered mobile application designed to help parents manage childcare for children aged 0-6 years. Features intelligent tracking, real-time family sync, and AI-powered parenting support using LLMs.
🚀 Project Status
Phase 0: Development Environment Setup ✅ COMPLETED
- ✅ React Native mobile app initialized with Expo
- ✅ NestJS backend API initialized
- ✅ Docker Compose infrastructure configured
- ✅ ESLint & Prettier configured
- ✅ Environment variables set up
- ✅ All services running
Next Phase: Phase 1 - Foundation & Authentication (Week 1-2)
🏗️ Architecture
Mobile Application
- Framework: React Native + Expo (TypeScript)
- State Management: Redux Toolkit with offline-first architecture
- UI Components: React Native Paper (Material Design)
- Navigation: React Navigation
Backend API
- Framework: NestJS (Node.js + TypeScript)
- API Style: Hybrid REST + GraphQL + WebSocket
- Authentication: JWT with refresh tokens
Infrastructure
- Database: PostgreSQL 15 (port 5555)
- Cache/Queue: Redis 7 (port 6666)
- Document Store: MongoDB 6 (port 27777)
- Object Storage: MinIO (ports 9002/9003)
📋 Prerequisites
- Node.js: v18+ LTS
- npm: v8+
- Docker: Latest
- Docker Compose: Latest
- Expo CLI: Installed globally (optional)
🛠️ Installation & Setup
1. Clone and Install
# Clone the repository
cd maternal-app
# Install mobile app dependencies
cd maternal-app
npm install
cd ..
# Install backend dependencies
cd maternal-app-backend
npm install
cd ..
2. Start Infrastructure Services
# Start all Docker services (PostgreSQL, Redis, MongoDB, MinIO)
docker compose up -d
# Verify services are running
docker compose ps
# View logs if needed
docker compose logs -f
Service Ports (modified to avoid conflicts):
- PostgreSQL:
localhost:5555 - Redis:
localhost:6666 - MongoDB:
localhost:27777 - MinIO API:
localhost:9002 - MinIO Console:
localhost:9003
3. Configure Environment Variables
Backend environment file is already created at maternal-app-backend/.env. Update API keys as needed:
# Edit backend .env file
cd maternal-app-backend
nano .env # or use your preferred editor
Important: Add your AI service API keys:
OPENAI_API_KEY- For GPT-4 integrationANTHROPIC_API_KEY- For Claude integration (optional)GOOGLE_AI_API_KEY- For Gemini integration (optional)
🚀 Running the Application
Start Backend API
cd maternal-app-backend
# Development mode with hot-reload
npm run start:dev
# Production mode
npm run start:prod
# Watch mode
npm run start:watch
Backend will be available at: http://localhost:3000
Start Mobile App
cd maternal-app
# Start Expo development server
npm start
# Or run directly on iOS simulator
npm run ios
# Or run directly on Android emulator
npm run android
# Or run in web browser
npm run web
🧪 Testing
Backend Tests
cd maternal-app-backend
# Run unit tests
npm test
# Run tests with coverage
npm run test:cov
# Run E2E tests
npm run test:e2e
# Run tests in watch mode
npm run test:watch
Mobile App Tests
cd maternal-app
# Run tests
npm test
📁 Project Structure
maternal-app/
├── docs/ # Comprehensive documentation
│ ├── maternal-app-tech-stack.md
│ ├── maternal-app-implementation-plan.md
│ ├── maternal-app-api-spec.md
│ ├── maternal-app-ai-context.md
│ └── ... (12 more detailed docs)
├── maternal-app/ # React Native mobile app
│ ├── src/
│ │ ├── components/
│ │ ├── screens/
│ │ ├── services/
│ │ ├── redux/
│ │ ├── navigation/
│ │ └── types/
│ ├── package.json
│ └── .eslintrc.js
├── maternal-app-backend/ # NestJS backend API
│ ├── src/
│ │ ├── modules/
│ │ │ ├── auth/
│ │ │ ├── users/
│ │ │ ├── families/
│ │ │ └── ...
│ │ ├── common/
│ │ └── database/
│ ├── package.json
│ └── .env
├── docker-compose.yml # Infrastructure services
├── .env.example # Environment template
├── CLAUDE.md # AI assistant guidance
└── README.md # This file
🗄️ Database Management
Connect to PostgreSQL
# Using docker exec
docker exec -it maternal-postgres psql -U maternal_user -d maternal_app
# Or use your preferred PostgreSQL client
Host: localhost
Port: 5555
Database: maternal_app
User: maternal_user
Password: maternal_dev_password_2024
Connect to MongoDB
# Using mongosh
mongosh "mongodb://maternal_admin:maternal_mongo_password_2024@localhost:27777/maternal_ai_chat?authSource=admin"
Connect to Redis
# Using redis-cli
redis-cli -p 6666
Access MinIO Console
Open browser: http://localhost:9003
Login credentials:
- Username:
maternal_minio_admin - Password:
maternal_minio_password_2024
📚 Development Workflow
Branch Naming
feature/- New featuresbugfix/- Bug fixeshotfix/- Critical fixesdocs/- Documentation updates
Commit Messages (Conventional Commits)
feat: add voice input for feeding tracker
fix: resolve timezone sync issue
docs: update API documentation
test: add unit tests for sleep predictor
Code Quality
# Lint mobile app
cd maternal-app
npm run lint
# Lint backend
cd maternal-app-backend
npm run lint
# Format code
npm run format
🔐 Security Notes
- Never commit
.envfiles - they are gitignored - Change all default passwords in production
- Rotate JWT secrets regularly
- Keep API keys secure and never expose them in client code
📖 Documentation
Comprehensive documentation is available in the /docs directory:
- Technical Stack - Complete technology choices and libraries
- Implementation Plan - 8-phase development roadmap with AI role guidance
- API Specification - REST/GraphQL/WebSocket endpoint specs
- AI Context Management - LangChain configuration and prompt templates
- State Management - Redux architecture with offline support
- UI/UX Design System - Material Design with warm color palette
- Testing Strategy - Unit, integration, and E2E testing approach
- Database Migrations - Schema design and migration scripts
- Environment Configuration - Docker and environment setup
- Error Handling - Error codes and logging standards
- Mobile Deployment - iOS/Android build and release process
- Voice Processing - Voice input patterns and NLP
🎯 MVP Features (6-8 Weeks)
Core Features
- Tracking: Feeding, sleep, diapers with voice input
- AI Assistant: 24/7 contextual parenting support
- Family Sync: Real-time updates via WebSocket
- Pattern Recognition: Sleep predictions, feeding trends
- Analytics: Daily/weekly summaries, exportable reports
Supported Languages
- English (en-US)
- Spanish (es-ES)
- French (fr-FR)
- Portuguese (pt-BR)
- Simplified Chinese (zh-CN)
🤝 Development Commands Cheat Sheet
# Infrastructure
docker compose up -d # Start all services
docker compose down # Stop all services
docker compose logs -f # View logs
# Backend
cd maternal-app-backend
npm run start:dev # Start with hot-reload
npm run build # Build for production
npm test # Run tests
npm run lint # Lint code
# Mobile
cd maternal-app
npm start # Start Expo
npm run ios # Run on iOS
npm run android # Run on Android
npm test # Run tests
npm run lint # Lint code
🐛 Troubleshooting
Ports Already in Use
If you see port conflict errors, the docker-compose.yml uses non-standard ports:
- PostgreSQL: 5555 (not 5432)
- Redis: 6666 (not 6379)
- MongoDB: 27777 (not 27017)
Docker Services Not Starting
# Check service status
docker compose ps
# View specific service logs
docker compose logs <service-name>
# Restart a specific service
docker compose restart <service-name>
Mobile App Won't Start
# Clear Expo cache
cd maternal-app
rm -rf .expo
npm start --clear
📞 Next Steps
-
Phase 1: Implement authentication system (Week 1-2)
- JWT authentication with device fingerprinting
- User registration and login
- Password reset flow
- Multi-language support setup
-
Phase 2: Child profiles & family management (Week 2-3)
-
Phase 3: Core tracking features (Week 3-4)
-
Phase 4: AI assistant integration (Week 4-5)
-
Phase 5: Pattern recognition & analytics (Week 5-6)
-
Phase 6: Testing & optimization (Week 6-7)
-
Phase 7: Beta testing & launch prep (Week 7-8)
📄 License
[Add your license here]
🙏 Acknowledgments
Built following comprehensive technical documentation and industry best practices for parenting apps.
For detailed implementation guidance, see /docs/maternal-app-implementation-plan.md