Prerequisites
Before you begin, ensure you have the following installed:| Software | Version | Required | Notes |
|---|---|---|---|
| Node.js | 20.x or higher | Yes | Required for Vite and development |
| npm | 10.x or higher | Yes | Package manager |
| Git | 2.x or higher | Yes | Version control |
| Docker | 24.x or higher | Optional | For containerized deployment |
This project uses Node.js 20+ for modern JavaScript features and optimal Vite performance. Earlier versions may cause compatibility issues.
Quick Start (Local Development)
Get Routine Optimizer running on your local machine in minutes.Configure environment variables
Create a Edit See Environment Variables for detailed configuration.
.env file in the root directory by copying the example:.env with your configuration:.env
Set up Supabase
- Create a project at supabase.com
- Navigate to SQL Editor in your Supabase dashboard
- Copy the entire content of
supabase/schema.sqlfrom the repository - Execute the SQL script to create tables, types, and RLS policies
- Get your credentials from Project Settings → API:
- Copy Project URL to
VITE_SUPABASE_URL - Copy anon public key to
VITE_SUPABASE_ANON_KEY
- Copy Project URL to
Set up Groq API (optional)
The AI Coach feature requires a Groq API key for Llama 3 inference:
- Create a free account at console.groq.com
- Navigate to API Keys and create a new key
- Add the key to your
.envfile asGROQ_API_KEY
Groq’s free tier provides fast inference with rate limits. The AI Coach will be disabled if no API key is provided.
Verify the installation
- Open
http://localhost:5173in your browser - You should see the login/register screen
- Create a test account
- Complete the onboarding flow
- Check that you can access the dashboard
Docker Deployment
Run Routine Optimizer in a production-ready Docker container with Nginx.Docker deployment is production-ready and includes multi-stage builds with optimized assets.
Using Docker Compose
Using the Management Script
Routine Optimizer includes helper scripts for Docker management:- Launch Application - Build and start the container
- Stop Application - Stop and remove containers
- View Logs - Monitor container logs
- Clean Build - Remove all Docker artifacts and rebuild
- Exit
Dockerfile Architecture
The Dockerfile uses a multi-stage build for optimal image size:Dockerfile
Available Scripts
The project includes several npm scripts for development and testing:| Command | Description |
|---|---|
npm run dev | Start development server with Vite and ngrok |
npm run build | Build for production |
npm run preview | Preview production build locally |
npm run lint | Run ESLint code analysis |
npm test | Run Vitest test suite |
npm run share | Share local server via ngrok tunnel |
Troubleshooting
Error: Supabase connection failed
Error: Supabase connection failed
Symptoms: Login fails, or you see “Unable to connect to database”Solutions:
- Verify
VITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEYin your.env - Ensure you’ve run the
supabase/schema.sqlscript - Check that your Supabase project is active
- Verify API access is enabled in Supabase settings
Error: AI Coach not responding
Error: AI Coach not responding
Symptoms: AI Coach shows error or doesn’t respondSolutions:
- Verify
GROQ_API_KEYis set in your.env - Check Groq API rate limits at console.groq.com
- Ensure the Vercel serverless function is deployed (for production)
- Check browser console for API errors
- Disable ad-blockers that may block API requests
Docker: White screen after deployment
Docker: White screen after deployment
Symptoms: Container runs but shows blank pageSolutions:
- Ensure you passed
--build-argfor allVITE_*variables during build - Rebuild the image from scratch:
docker-compose build --no-cache - Check browser console for JavaScript errors
- Verify nginx configuration in
deploy/docker/nginx.conf
Error: Node version incompatibility
Error: Node version incompatibility
Symptoms:
ERR_OSSL_EVP_UNSUPPORTED or similar OpenSSL errorsSolutions:- Upgrade to Node.js 20.x or higher
- Use nvm to manage Node versions:
- Verify version:
node --version
Pomodoro timer has no sound
Pomodoro timer has no sound
Symptoms: Timer completes but doesn’t play notification soundSolutions:
- Check that
/public/notification.mp3exists - Verify audio is enabled in Settings → Study Preferences
- Ensure browser tab is not muted
- Interact with the page before starting (browsers block autoplay audio)
- Check browser audio permissions
PWA not updating after deployment
PWA not updating after deployment
Symptoms: Changes don’t appear after pushing to productionSolutions:
- Hard refresh:
Ctrl + F5(Windows) orCmd + Shift + R(Mac) - Go to Settings → Check for Updates in the app
- Unregister service worker in browser DevTools → Application → Service Workers
- Clear browser cache and reload
OAuth redirect_mismatch error
OAuth redirect_mismatch error
Symptoms: Google/GitHub login fails with redirect errorSolutions:
- Go to Supabase dashboard → Authentication → Providers
- Add your
VITE_APP_URLto allowed redirect URLs - For production, add your production domain
- Ensure URL includes protocol (
https://orhttp://)
Database error: Type 'event_type' does not exist
Database error: Type 'event_type' does not exist
Symptoms: Errors when creating calendar events or tasksSolutions:
- Ensure you ran the complete
supabase/schema.sqlscript - The script includes custom ENUM types that must be created
- Re-run the schema script in Supabase SQL Editor
- Check for SQL execution errors in Supabase logs
Next Steps
Environment Variables
Complete reference for all configuration options.
Supabase Setup
Detailed guide for database configuration and RLS policies.
Docker Deployment
Advanced Docker configuration and optimization.
Deploy to Vercel
Deploy to production with Vercel’s serverless platform.
For local development help, see the Architecture documentation or review the
docs/ folder in the repository.