Habit tracker MVP engineered around social accountability, viral loops, and real monetization. The stack combines Next.js 16 (App Router), Supabase, Stripe, PostHog, and a Tailwind/shadcn UI layer to deliver a mobile-first web experience focused on squads, challenges, and stakes.
🚀 This repository is now the canonical location for the Habits project. Contributions are welcome—see CONTRIBUTING.md for guidelines.
- High-Level Overview
- Tech Stack
- System Architecture
- Local Development
- Available Scripts
- Testing Strategy
- Quality & Tooling
- Deployment Notes
- Documentation Map
- Contributing
Habits is a social habit-tracking platform with:
- Social Core – squads, reactions, comments, activity feeds, and buddy invitations.
- Challenges & Stakes – 1v1 and group challenges backed by Stripe Connect escrow flows.
- Onboarding – guided three-step onboarding that seeds a habit, reminder, and social invite.
- Growth Mechanisms – referrals, public challenges, shareable recaps, and analytics instrumentation.
- Monetization Ready – subscription paywall plus real-money stakes.
| Layer | Technology |
|---|---|
| Frontend | Next.js 16 (App Router, React Server Components), TypeScript, Tailwind, shadcn/ui |
| State & Forms | React Hook Form + Zod, Jotai/Zustand (planned usage) |
| Backend Services | Supabase (Auth, Postgres, Storage, Realtime) |
| Payments | Stripe + Stripe Connect (via server actions) |
| Analytics | PostHog (client-side wrapper with opt-out in development) |
| Resend + React Email templates | |
| Testing | Vitest + Testing Library, Playwright |
| Tooling | pnpm, ESLint, TypeScript, Turbopack |
The high-level architecture and feature breakdown live in docs/ARCHITECTURE.md. It covers the App Router structure, server action flows, Supabase schema alignment, and planned Stripe Connect integrations.
- Node.js 20+
- pnpm (preferred)
- Supabase CLI (for migrations/seed)
- Optional: Stripe CLI, Playwright browsers (
npx playwright install)
pnpm install
pnpm devThe dev server runs at http://localhost:3000.
Copy .env.example to .env.local and fill in the values:
cp .env.example .env.localRequired keys:
| Variable | Description |
|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Supabase project URL |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Supabase anon key |
SUPABASE_SERVICE_ROLE_KEY |
Supabase service role (secure server actions) |
NEXT_PUBLIC_POSTHOG_KEY |
(Optional) PostHog key |
NEXT_PUBLIC_POSTHOG_HOST |
(Optional) PostHog API host |
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY |
Stripe publishable key |
STRIPE_SECRET_KEY |
Stripe secret key |
STRIPE_WEBHOOK_SECRET |
Stripe webhook secret |
STRIPE_CONNECT_CLIENT_ID |
Stripe Connect client ID |
RESEND_API_KEY |
Resend API key |
ℹ️ If you are developing without PostHog credentials, leave the defaults—analytics will automatically noop in that case.
- Create a Supabase project and note the URL/keys above.
- Run the SQL schema provided in
docs/SUPABASE_SCHEMA.sql(download from the blueprint section or generate from the README snippet). - Optional: Seed demo squads and challenges using the statements in the same document.
| Command | Description |
|---|---|
pnpm dev |
Run Next.js in development mode (Turbopack). |
pnpm build |
Production build. |
pnpm start |
Run production build locally. |
pnpm lint |
ESLint with zero-warning policy. |
pnpm typecheck |
TypeScript project checks. |
pnpm test |
Vitest unit/integration tests. |
pnpm test:e2e |
Playwright end-to-end smoke suite. |
- Unit tests (Vitest) cover utility logic such as streak calculations and stake fee splits.
- E2E smoke tests (Playwright) validate marketing and onboarding flows. Each contributor should install Playwright browsers via
npx playwright installbefore running the suite. - CI-ready: scripts are designed to plug into GitHub Actions or other CI tools (
lint,typecheck,test,build).
- ESLint (
pnpm lint) configured with zero-warning enforcement. - TypeScript strict mode + path aliases.
- Tailwind with custom rounding tokens and app-wide base styles.
- Analytics wrapper guards against placeholder keys to keep console clean in development.
- Built to target Vercel + Supabase, but any Next.js-compatible platform works.
- Ensure environment variables are configured in the hosting platform.
- Stripe Connect payouts require production-mode accounts and webhook endpoints.
- See docs/DEPLOYMENT.md for end-to-end steps (Vercel frontend, optional Railway backend, and GitHub Actions CI).
| Document | Purpose |
|---|---|
README.md |
High-level overview, setup instructions, scripts. |
CONTRIBUTING.md |
Contribution workflow, coding standards, review checklist. |
docs/ARCHITECTURE.md |
System architecture, routes, server actions, data model. |
docs/FEATURES.md |
Feature spec, user flows, roadmap. |
docs/API_NOTES.md |
Supabase table notes, server action expectations. |
Please read CONTRIBUTING.md for:
- Branching and commit conventions.
- Adding Supabase migrations and seeds.
- Testing requirements before opening a PR.
- Code style and linting expectations.
Happy building! 🎉