Light90 is a web application designed to help you harness the power of morning light to reset your circadian rhythm, boost energy, and improve sleep. It syncs with your WHOOP data to provide personalized timing for your crucial first light exposure.
The core principle of Light90 is based on scientific findings that suggest viewing sunlight within a specific window after waking (ideally around 90 minutes) can significantly impact your internal biological clock. This application automates the timing by:
- Securely authenticating with your WHOOP account.
- Fetching your latest wake-up time from your WHOOP sleep data.
- Calculating the optimal 90-minute mark for your morning light exposure.
- (Future) Sending you a notification to remind you.
- Providing a dashboard to view your sleep insights and upcoming light schedule.
- WHOOP Integration: Securely connects to your WHOOP account using OAuth2.
- Personalized Timing: Calculates the ideal time for morning light exposure based on your actual wake-up times from WHOOP.
- Dashboard: Displays your latest sleep cycle information from WHOOP and your next scheduled Light90 alert.
- User Authentication: Secure login and session management.
- Responsive Design: Built with Chakra UI for a consistent experience across devices.
- Frontend: React, TypeScript, Chakra UI, Axios, React Router
- Backend: Node.js, Express.js, Passport.js (for WHOOP OAuth2), Axios, Express Session
- Development: Concurrently (for running frontend and backend together)
Before you begin, ensure you have the following installed:
- Node.js (v18.0.0 or higher recommended)
- npm (usually comes with Node.js)
- A WHOOP Developer Account and API credentials (Client ID & Client Secret).
-
Clone the repository:
git clone <your-repository-url> cd light90
-
Install Root Dependencies: These are primarily for running both frontend and backend concurrently.
npm install
-
Configure Backend:
- Navigate to the backend directory:
cd backend - Create a
.envfile by copyingexample.env(if one exists) or creating it manually. Add the following environment variables:Replace placeholders with your actual WHOOP credentials and a strong session secret.NODE_ENV=development PORT=5000 CLIENT_URL=http://localhost:3000 REDIRECT_URI=http://localhost:5000/auth/whoop/callback SESSION_SECRET=your_strong_random_session_secret_here WHOOP_CLIENT_ID=your_whoop_client_id_here WHOOP_CLIENT_SECRET=your_whoop_client_secret_here
- Install backend dependencies:
npm install
- Navigate to the backend directory:
-
Configure Frontend:
- Navigate to the frontend directory:
cd ../frontend - Install frontend dependencies:
npm install
- (Optional) If you plan to use a different backend URL than the default
http://localhost:5000during development, create a.envfile in thefrontenddirectory with your backend URL:REACT_APP_BACKEND_URL=http://your-backend-url.com
- Navigate to the frontend directory:
-
Return to Root Directory:
cd ..
To start both the backend and frontend servers concurrently for development:
npm run devThis command will:
- Start the backend server (typically on
http://localhost:5000). - Start the frontend development server (typically on
http://localhost:3000).
Open your browser and navigate to http://localhost:3000 to use the application.
light90/
├── backend/ # Node.js/Express backend code
│ ├── node_modules/
│ ├── index.js # Main server file
│ ├── package.json
│ └── .env # Backend environment variables (gitignored)
├── frontend/ # React/TypeScript frontend code
│ ├── node_modules/
│ ├── public/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── hooks/ # Custom React hooks (e.g., useAuth)
│ │ ├── App.tsx # Main application component
│ │ ├── index.tsx # React entry point
│ │ └── ...
│ ├── package.json
│ └── .env # Frontend environment variables (gitignored, optional)
├── node_modules/ # Root node_modules (for concurrently)
├── package.json # Root package.json for concurrent scripts
└── README.md
Contributions are welcome! Please feel free to submit a pull request or open an issue.
(Consider adding a license, e.g., MIT License)