https://github.com/askitendo/cramppanchayat
CrampPanchayat is a privacy-first, emoji-powered period tracking app with offline-first support, cultural inclusivity, and optional cloud sync via Supabase.
https://github.com/askitendo/cramppanchayat
android expo ios open-source react-native supabase
Last synced: 10 months ago
JSON representation
CrampPanchayat is a privacy-first, emoji-powered period tracking app with offline-first support, cultural inclusivity, and optional cloud sync via Supabase.
- Host: GitHub
- URL: https://github.com/askitendo/cramppanchayat
- Owner: AskitEndo
- License: other
- Created: 2025-06-28T10:33:32.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-12T14:22:43.000Z (about 1 year ago)
- Last Synced: 2025-07-26T10:00:09.022Z (12 months ago)
- Topics: android, expo, ios, open-source, react-native, supabase
- Language: TypeScript
- Homepage:
- Size: 6.79 MB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ฉท CrampPanchayat
**Privacy-First Period Tracking App**
*Anonymous โข Offline-First โข Cultural Sensitivity*
[](https://reactnative.dev/)
[](https://expo.dev/)
[](https://www.typescriptlang.org/)
[](LICENSE)
## ๐ Overview
CrampPanchayat is a **production-ready** offline-first period tracking app that prioritizes user privacy and accessibility. Built with React Native and TypeScript, it offers an emoji-based anonymous profile system, ensuring users can track their menstrual health without compromising personal data.
### โจ Key Features
- **๐ญ Emoji-Based Anonymous Profiles**: Choose from 16 culturally diverse emojis (๐ฉท, ๐ฆ, ๐, ๐, etc.)
- **๐ฑ Offline-First Architecture**: Works completely offline with optional cloud sync
- **๐ Privacy-First Design**: No email, phone numbers, or personal information required
- **๐
Smart Calendar Tracking**: Manual date selection with intelligent cycle predictions
- **๐ฉบ Comprehensive Symptom Tracking**: 13+ categories with intensity ratings and notes
- **๐จโ๐ฉโ๐งโ๐ฆ Multi-User Support**: Family sharing on a single device
- **โ๏ธ Real-time Cloud Sync**: Secure username-based cloud accounts with instant availability checking
- **๐ Live Statistics**: Real-time cloud user statistics and community insights
## ๐๏ธ Architecture
### Tech Stack
| Technology | Version | Purpose |
| -------------------------- | -------- | ----------------------------------- |
| **React Native** | 0.74.5 | Cross-platform mobile framework |
| **Expo** | 51.0.28 | Development platform and deployment |
| **TypeScript** | 5.3.3 | Type-safe JavaScript |
| **React Navigation** | 6.x | Type-safe navigation |
| **AsyncStorage** | 1.23.1 | Offline-first local storage |
| **Supabase** | 2.43.5 | Optional cloud sync with RLS |
| **React Native Calendars** | 1.1306.0 | Calendar components |
| **Expo Linear Gradient** | 13.0.2 | Beautiful UI gradients |
### ๐ Project Structure
```
src/
โโโ components/ # Reusable UI components
โ โโโ ProfileCard/ # Emoji profile displays
โ โโโ SymptomCard/ # Symptom tracking widgets
โ โโโ CalendarCard/ # Calendar components
โโโ screens/ # Application screens
โ โโโ HomeScreen/ # Dashboard with cycle overview
โ โโโ CalendarScreen/ # Period tracking calendar
โ โโโ SymptomsScreen/ # Symptom logging interface
โ โโโ SettingsScreen/ # App configuration
โ โโโ ProfileSelector/ # Emoji profile management
โ โโโ DataManagement/ # Export/import/delete data
โ โโโ OnboardingScreen/# First-time user experience
โ โโโ SupportScreen/ # Help and donations
โโโ services/ # Business logic and APIs
โ โโโ storage.ts # AsyncStorage wrapper
โ โโโ supabase.ts # Cloud sync service with real-time features
โ โโโ cloudSync.ts # Enhanced cloud synchronization
โ โโโ periodTracking.ts # Unified period tracking logic
โ โโโ analytics.ts # Anonymous usage tracking
โโโ hooks/ # Custom React hooks
โ โโโ useProfiles.ts # Profile management logic
โ โโโ usePeriodTracking.ts # Unified period data operations
โ โโโ useSymptoms.ts # Symptom tracking logic
โโโ types/ # TypeScript definitions
โ โโโ index.ts # Core type definitions
โ โโโ navigation.ts # Navigation types
โโโ constants/ # App configuration
โ โโโ index.ts # Emojis, symptoms, settings
โโโ utils/ # Utility functions
โ โโโ dateUtils.ts # Date manipulation helpers
โ โโโ cycleCalculations.ts # Prediction algorithms
โ โโโ optimization.ts # Performance utilities
โโโ navigation/ # Navigation configuration
โโโ RootNavigator.tsx # Main navigation setup
```
## ๐ Getting Started
### Prerequisites
- **Node.js** (v18 or higher)
- **npm** or **yarn**
- **Expo CLI** (`npm install -g @expo/cli`)
- **Android Studio** (for Android development)
- **Xcode** (for iOS development, macOS only)
### Installation
1. **Clone the repository**
```bash
git clone https://github.com/askitendo/cramppanchayat.git
cd cramppanchayat
```
2. **Install dependencies**
```bash
npm install
# or
yarn install
```
3. **Set up environment variables**
```bash
cp .env.example .env
# Edit .env with your Supabase credentials (optional)
```
4. **Start the development server**
```bash
npm start
# or
expo start
```
5. **Run on device/simulator**
```bash
# Android
npm run android
# iOS
npm run ios
# Web
npm run web
```
## ๐ง Configuration
### Environment Variables
Create a `.env` file in the root directory:
```env
# Supabase Configuration (Optional - for cloud sync)
EXPO_PUBLIC_SUPABASE_URL=your_supabase_url
EXPO_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Analytics (Optional - anonymous only)
EXPO_PUBLIC_ANALYTICS_ENABLED=false
```
**Note**: The app works perfectly without any environment variables - all cloud features are optional!
### Supabase Setup (Optional)
For cloud sync functionality, follow the **comprehensive setup guide**:
1. **Quick Setup**: Use the complete database setup script
```bash
# Run SUPABASE_COMPLETE_SETUP.sql in your Supabase SQL editor
# This includes all tables, functions, triggers, and security policies
```
2. **Features Included**:
- โ
**Real-time Username Availability**: Instant feedback during account creation
- โ
**Robust User Management**: Complete user deletion with proper cleanup
- โ
**Row Level Security**: Advanced RLS policies for data protection
- โ
**Cloud Statistics**: Live user count and community insights
- โ
**Anonymous Sync**: Privacy-first cloud data synchronization
3. **Database Functions**:
- `check_username_exists()` - Real-time username availability checking
- `delete_user_complete()` - Safe user deletion with full cleanup
- `validate_period_data()` - Data integrity validation
For detailed setup instructions, see [`SUPABASE_COMPLETE_SETUP.sql`](SUPABASE_COMPLETE_SETUP.sql).
## ๐ฑ Features in Detail
### ๐ญ Anonymous Emoji Profiles
Choose from 16 carefully selected emojis representing diverse identities:
- ๐ฉท Pink Heart, ๐ฆ Butterfly, ๐ Crescent Moon, ๐ Star
- ๐บ Hibiscus, ๐ฆ Unicorn, ๐ Rainbow, ๐ซ Shooting Star
- ๐น Rose, ๐ Leaf, ๐ป Sunflower, ๐ฟ Herb
- ๐ท Tulip, ๐ผ Daisy, โจ Sparkles, ๐ฑ Seedling
### ๐
Smart Period Tracking
- **Manual Date Selection**: Tap calendar dates to log periods
- **Cycle Predictions**: AI-powered predictions based on personal patterns
- **Flexible Tracking**: Handle irregular cycles and variations
- **Historical Data**: View past cycles and identify patterns
### ๐ฉบ Comprehensive Symptom Tracking
Track 13+ symptom categories with intensity levels (1-5):
| Physical | Emotional | Other |
| -------------------- | --------------- | ----------------- |
| Cramps ๐ฉธ | Mood Swings ๐ค | Sleep Issues ๐ด |
| Headache ๐ค | Anxiety ๐ฐ | Food Cravings ๐ซ |
| Bloating ๐คฐ | Irritability ๐ก | Acne ๐ฃ |
| Breast Tenderness ๐ | Depression ๐ข | Energy Changes โก |
| Fatigue ๐ด | Stress ๐ต | And more... |
### ๐ Privacy & Security
- **No Personal Data**: No email, phone, or real names required
- **Local Storage**: All data stored locally on device by default
- **Anonymous IDs**: Cloud sync uses anonymous identifiers only
- **Data Ownership**: Easy export and deletion of all data
- **Transparent**: Open source with clear privacy practices
- **Real-time Username Check**: Secure username availability without data leaks
- **Robust Deletion**: Complete data removal including all cloud traces
### โ๏ธ Cloud Sync Features (Optional)
- **๐ Real-time Synchronization**: Instant data sync across devices
- **๐ค Username-based Accounts**: Simple username/password system
- **๐ Live Statistics**: Community insights while maintaining anonymity
- **๐ Row Level Security**: Database-level privacy protection
- **๐ฑ Multi-device Support**: Access your data from any device
- **๐ซ Easy Account Deletion**: Complete data removal with one click
## ๐ Cultural Considerations
CrampPanchayat is designed with global users in mind:
- **Inclusive Emoji Selection**: Diverse representation in profile options
- **Cultural Sensitivity**: Respectful language and imagery
- **Accessibility**: Screen reader support and high contrast options
- **Multi-Language Ready**: Architecture supports localization
- **Educational Content**: Culturally appropriate health information
## ๐บ๏ธ Roadmap & Recent Updates
### โ
**Latest Release (v1.0.5) - January 2025**
- โ
**Enhanced Cloud Sync**: Real-time username availability checking
- โ
**Improved Statistics**: Live cloud user statistics with proper sign-in state handling
- โ
**Robust User Management**: Complete user deletion with proper cleanup
- โ
**Unified Period Tracking**: Consolidated period tracking logic for better performance
- โ
**Enhanced Database**: Complete Supabase setup with advanced RLS policies
- โ
**Bug Fixes**: Fixed duplicate notes, improved error handling, better state management
### ๐ฎ Long Term Vision (v2.0+) - 2026
- ๐ฅ **Privacy-First Community**: Anonymous health insights and peer support features
- ๐ **Comprehensive Fertility Tracking**: Optional fertility awareness method support
- ๐ง **Holistic Wellness**: Integration with sleep, stress, and nutrition tracking
- ๐ **End-to-End Encryption**: Advanced security for all user data
- ๐ฑ **Progressive Web App**: Browser-based access with full offline capabilities
- ๐ **Wellness Ecosystem**: Complete menstrual and reproductive health platform
### ๐ ๏ธ Technical Achievements
- โ
**Zero TypeScript Errors**: Strict typing throughout the codebase
- โ
**Robust Error Handling**: Comprehensive fallbacks and user feedback
- โ
**Database Security**: Advanced RLS policies and safe user management
- โ
**Real-time Features**: Live username checking and cloud statistics
- โ
**Performance Optimized**: Unified tracking logic and efficient state management
- โ
**Production Ready**: Comprehensive testing and error boundary implementation
### ๐งช **Quality Assurance**
- **Database Integrity**: All SQL functions tested with proper error handling
- **Type Safety**: 100% TypeScript coverage with strict configuration
- **User Experience**: Real-time feedback and intuitive error messages
- **Privacy Compliance**: No personal data logging or unauthorized access
- **Cross-platform**: Tested on iOS, Android, and web platforms
_Want to contribute to these goals? Check out our [Contributing Guide](CONTRIBUTING.md)!_
## ๐ Production Ready Features
### โ
**Recent Critical Fixes (January 2025)**
**Username Availability System**:
- โ
Real-time database checking via `check_username_exists()` SQL function
- โ
Accurate feedback during account creation (no more false "available" messages)
- โ
Debounced checking (500ms) for optimal user experience
- โ
Proper error handling and fallback behavior
**Cloud Statistics Display**:
- โ
Shows "Sign in to see total cloud users" when not authenticated
- โ
Live user count when signed in
- โ
Proper loading states and error handling
- โ
Responsive sign-in state management
**Database & User Management**:
- โ
Complete Supabase setup in single `SUPABASE_COMPLETE_SETUP.sql` file
- โ
Robust user deletion with UUID/TEXT type handling
- โ
Advanced RLS policies for secure data access
- โ
Automatic auth cleanup triggers
**Code Quality & Performance**:
- โ
Unified period tracking logic (removed duplicates)
- โ
Zero TypeScript compilation errors
- โ
Enhanced error boundaries and user feedback
- โ
Optimized state management and data flow
### ๐ง **Developer Experience**
- **Single SQL Setup**: One comprehensive database setup file
- **Type Safety**: Strict TypeScript with comprehensive interfaces
- **Error Handling**: Graceful degradation and user-friendly messages
- **Documentation**: Comprehensive setup guides and code comments
- **Testing**: Production-tested with real user scenarios
## ๐ค Contributing
We welcome contributions from developers, designers, and health advocates!
### Development Setup
1. Fork the repository
2. Create a feature branch: `git checkout -b feature/amazing-feature`
3. Make your changes and test thoroughly
4. Commit using conventional commits: `git commit -m 'feat: add amazing feature'`
5. Push to your branch: `git push origin feature/amazing-feature`
6. Open a Pull Request
### Code Style Guidelines
- **TypeScript**: Strict typing with comprehensive interfaces
- **React Components**: Functional components with proper TypeScript props
- **Testing**: Write tests for critical functionality
- **Performance**: Use React.memo, useMemo, and useCallback appropriately
- **Privacy**: Never log or store personal information
## ๐ Data Management
### Local Storage
- **AsyncStorage**: Primary storage for offline-first experience
- **Data Format**: JSON with version control for migrations
- **Backup**: Export data as JSON for personal backup
- **Performance**: Optimized unified period tracking logic
### Cloud Sync (Optional)
- **Supabase**: PostgreSQL with Row Level Security (RLS)
- **Anonymous**: Uses device-generated anonymous IDs
- **Selective**: Users choose what data to sync
- **Real-time**: Live username availability and statistics
- **Secure**: Complete user deletion with proper cleanup
### ๐ง Database Features
- **Advanced RLS**: Row Level Security for data protection
- **Smart Functions**: Real-time username checking and user management
- **Data Validation**: Automatic period data structure validation
- **Cleanup Triggers**: Automatic auth data cleanup on user deletion
- **Performance Indexes**: Optimized queries for large datasets
## ๐ Support the Project
CrampPanchayat is free and open source. Support development through:
- **UPI Donations**: Scan QR code in app
- **GitHub Sponsors**: [Sponsor on GitHub](https://github.com/sponsors/askitendo)
- **Contributions**: Code, design, translations, or documentation
- **Spread the Word**: Share with friends and family
UPI Donation QR Code
## ๐ License
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
---
**Made with ๐ฉท for menstrual health awareness**
*For people you love from people they love.*
---