Skip to content

SatvikVejendla/refleva

Repository files navigation

Refleva - Mental Health Journaling Platform

AI-powered journaling tool for mental wellness and self-reflection.

🚀 Quick Start

npm install
npm run dev

Visit https://reflevapp.com

🔧 Environment Setup

NOTE: A majority of the functionality will not work if you don't set up the database.

Create .env.local with the following variables:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your_supabase_anon_key
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
HUGGINGFACE_API_KEY=your_huggingface_api_key

Set up a Supabase SQL database schema using the supabase-schema.sql

📁 Project Structure

src/
├── app/
│   ├── api/
│   │   ├── analyze-topics/
│   │   ├── chat/
│   │   ├── detect-mood/
│   │   ├── embed/
│   │   └── generate-tags/
│   ├── auth/
│   │   └── callback/
│   ├── dashboard/
│   ├── login/
│   ├── therapist/
│   │   ├── login/
│   │   ├── dashboard/
│   │   └── invite/
│   └── page.tsx
│
├── components/
│   ├── 3d/
│   │   └── MoodRoom.tsx
│   ├── dashboard/
│   │   ├── views/
│   │   │   ├── HomeView.tsx
│   │   │   ├── JournalView.tsx
│   │   │   ├── HabitsView.tsx
│   │   │   ├── ChatView.tsx
│   │   │   ├── ProfileView.tsx
│   │   │   └── SettingsView.tsx
│   │   ├── DashboardContent.tsx
│   │   ├── DashboardNav.tsx
│   │   ├── Sidebar.tsx
│   │   └── QuickActions.tsx
│   ├── journal/
│   │   ├── JournalEditor.tsx
│   │   └── JournalList.tsx
│   └── landing/
│       ├── Header.tsx
│       ├── Hero.tsx
│       ├── HowItWorks.tsx
│       └── Footer.tsx
│
└── lib/
    ├── api.ts                  # API client functions
    ├── database.ts             # Database utilities
    ├── store.ts                # Zustand state management
    └── supabase.ts             # Supabase client

🔌 API Routes

AI Features

  • POST /api/chat - AI chat with journal context
  • POST /api/detect-mood - Classify mood from text
  • POST /api/generate-tags - Generate tags for journal entries
  • POST /api/analyze-topics - Analyze topics for therapists
  • POST /api/embed - Generate text embeddings

Database

All database operations use Supabase client-side SDK with Row Level Security (RLS). See src/lib/store.ts for data fetching patterns.

🗄️ Database Schema

The project uses Supabase with the following main tables:

  • profiles - User profile information
  • journal_entries - Journal entries with mood and tags
  • journal_tags & journal_entry_tags - Tagging system
  • habits - Long-term habits
  • daily_tasks - Daily task management
  • task_history - Task completion history
  • insights - AI-generated insights
  • therapists - Therapist accounts
  • user_therapist_connections - Sharing relationships
  • profile_stats - User statistics
  • badges & user_badges - Achievement system
  • goals - User goals
  • chat_topics - Extracted chat topics

See DATABASE_SETUP.md for detailed schema setup instructions.

📦 Tech Stack

  • Next.js 14 - React framework with App Router
  • TypeScript - Type safety
  • Supabase - Database and authentication
  • Zustand - State management
  • Tailwind CSS - Styling
  • Three.js / React Three Fiber - 3D visualization
  • Hugging Face API - AI/LLM services
  • Lucide Icons - Icon library
  • date-fns - Date utilities

🎨 Customization

Change Colors

Edit tailwind.config.js:

theme: {
  extend: {
    colors: {
      // Add your brand colors
    }
  }
}

🔐 Security

  • Row Level Security (RLS) enabled on all Supabase tables
  • User data isolation via RLS policies
  • Secure OAuth flow with Supabase
  • API routes protected with authentication checks

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors