An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# ๐Ÿฉท CrampPanchayat


CrampPanchayat App Icon

**Privacy-First Period Tracking App**

*Anonymous โ€ข Offline-First โ€ข Cultural Sensitivity*

[![React Native](https://img.shields.io/badge/React%20Native-0.74.5-blue.svg)](https://reactnative.dev/)
[![Expo](https://img.shields.io/badge/Expo-51.0.28-black.svg)](https://expo.dev/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.3.3-blue.svg)](https://www.typescriptlang.org/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](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

UPI Donation QR Code


## ๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

---


Askit Endo Logo

**Made with ๐Ÿฉท for menstrual health awareness**

*For people you love from people they love.*

---