A productivity application that helps users track their focus sessions, pomodoro timers, and daily reflections.
- Focus Sessions: Track deep work sessions with subjects and sub-topics
- Pomodoro Timer: Built-in timer with session history
- Daily Reflections: Record daily ratings and notes
- Analytics: View weekly focus time and productivity trends
- Frontend: Next.js 14 (App Router)
- Authentication: Clerk (with JWT integration)
- Database: Supabase (PostgreSQL 15)
- Styling: Tailwind CSS + Headless UI
- State Management: React Query
- Form Handling: React Hook Form + Zod
- Deployment: Vercel (with Edge Functions)
- Testing: Jest + React Testing Library
- Node.js 18+ & npm
- Supabase account
- Clerk account
- Vercel account (for deployment)
-
Clone the repository
git clone https://github.com/sai21-learn/focusfactory.git cd focusfactory -
Install dependencies
# Using npm npm install # Or using yarn yarn install
-
Environment Setup Create a
.env.localfile with the following variables:# Clerk NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_* CLERK_SECRET_KEY=sk_test_* # Supabase NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key SUPABASE_SERVICE_ROLE_KEY=your-service-role-key # Optional: Analytics (e.g., Vercel Analytics, PostHog) NEXT_PUBLIC_ENABLE_ANALYTICS=false
-
Database Setup
- Create a new Supabase project
- Run the database migrations from
supabase/migrations/ - Enable Row Level Security (RLS) on all tables
- Set up the necessary storage buckets if needed
-
Run the development server
npm run dev # or yarn devThe app will be available at
http://localhost:3000
users: User profiles and authenticationfocus_sessions: Track focus sessions with duration and topicspomodoro_history: Record pomodoro timer sessionsreflections: Daily reflections and ratings
All API endpoints require authentication via Clerk JWT token in the Authorization header.
-
GET /api/focus-sessions- List all focus sessionscurl -H "Authorization: Bearer YOUR_JWT_TOKEN" \ https://your-app.vercel.app/api/focus-sessions -
POST /api/focus-sessions- Create a new focus session{ "started_at": "2025-10-24T09:00:00Z", "duration_minutes": 50, "subject": "Coding", "sub_topic": "Feature Implementation", "output_text": "Completed the new API endpoints" }
GET /api/pomodoro- Get pomodoro historyPOST /api/pomodoro- Log a new pomodoro session{ "start_time": "2025-10-24T10:00:00Z", "duration_minutes": 25, "completed": true }
GET /api/reflections?date=2025-10-24- Get reflection for a specific datePOST /api/reflections- Create or update a daily reflection{ "reflection_date": "2025-10-24", "rating": 4, "notes": "Had a productive day with good focus sessions." }
GET /api/analytics/weekly?weeks=4- Get weekly focus timeGET /api/analytics/productivity- Get productivity metrics
/
βββ app/ # Next.js 14 app directory
β βββ api/ # API routes
β βββ (auth)/ # Authentication pages
β βββ dashboard/ # Protected routes
β βββ layout.tsx # Root layout
β
βββ components/ # Reusable components
β βββ ui/ # Shadcn/ui components
β βββ dashboard/ # Dashboard specific components
β βββ shared/ # Shared components
β
βββ lib/
β βββ supabase/ # Supabase client and utilities
β βββ utils/ # Utility functions
β βββ types/ # TypeScript types
β
βββ public/ # Static files
βββ styles/ # Global styles
βββ tests/ # Test files
# Start development server
npm run dev
# Create production build
npm run build
# Start production server
npm start
# Lint code
npm run lint
# Run tests
npm test
# Run tests in watch mode
npm test:watch
# Generate API client types from Supabase
npm run generate:types| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
Yes | Clerk publishable key |
CLERK_SECRET_KEY |
Yes | Clerk secret key |
NEXT_PUBLIC_SUPABASE_URL |
Yes | Supabase project URL |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Yes | Supabase anon/public key |
SUPABASE_SERVICE_ROLE_KEY |
No | Supabase service role key (server-side only) |
NEXT_PUBLIC_ENABLE_ANALYTICS |
No | Enable/disable analytics |
- Push your changes to the main branch
- Vercel will automatically deploy the changes




