Mental health & wellness platform — AI-powered insights, therapist booking, personalized care.
Stack: Next.js 16 (App Router) · TypeScript · Tailwind CSS · Supabase · Stripe · Resend
# Prerequisites: Node.js ≥22, npm ≥10
git clone https://github.com/Mykola-08/ekaacc.git && cd ekaacc
npm install
cp .env.example .env.local # fill in your keys
npm run dev # → http://localhost:9002npx supabase start
npm run supabase:setupekaacc/
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── (auth)/ # Login, signup
│ │ ├── (booking)/ # Booking flow
│ │ ├── (dashboard)/ # All authenticated pages (permission-gated)
│ │ ├── (marketing)/ # Public marketing & SEO pages
│ │ ├── (platform)/ # Webhooks, cron, email, uploads
│ │ ├── actions/ # Server actions
│ │ └── api/ # API routes
│ ├── components/ # React components (ui/, admin/, ai/, booking/, etc.)
│ ├── context/ # React contexts (Language, Features)
│ ├── hooks/ # Custom hooks
│ ├── lib/ # Utils, Supabase clients, platform services
│ ├── marketing/ # Marketing-specific components, hooks, contexts
│ ├── store/ # Zustand stores
│ └── types/ # Shared type definitions
├── server/ # Server-side business logic (ai/, booking/, payment/, etc.)
├── supabase/ # Migrations, edge functions, email templates
├── scripts/ # Utility scripts
├── docs/ # Documentation (see docs/README.md)
└── public/ # Static assets
| Alias | Maps to |
|---|---|
@/* |
./src/* |
@/server/* |
./server/* |
@/marketing/* |
./src/marketing/* |
Client Component → Server Action → Service Layer → Supabase / Stripe / Resend
- Service Layer: All business logic in
server/*/service.tsorsrc/lib/platform/services/*.ts. - Server Actions: Thin wrappers calling service functions.
- Permissions: Role-based with per-user overrides. One
(dashboard)route group for all roles, gated by permissions. - Auth: Supabase Auth + cookie-based sessions refreshed in middleware.
| Context | Import | Pattern |
|---|---|---|
| Browser | @/lib/supabase/client |
Singleton |
| Server | @/lib/supabase/server |
Async (per-request) |
| Admin | @/lib/supabase/admin |
Service key |
- Community engagement & moderation
- Threaded replies (
parent_id) and post reactions (reactions) are now supported in dashboard community flows. - End users can report posts with reason/details.
- Admins can review reports in
/admin/communityand move them throughopen → reviewing → resolved/dismissedstates. - Report status updates are protected by both app-level admin checks and Supabase RLS admin update policies.
- Threaded replies (
- Saved resources
- Users can save/unsave resources and filter resources by saved state.
- Server actions:
getSavedResourceIds,toggleSavedResource.
- Goals & onboarding
- Goal progress history snapshots are written on updates and surfaced in the goals UI.
- Onboarding is a multi-step flow that captures profile context and seeds initial goals.
- Dashboard AI & mood context
- Added a mood trend widget and background AI prefetch trigger to improve perceived responsiveness for insights workflows.
| Command | Purpose |
|---|---|
npm run dev |
Dev server (port 9002) |
npm run build |
Production build |
npm run lint |
ESLint |
npm run lint:fix |
ESLint auto-fix |
npm run typecheck |
TypeScript check (tsc --noEmit) |
npm run check |
lint + typecheck |
npm run format |
Prettier |
npm run db:check |
Test Supabase connection |
npm run db:seed |
Seed services data |
npm run supabase:setup |
Full local Supabase setup |
npm run supabase:reset |
Reset local DB |
If you are syncing a local database for community/resource/onboarding changes, ensure these migrations are applied:
supabase/migrations/20260318000003_onboarding_and_goal_history.sqlsupabase/migrations/20260318000004_saved_resources.sqlsupabase/migrations/20260319000005_community_reactions_and_threading.sqlsupabase/migrations/20260319000006_community_reports.sqlsupabase/migrations/20260319000007_community_reports_admin_update_policy.sql
If you need to continue work from a clean/latest local state:
git fetch --all --prune
git reset --hard origin/main # or origin/<your-branch>
npm installUse git stash first if you need to preserve uncommitted local changes.
| Service | Purpose | Key files |
|---|---|---|
| Supabase | DB, Auth, Storage | src/lib/supabase/*, supabase/migrations/ |
| Stripe | Payments & Billing | src/lib/platform/integrations/stripe.ts |
| Resend | src/lib/platform/integrations/resend.ts |
|
| AI (multi) | Chat & Analysis | server/ai/* (OpenAI, Anthropic, Google) |
| Telegram | Bot notifications | server/telegram/* |
npm i -g vercel
vercel login
vercel --prodRequired env vars for production: NEXT_PUBLIC_SUPABASE_URL,
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, SUPABASE_SECRET_KEY, POSTGRES_URL.
All other secrets (Stripe, Resend, etc.) are loaded from the app_config table.
See docs/README.md for full documentation index.
MIT