Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒธ Maitri โ€” Know Your Cycle

The first period tracker that teaches you what your cycle is actually telling you โ€” privately, safely, and with people who get it.

Maitri is a privacy-first, AI-powered women's health Progressive Web App (PWA). It goes beyond simple period prediction โ€” connecting your logged symptoms to real physiological explanations, surfacing patterns you'd never notice on your own, and providing a safe, moderated community of women at similar life stages.

Version PWA License


โœจ Features

๐Ÿฉธ Intelligent Cycle Tracking

  • Log cycle start dates and receive phase predictions (Menstrual, Follicular, Ovulatory, Luteal)
  • Visual progress bar showing where you are in your current cycle
  • Transparent confidence tiers โ€” predictions get smarter with every logged cycle

๐Ÿ“ Daily Symptom Journal

  • Quick micro-conversation check-ins (energy, physical symptoms, mood) designed to take under 30 seconds
  • Calendar-style history view of all logged entries
  • Automatic pattern surfacing after 2+ cycles of data

๐Ÿค– Ask Maitri โ€” AI Health Companion

  • Phase-aware, empathetic AI chatbot that knows your current cycle phase and recent symptoms
  • Multi-provider failover across Google Gemini, Groq (Llama 3), and OpenRouter for 99.9% uptime
  • Persistent chat history with conversations grouped by date in a collapsible sidebar
  • Per-user rate limiting and server-side AI response caching
  • Strictly scoped to women's health topics โ€” off-topic queries are gracefully declined

๐Ÿซ‚ Community Circles

  • Anonymous, moderated spaces grouped by life stage (Teens, 20s & 30s, Perimenopause, etc.)
  • Structured post types: Questions, Experiences, Wins, Resources
  • Upvoting, threaded replies, and weekly engagement prompts

๐Ÿ—„๏ธ Health Vault & Data Export

  • Complete history of cycle patterns, symptom logs, and AI conversations
  • One-click data export for sharing with healthcare providers
  • Full data deletion capabilities

๐Ÿ” Privacy & Security

  • OTP-based passwordless authentication via email
  • JWT session management with secure token handling
  • Minor-user safety: automatic age detection at signup with optional parental consent flow
  • Toggle-able pattern detection, AI chat history retention, and push notifications
  • Customisable profiles with avatar and accent colour selection

๐Ÿ“ฑ Progressive Web App (PWA)

  • Installable on mobile (Android & iOS) and desktop
  • Offline-capable with service worker caching
  • Push notification support for cycle reminders and insights
  • Native app-like experience with standalone display mode

๐Ÿ› ๏ธ Technology Stack

Frontend

Technology Purpose
React 19 (Vite 7) UI framework with fast HMR
React Router DOM v7 Client-side routing with protected routes
TailwindCSS 3 Utility-first responsive styling
Axios HTTP client for API communication
React Icons Icon library

Backend

Technology Purpose
Node.js / Express 5 REST API server
MongoDB / Mongoose 9 Database & ODM
JWT Stateless session authentication
Nodemailer OTP email delivery
web-push Browser push notifications (VAPID)
Helmet HTTP security headers
express-rate-limit API rate limiting
Morgan HTTP request logging

AI Service Layer

A custom multi-provider fallback system with automatic cascade across providers and models:

  1. Google Gemini API โ€” Primary
    • Tries gemini-2.5-flash โ†’ gemini-2.0-flash โ†’ gemini-1.5-flash in sequence
  2. Groq API (llama3-8b-8192) โ€” Secondary
  3. OpenRouter API โ€” Tertiary (free model pool)
    • Tries gemma-3-12b-it โ†’ gemma-3n-e2b-it โ†’ gemma-2-9b-it โ†’ mistral-small-3.1-24b in sequence

Deployment

Service Role
Vercel Frontend hosting + serverless API functions

๐Ÿ“ Project Structure

Maitri/
โ”œโ”€โ”€ public/                     # Static assets & PWA files
โ”‚   โ”œโ”€โ”€ manifest.json           # PWA web app manifest
โ”‚   โ”œโ”€โ”€ sw.js                   # Service worker (caching + push)
โ”‚   โ”œโ”€โ”€ android-chrome-*.png    # App icons (192ร—192, 512ร—512)
โ”‚   โ”œโ”€โ”€ apple-touch-icon.png    # iOS home screen icon
โ”‚   โ””โ”€โ”€ favicon.*               # Browser favicons
โ”‚
โ”œโ”€โ”€ src/                        # React frontend
โ”‚   โ”œโ”€โ”€ main.jsx                # Entry point + SW registration
โ”‚   โ”œโ”€โ”€ App.jsx                 # Root component & routing
โ”‚   โ”œโ”€โ”€ index.css               # Global styles & design tokens
โ”‚   โ”œโ”€โ”€ context/
โ”‚   โ”‚   โ”œโ”€โ”€ AuthContext.jsx     # Authentication state provider
โ”‚   โ”‚   โ””โ”€โ”€ ToastContext.jsx    # Toast notification provider
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ””โ”€โ”€ layout/
โ”‚   โ”‚       โ”œโ”€โ”€ AppLayout.jsx   # Protected layout shell with nav
โ”‚   โ”‚       โ””โ”€โ”€ AppLayout.css
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ””โ”€โ”€ api.js              # Axios instance & interceptors
โ”‚   โ””โ”€โ”€ pages/
โ”‚       โ”œโ”€โ”€ LandingPage.jsx     # Public marketing page
โ”‚       โ”œโ”€โ”€ LoginPage.jsx       # OTP login
โ”‚       โ”œโ”€โ”€ SignupPage.jsx       # Registration flow
โ”‚       โ”œโ”€โ”€ VerifyEmailPage.jsx # Email verification
โ”‚       โ”œโ”€โ”€ HomePage.jsx        # Dashboard with cycle tracking
โ”‚       โ”œโ”€โ”€ JournalPage.jsx     # Daily symptom check-ins
โ”‚       โ”œโ”€โ”€ AskMaitriPage.jsx   # AI chat interface
โ”‚       โ”œโ”€โ”€ CommunityPage.jsx   # Community circles
โ”‚       โ”œโ”€โ”€ VaultPage.jsx       # Health data vault & export
โ”‚       โ””โ”€โ”€ ProfilePage.jsx     # User profile & settings
โ”‚
โ”œโ”€โ”€ server/                     # Express backend
โ”‚   โ”œโ”€โ”€ index.js                # Server entry point
โ”‚   โ”œโ”€โ”€ package.json            # Backend dependencies
โ”‚   โ”œโ”€โ”€ controllers/
โ”‚   โ”‚   โ”œโ”€โ”€ authController.js       # Signup, login, OTP, verify
โ”‚   โ”‚   โ”œโ”€โ”€ cycleController.js      # Cycle CRUD & predictions
โ”‚   โ”‚   โ”œโ”€โ”€ journalController.js    # Daily log management
โ”‚   โ”‚   โ”œโ”€โ”€ insightController.js    # AI-generated daily insights
โ”‚   โ”‚   โ”œโ”€โ”€ askMaitriController.js  # AI chat endpoint
โ”‚   โ”‚   โ”œโ”€โ”€ communityController.js  # Posts, replies, upvotes
โ”‚   โ”‚   โ””โ”€โ”€ vaultController.js      # Data export & history
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ User.js             # User schema (auth, preferences, age bracket)
โ”‚   โ”‚   โ”œโ”€โ”€ Cycle.js            # Cycle records
โ”‚   โ”‚   โ”œโ”€โ”€ DailyLog.js         # Symptom journal entries
โ”‚   โ”‚   โ”œโ”€โ”€ Post.js             # Community posts
โ”‚   โ”‚   โ”œโ”€โ”€ Reply.js            # Threaded replies
โ”‚   โ”‚   โ”œโ”€โ”€ ChatHistory.js      # AI conversation persistence
โ”‚   โ”‚   โ””โ”€โ”€ AiCache.js          # Cached AI responses
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ”œโ”€โ”€ auth.js
โ”‚   โ”‚   โ”œโ”€โ”€ cycles.js
โ”‚   โ”‚   โ”œโ”€โ”€ journal.js
โ”‚   โ”‚   โ”œโ”€โ”€ insights.js
โ”‚   โ”‚   โ”œโ”€โ”€ askMaitri.js
โ”‚   โ”‚   โ”œโ”€โ”€ community.js
โ”‚   โ”‚   โ””โ”€โ”€ vault.js
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ””โ”€โ”€ aiService.js        # Multi-provider AI fallback engine
โ”‚   โ””โ”€โ”€ middleware/             # Auth guards & rate limiters
โ”‚
โ”œโ”€โ”€ api/                        # Vercel serverless adapter
โ”œโ”€โ”€ index.html                  # App shell (PWA-configured)
โ”œโ”€โ”€ vite.config.js              # Vite config with API proxy
โ”œโ”€โ”€ tailwind.config.js          # Tailwind theme configuration
โ”œโ”€โ”€ vercel.json                 # Vercel deployment config
โ””โ”€โ”€ package.json                # Root dependencies & scripts

๐Ÿš€ Getting Started

Prerequisites

1. Clone the Repository

git clone https://github.com/Pratik-kr21/Maitri.git
cd Maitri

2. Install Dependencies

# Frontend dependencies
npm install

# Backend dependencies
cd server
npm install
cd ..

3. Configure Environment Variables

Backend โ€” server/.env

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
JWT_EXPIRE=30d

# Email (Gmail App Password recommended)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_email_app_password
CLIENT_URL=http://localhost:5173
NODE_ENV=development

# AI Providers โ€” at least one is required
GEMINI_API_KEY=your_gemini_api_key
GROQ_API_KEY=your_groq_api_key
OPENROUTER_API_KEY=your_openrouter_api_key

# Push Notifications โ€” generate with: npx web-push generate-vapid-keys
VAPID_PUBLIC_KEY=your_vapid_public_key
VAPID_PRIVATE_KEY=your_vapid_private_key

Frontend โ€” .env (project root)

VITE_VAPID_PUBLIC_KEY=your_vapid_public_key
VITE_API_URL=http://localhost:5000/api

4. Run the Application

You need two terminal windows:

# Terminal 1 โ€” Backend
cd server
npm run dev
# Terminal 2 โ€” Frontend
npm run dev

Open http://localhost:5173 in your browser.

5. Build for Production

npm run build    # Outputs to dist/
npm run preview  # Preview the production build locally

๐Ÿ“ฑ PWA Installation

Maitri is a fully installable Progressive Web App:

Platform How to Install
Android (Chrome) Tap the "Add to Home Screen" banner or use the browser menu โ†’ "Install App"
iOS (Safari) Tap the Share button โ†’ "Add to Home Screen"
Desktop (Chrome/Edge) Click the install icon in the address bar

Once installed, Maitri runs in standalone mode with its own window, offline caching, and push notifications.


๐ŸŒ Deployment

The project is configured for Vercel deployment:

  1. Connect your GitHub repository to Vercel
  2. Set all environment variables from above in Vercel's dashboard
  3. The vercel.json handles routing โ€” API requests go to serverless functions, everything else falls through to the SPA

๐Ÿ—บ๏ธ Application Routes

Route Access Description
/ Public Landing page
/login Public OTP-based login
/signup Public Registration flow
/verify-email Public Email verification
/home Protected Dashboard with cycle tracking & insights
/journal Protected Daily symptom check-in
/ask Protected Ask Maitri AI companion
/community Protected Community circles
/vault Protected Health data vault & export
/profile Protected Settings & preferences

๐Ÿ”ฎ Future Enhancements

We are continuously working to improve Maitri. Here are some features on our roadmap:

  • โŒš Wearable Integration: Sync with Apple Health, Google Fit, and Oura Ring for automated basal body temperature (BBT) and sleep data logging.
  • ๐Ÿค Partner Sync: An opt-in feature to share cycle phase and empathy-driven tips with a trusted partner to foster understanding.
  • ๐ŸŒ Multilingual Support: Expanding the app interface and AI companion to support multiple languages for global accessibility.
  • ๐Ÿฉบ Provider Portal: A secure, HIPAA-compliant dashboard for healthcare providers to review patient-shared cycle data and symptom patterns.
  • ๐Ÿ‘ถ Advanced TTC Mode: Specialized features for those Trying to Conceive, including ovulation test strip scanning and detailed BBT charting.
  • ๐ŸŒ™ Dark Mode & Themes: Deeper UI customization including a dedicated dark mode that aligns with the premium aesthetic.

๐Ÿ”’ Disclaimer

Maitri provides health education only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.


๐Ÿค Contributing

Maitri thrives on community feedback! Here's how you can help:

  1. Report bugs โ€” Open an issue
  2. Request features โ€” Share your ideas in the issues tab
  3. Contribute code โ€” Fork the repo, create a branch, and submit a pull request


Built with ๐Ÿ’œ for women's health

Releases

Packages

Contributors

Languages