Skip to content

AmanCrafts/Menstrual-Health-Tracker

FlowSync Logo

🌸 FlowSync - Menstrual Health Tracker

Empowering reproductive health through intelligent tracking and insights

License: MIT React Node.js MongoDB PRs Welcome

Features β€’ Tech Stack β€’ Quick Start β€’ Documentation β€’ Contributing


πŸ“– Overview

FlowSync is a comprehensive, full-stack menstrual health tracking platform that empowers users to monitor, analyze, and understand their reproductive health through data-driven insights. Built with modern web technologies, FlowSync combines intelligent cycle predictions, symptom monitoring, mood tracking, and personalized wellness analytics to provide a holistic view of menstrual health.

🎯 Why FlowSync?

  • Health-First Approach: Wellness scoring based on actual health metrics, not just tracking frequency
  • Intelligent Predictions: Machine learning-powered cycle predictions using historical data
  • Comprehensive Analytics: Detailed insights into cycle regularity, symptoms, and mood patterns
  • Privacy-Focused: Secure authentication with data encryption and user-controlled storage
  • Educational Resources: Built-in guides about menstrual health, PMS management, and product selection
  • Responsive Design: Seamless experience across desktop, tablet, and mobile devices

✨ Features

🩺 Core Health Tracking

  • Period Logging: Track menstrual cycle start/end dates with flow intensity
  • Cycle Predictions: AI-powered predictions for next period, ovulation, and fertile window
  • Symptom Monitoring: Log 15+ common symptoms (cramps, headaches, fatigue, etc.)
  • Mood Tracking: Monitor emotional health throughout your cycle
  • Health Metrics: Track temperature, weight, and other vital health indicators

πŸ“Š Analytics & Insights

  • Wellness Score: Health-based scoring system (0-100) evaluating:
    • Cycle regularity and hormonal balance
    • Cycle and period length normalcy
    • Symptom burden severity
    • Emotional health patterns
  • Cycle Statistics: Average cycle length, regularity analysis, and trend visualization
  • Symptom Analysis: Frequency charts and pattern identification
  • Mood Patterns: Emotional health tracking across cycle phases

🎨 User Experience

  • Interactive Dashboard: Real-time cycle status with visual progress indicators
  • Calendar View: Month-by-month visualization of periods and logs
  • Quick BMI Calculator: Instant BMI calculation with health categorization
  • Test Mode: Explore the app with pre-populated sample data
  • Responsive Design: Optimized for mobile, tablet, and desktop

πŸ“š Education Hub

  • Understanding Your Cycle: Comprehensive guide to menstrual phases
  • PMS Management: Evidence-based tips for symptom relief
  • Product Guide: Information on menstrual products and sustainability

πŸ” Security & Privacy

  • JWT Authentication: Secure token-based authentication system
  • Password Hashing: bcrypt encryption for user credentials
  • HTTP-Only Cookies: Protection against XSS attacks
  • Rate Limiting: DDoS and brute-force attack prevention
  • Input Validation: Comprehensive validation to prevent injection attacks

πŸ›  Tech Stack

Frontend

Technology Purpose
React 19 UI framework with hooks and context API
React Router 7 Client-side routing and navigation
Vite 6 Lightning-fast build tool and dev server
React Calendar Interactive calendar component
CSS3 Custom styling with CSS variables and flexbox/grid

Backend

Technology Purpose
Node.js 18+ JavaScript runtime environment
Express.js 4 Web application framework
MongoDB NoSQL database for flexible data storage
Mongoose ODM for MongoDB with schema validation
JWT Secure authentication with JSON Web Tokens
bcryptjs Password hashing and encryption

DevOps & Tooling

Technology Purpose
ESLint Code quality and consistency enforcement
Prettier Automatic code formatting
Helmet Security headers and protection
Morgan HTTP request logging
Winston Application-level logging
Express Validator Request validation middleware
Express Rate Limit API rate limiting

API Architecture

  • RESTful API design principles
  • JWT-based authentication with refresh tokens
  • Role-based access control (RBAC) ready
  • Comprehensive error handling with custom error classes
  • Request validation at controller level

πŸš€ Quick Start

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/AmanCrafts/Menstrual-Health-Tracker.git
    cd Menstrual-Health-Tracker
  2. Install Backend Dependencies

    cd backend
    npm install
  3. Install Frontend Dependencies

    cd ../frontend
    npm install
  4. Environment Configuration

    Backend - Create backend/.env:

    # Server Configuration
    NODE_ENV=development
    PORT=5000
    
    # MongoDB Configuration
    MONGODB_URI=mongodb://localhost:27017/flowsync
    
    # JWT Configuration
    JWT_SECRET=your_super_secret_jwt_key_here_min_32_chars
    JWT_REFRESH_SECRET=your_refresh_token_secret_here
    JWT_EXPIRE=7d
    JWT_REFRESH_EXPIRE=30d
    
    # CORS Configuration
    CLIENT_URL=http://localhost:5173

    Frontend - Create frontend/.env:

    VITE_API_URL=http://localhost:5000/api
  5. Start MongoDB

    # macOS (Homebrew)
    brew services start mongodb-community
    
    # Linux
    sudo systemctl start mongod
    
    # Windows
    net start MongoDB
  6. Seed Database (Optional)

    cd backend
    npm run seed
  7. Start Development Servers

    Terminal 1 - Backend:

    cd backend
    npm run dev

    Backend runs on http://localhost:5000

    Terminal 2 - Frontend:

    cd frontend
    npm run dev

    Frontend runs on http://localhost:5173

  8. Access the Application

    Open your browser and navigate to http://localhost:5173

🎯 Test Mode

Want to explore without creating an account? Enable Test Mode from the login page to use pre-populated sample data and explore all features instantly!


πŸ“ Project Structure

MHT/
β”œβ”€β”€ backend/                    # Express.js API server
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/            # Configuration files
β”‚   β”‚   β”‚   β”œβ”€β”€ database.js    # MongoDB connection setup
β”‚   β”‚   β”‚   └── index.js       # Central config exports
β”‚   β”‚   β”œβ”€β”€ controllers/       # Request handlers
β”‚   β”‚   β”‚   β”œβ”€β”€ authController.js
β”‚   β”‚   β”‚   β”œβ”€β”€ periodController.js
β”‚   β”‚   β”‚   β”œβ”€β”€ symptomController.js
β”‚   β”‚   β”‚   β”œβ”€β”€ moodController.js
β”‚   β”‚   β”‚   └── healthController.js
β”‚   β”‚   β”œβ”€β”€ middleware/        # Custom middleware
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.js        # JWT verification
β”‚   β”‚   β”‚   └── errorHandler.js
β”‚   β”‚   β”œβ”€β”€ models/            # MongoDB schemas
β”‚   β”‚   β”‚   β”œβ”€β”€ User.js
β”‚   β”‚   β”‚   β”œβ”€β”€ PeriodLog.js
β”‚   β”‚   β”‚   β”œβ”€β”€ SymptomLog.js
β”‚   β”‚   β”‚   β”œβ”€β”€ MoodLog.js
β”‚   β”‚   β”‚   └── HealthLog.js
β”‚   β”‚   β”œβ”€β”€ routes/            # API routes
β”‚   β”‚   β”‚   β”œβ”€β”€ authRoutes.js
β”‚   β”‚   β”‚   β”œβ”€β”€ periodRoutes.js
β”‚   β”‚   β”‚   β”œβ”€β”€ symptomRoutes.js
β”‚   β”‚   β”‚   β”œβ”€β”€ moodRoutes.js
β”‚   β”‚   β”‚   └── healthRoutes.js
β”‚   β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”‚   β”‚   └── logger.js      # Winston logger
β”‚   β”‚   β”œβ”€β”€ validators/        # Input validation
β”‚   β”‚   β”œβ”€β”€ seed.js           # Database seeding
β”‚   β”‚   └── server.js         # Express app entry point
β”‚   β”œβ”€β”€ .env                   # Environment variables
β”‚   β”œβ”€β”€ .eslintrc.cjs         # ESLint configuration
β”‚   β”œβ”€β”€ .prettierrc           # Prettier configuration
β”‚   └── package.json
β”‚
β”œβ”€β”€ frontend/                  # React application
β”‚   β”œβ”€β”€ public/               # Static assets
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ assets/          # Images, icons
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ CycleProgressBar.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PredictionCard.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ QuickBmiCalculator.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ RecentLogs.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ StatusCard.jsx
β”‚   β”‚   β”‚   β”‚   └── LogButton.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ trackers/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Calendar.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PeriodTracker.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SymptomTracker.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ MoodTracker.jsx
β”‚   β”‚   β”‚   β”‚   └── HealthTracker.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Alert.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ LoadingSpinner.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ProtectedRoute.jsx
β”‚   β”‚   β”‚   └── TestModeToggle.jsx
β”‚   β”‚   β”œβ”€β”€ contexts/        # React Context providers
β”‚   β”‚   β”‚   β”œβ”€β”€ AuthContext.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ DataContext.jsx
β”‚   β”‚   β”‚   └── useAuth.jsx
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Signin.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Signup.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Trackers.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Analytics.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Education.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Profile.jsx
β”‚   β”‚   β”‚   └── education/
β”‚   β”‚   β”‚       β”œβ”€β”€ UnderstandingCycle.jsx
β”‚   β”‚   β”‚       β”œβ”€β”€ PMSManagement.jsx
β”‚   β”‚   β”‚       └── ProductGuide.jsx
β”‚   β”‚   β”œβ”€β”€ services/       # API integration
β”‚   β”‚   β”‚   └── api.js
β”‚   β”‚   β”œβ”€β”€ styles/         # CSS modules
β”‚   β”‚   β”œβ”€β”€ utils/          # Helper functions
β”‚   β”‚   β”‚   β”œβ”€β”€ cycleCalculations.js
β”‚   β”‚   β”‚   └── testData.js
β”‚   β”‚   β”œβ”€β”€ App.jsx         # Root component
β”‚   β”‚   └── main.jsx        # React entry point
β”‚   β”œβ”€β”€ .env                # Environment variables
β”‚   β”œβ”€β”€ eslint.config.js   # ESLint configuration
β”‚   β”œβ”€β”€ .prettierrc        # Prettier configuration
β”‚   β”œβ”€β”€ vite.config.js     # Vite configuration
β”‚   └── package.json
β”‚
β”œβ”€β”€ CODE_OF_CONDUCT.md      # Community guidelines
β”œβ”€β”€ CODE_QUALITY.md         # Code standards documentation
β”œβ”€β”€ CONTRIBUTING.md         # Contribution guidelines
β”œβ”€β”€ LICENSE                 # MIT License
└── README.md              # This file

πŸ“š Documentation

Core Documentation

API Documentation

Authentication Endpoints

POST   /api/auth/register          - Create new user account
POST   /api/auth/login             - Authenticate user
POST   /api/auth/logout            - Logout current user
POST   /api/auth/refresh-token     - Refresh JWT access token
GET    /api/auth/me                - Get current user profile
PUT    /api/auth/update-profile    - Update user profile
PUT    /api/auth/update-password   - Change password

Period Tracking Endpoints

GET    /api/periods                - Get all period logs
POST   /api/periods                - Create new period log
GET    /api/periods/:id            - Get specific period log
PUT    /api/periods/:id            - Update period log
DELETE /api/periods/:id            - Delete period log

Symptom Tracking Endpoints

GET    /api/symptoms               - Get all symptom logs
POST   /api/symptoms               - Log new symptoms
PUT    /api/symptoms/:id           - Update symptom log
DELETE /api/symptoms/:id           - Delete symptom log

Mood Tracking Endpoints

GET    /api/moods                  - Get all mood logs
POST   /api/moods                  - Log new mood entry
PUT    /api/moods/:id              - Update mood log
DELETE /api/moods/:id              - Delete mood log

Health Metrics Endpoints

GET    /api/health                 - Get all health logs
POST   /api/health                 - Log health metrics
PUT    /api/health/:id             - Update health log
DELETE /api/health/:id             - Delete health log

Key Algorithms

Cycle Prediction Algorithm

  • Uses historical period data (minimum 2 cycles)
  • Calculates average cycle length and variance
  • Predicts next period with Β±2 day accuracy window
  • Estimates ovulation (14 days before next period)
  • Identifies fertile window (5 days before to 1 day after ovulation)

Wellness Score Calculation

  • Starts at 100 (perfect health)
  • Deducts points for health concerns:
    • Cycle Irregularity: -8 to -30 points
    • Abnormal Cycle Length: -5 to -15 points
    • Abnormal Period Length: -3 to -10 points
    • Symptom Burden: -5 to -25 points
    • Negative Moods: -5 to -20 points
  • Score Categories:
    • 85-100: Excellent
    • 70-84: Good
    • 55-69: Fair
    • 40-54: Needs Attention
    • 0-39: Concerning

πŸ§ͺ Development

Available Scripts

Backend (cd backend)

npm run dev          # Start development server with nodemon
npm start            # Start production server
npm run lint         # Check code quality with ESLint
npm run lint:fix     # Auto-fix ESLint issues
npm run format       # Format code with Prettier
npm run seed         # Seed database with sample data
npm test             # Run test suite

Frontend (cd frontend)

npm run dev          # Start Vite dev server
npm run build        # Build for production
npm run preview      # Preview production build
npm run lint         # Check code quality with ESLint
npm run lint:fix     # Auto-fix ESLint issues
npm run format       # Format code with Prettier

Code Quality Standards

This project enforces strict code quality standards:

  • ESLint for code quality and consistency
  • Prettier for automatic formatting
  • Single quotes for strings
  • Template literals for string interpolation
  • 4-space indentation
  • 100-character line width

Run npm run lint:fix and npm run format before committing!

See CODE_QUALITY.md for detailed guidelines.

Testing

# Backend tests
cd backend
npm test

# Frontend tests (if configured)
cd frontend
npm test

Database Seeding

Generate sample data for testing:

cd backend
npm run seed

This creates 5 test users with different health profiles and 12 months of tracking data.


🚒 Deployment

Backend Deployment

Environment Variables Required:

NODE_ENV=production
PORT=5000
MONGODB_URI=<your-production-mongodb-uri>
JWT_SECRET=<secure-secret-key>
JWT_REFRESH_SECRET=<secure-refresh-key>
CLIENT_URL=<your-frontend-url>

Recommended Platforms:

  • Railway
  • Render
  • Heroku
  • DigitalOcean App Platform
  • AWS EC2/Elastic Beanstalk

Frontend Deployment

Environment Variables Required:

VITE_API_URL=<your-backend-api-url>

Recommended Platforms:

  • Vercel (Recommended)
  • Netlify
  • Railway
  • AWS Amplify
  • GitHub Pages

Database Hosting

Recommended MongoDB Hosting:

  • MongoDB Atlas (Free tier available)
  • Railway PostgreSQL (Alternative)

🀝 Contributing

We love contributions! πŸŽ‰

How to Contribute

  1. Fork the repository
  2. Clone your fork:
    git clone https://github.com/YOUR_USERNAME/Menstrual-Health-Tracker.git
  3. Create a feature branch:
    git checkout -b feature/amazing-feature
  4. Make your changes and commit:
    git commit -m 'Add: amazing new feature'
  5. Push to your fork:
    git push origin feature/amazing-feature
  6. Open a Pull Request

Contribution Guidelines

  • Read CONTRIBUTING.md before starting
  • Follow the Code of Conduct
  • Write clear, descriptive commit messages
  • Add tests for new features
  • Update documentation as needed
  • Run linters before committing

Areas for Contribution

  • πŸ› Bug Fixes: Report or fix bugs
  • ✨ Features: Implement new features
  • πŸ“ Documentation: Improve docs
  • 🎨 UI/UX: Enhance design
  • πŸ§ͺ Testing: Add test coverage
  • 🌐 Internationalization: Add translations
  • β™Ώ Accessibility: Improve a11y

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2026 Amanjeet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

πŸ™ Acknowledgements

Technologies & Libraries

Inspiration

  • The menstrual health tracking community
  • Healthcare professionals providing guidance
  • Open source contributors worldwide

Special Thanks

  • All contributors who have helped shape this project
  • Beta testers providing valuable feedback
  • The React and Node.js communities

πŸ“ž Support & Contact

Get Help

Stay Connected

  • ⭐ Star this repo if you find it helpful!
  • πŸ”” Watch for updates and new features
  • 🍴 Fork to create your own version

πŸ—ΊοΈ Roadmap

Upcoming Features

  • Multi-language support (i18n)
  • Data export (PDF, CSV formats)
  • Medication reminders and tracking
  • Partner sharing features
  • Doctor appointment integration
  • Dark mode theme
  • Mobile apps (iOS & Android)
  • AI-powered health insights
  • Community forums for support
  • Wearable device integration

Known Issues

  • Mobile calendar swipe gestures need improvement
  • Chart responsiveness on very small screens
  • Test mode data persistence across sessions

See Issues for detailed tracking.


🌸 Made with ❀️ for better menstrual health

If this project helped you, consider giving it a ⭐

Report Bug β€’ Request Feature β€’ Documentation

About

A comprehensive menstrual health tracking platform with intelligent cycle predictions, symptom monitoring, mood logging, and personalized wellness insights. Built with React, Express, and MongoDB to help users understand and manage their reproductive health through data-driven analytics.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors