CrySense is a production-grade, clinical-style SaaS platform designed to analyze infant cries using deep learning, helping parents identify emotional states (e.g., hunger, pain, discomfort, tiredness) and track wellness trends over time. Built with a React/Vite frontend, FastAPI backend, and Supabase database.
- Clinical-Grade AI Classifier: Uses a custom Convolutional Neural Network (CNN) trained on Mel-frequency cepstral coefficients (MFCCs) to classify infant cry signatures.
- Real-time Waveform Recording: Securely capture and analyze 5-second audio recordings directly in the browser with visual feedback.
- Comprehensive Wellness Dashboard: Track historical trends, average confidence levels, and common cry reasons.
- Production Auth System: Fully integrated email/password and Google OAuth authentication flows using Supabase PKCE flow.
- Modern Design System: Sleek clinical-teal theme (
#1B6B8A) with responsive layouts, fluid animations, and a seamless Dark Mode toggle. - Privacy First: Waveform features are analyzed on-the-fly and classification metadata is stored securely in your database without storing raw audio files.
CrySense/
├── frontend/ # React (Vite) Single Page Application
│ ├── src/
│ │ ├── components/ # Reusable UI components (Navbar, Waveform recorder, etc.)
│ │ ├── context/ # React Auth Context (Supabase state)
│ │ ├── hooks/ # Custom hooks (predictions, audio recorder, dark mode)
│ │ ├── pages/ # App screens (Dashboard, Analyze, History, Profile, Docs)
│ │ └── styles/ # Global styles and design system variables
│ └── package.json # Frontend dependencies
├── backend/ # FastAPI Application Server
│ ├── app/
│ │ ├── routes/ # HTTP endpoints (audio upload, predictions, contact, health)
│ │ ├── services/ # Audio conversion (FFmpeg), ML inference, and DB services
│ │ ├── utils/ # Config parser, logging, and JWT verifier (HS256/ES256/RS256)
│ │ └── main.py # FastAPI App Entrypoint
│ └── requirements.txt # Python dependencies
└── ml_pipeline/ # TensorFlow Model & Data Pipeline
├── saved_models/ # Pretrained CrySense CNN model (.keras)
└── training/ # Model training and evaluation scripts
- Node.js (v18 or higher)
- Python (v3.11 or higher)
- FFmpeg (The backend uses
static-ffmpegto automate paths, but local installation is recommended for fallback)
Create a new project on Supabase and run the supabase_migration.sql file in the SQL Editor to set up the schema:
profiles: Stores user names and timestamps linked to auth.predictions: Stores classification results, timestamps, and confidence scores.
Enable Google Provider under Authentication -> Providers -> Google in the Supabase Dashboard if you wish to support Google OAuth login.
Create a .env file in the root folder:
CRYSENSE_ENVIRONMENT=development
CRYSENSE_SUPABASE_URL=https://<your-project-ref>.supabase.co
CRYSENSE_SUPABASE_SERVICE_KEY=<your-service-role-key>
CRYSENSE_SUPABASE_JWT_SECRET=<your-jwt-secret-or-key-id>
CRYSENSE_CORS_ORIGINS=["http://127.0.0.1:5173","http://localhost:5173"]Create a .env file in the frontend/ folder:
VITE_SUPABASE_URL=https://<your-project-ref>.supabase.co
VITE_SUPABASE_ANON_KEY=<your-anon-key>
VITE_API_BASE_URL=http://127.0.0.1:8000Note: The backend verifier automatically handles both legacy symmetric HS256 and modern asymmetric ES256 / RS256 keys generated by newer Supabase projects.
- Navigate to the root directory and activate your Python virtual environment:
# Windows .\.venv\Scripts\activate - Install dependencies:
pip install -r backend/requirements.txt
- Run the Uvicorn development server:
The backend API will be running at
python -m uvicorn backend.app.main:app --reload
http://127.0.0.1:8000. You can inspect documentation athttp://127.0.0.1:8000/docs.
- Navigate to the
frontend/directory:cd frontend - Install dependencies:
npm install
- Run the Vite development server:
Open
npm run dev
http://127.0.0.1:5173in your browser to view the application.
- Token Verification: API endpoints are secured using Bearer JWT authentication linked to Supabase users.
- Security Headers: Integrated FastAPI middleware enforces security policies (XSS blocks, Frame restrictions, MIME sniffing protection, CORS limits).
- Build Optimization: The frontend utilizes Vite's Rollup configuration to compile assets cleanly, yielding a lightweight CSS size (~34.5 KB) and optimal bundle sizes.
This project is private and proprietary. All rights reserved.