MindPhysics is an innovative mental health platform that combines principles of physics and psychology to provide a unique therapeutic experience. The application features an AI therapist, interactive physics-based relaxation games, and comprehensive progress tracking.
- Chat with an AI therapist trained in physics-based mental health approaches
- Personalized therapeutic conversations
- Session history tracking and insights
- Pendulum Meditation: Focus on the rhythmic motion of a pendulum for mindfulness
- Particle Flow: Watch and interact with particles that create calming patterns
- Wave Harmony: Synchronize your breathing with wave oscillations
- Mood tracking before and after therapy sessions and games
- Visualize your mental health journey with detailed analytics
- Receive personalized insights and recommendations
- Train the AI model with your own data
- Customize the therapeutic approach to your specific needs
- Deploy personalized models for enhanced therapy sessions
- Frontend: Next.js, React, Tailwind CSS, shadcn/ui
- Backend: Next.js API routes, Server Actions
- Database: Supabase (PostgreSQL)
- Authentication: Supabase Auth
- Visualization: Recharts
- Animation: Canvas API
- Node.js 18+ and npm
- Supabase account
-
Clone the repository: ```bash git clone https://github.com/yourusername/mindphysics.git cd mindphysics ```
-
Install dependencies: ```bash npm install ```
-
Set up environment variables: Create a
.env.localfile with the following variables: ``` NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key ``` -
Set up the database: Run the SQL scripts in the
databasedirectory to create the necessary tables and policies. -
Run the development server: ```bash npm run dev ```
-
Open http://localhost:3000 in your browser.
The application uses the following database tables:
Extends Supabase auth.users with additional user information.
id: UUID (Primary Key, references auth.users)full_name: TEXTavatar_url: TEXTcreated_at: TIMESTAMPupdated_at: TIMESTAMP
Tracks therapy chat sessions.
id: UUID (Primary Key)user_id: UUID (Foreign Key to auth.users)started_at: TIMESTAMPended_at: TIMESTAMPsummary: TEXTcreated_at: TIMESTAMPupdated_at: TIMESTAMP
Stores chat messages between users and the AI.
id: UUID (Primary Key)session_id: UUID (Foreign Key to therapy_sessions)role: TEXT ('user' or 'assistant')content: TEXTcreated_at: TIMESTAMP
Tracks user mood over time.
id: UUID (Primary Key)user_id: UUID (Foreign Key to auth.users)mood_score: INTEGER (1-10)notes: TEXTcreated_at: TIMESTAMP
Records user interactions with relaxation games.
id: UUID (Primary Key)user_id: UUID (Foreign Key to auth.users)game_type: TEXT ('pendulum', 'particles', or 'waves')duration_seconds: INTEGERpre_game_mood: INTEGER (1-10)post_game_mood: INTEGER (1-10)created_at: TIMESTAMP
- Create an account using the Sign Up page
- Log in with your credentials
- Your session will be maintained across visits
- Navigate to the Chat page
- Type your message in the input field
- Receive responses from the AI therapist
- End the session to save your progress
- Navigate to the Games page
- Select a game type (Pendulum, Particles, or Waves)
- Rate your mood before starting
- Interact with the game using the controls
- Rate your mood after playing to track effectiveness
- Navigate to the Dashboard page
- View your mood trends over time
- See a breakdown of your activity
- Read personalized insights and recommendations
- Navigate to the Model Training page
- Upload training data or use sample data
- Configure training parameters
- Start the training process
- Deploy your custom model
``` mindphysics/ ├── app/ # Next.js App Router │ ├── chat/ # Therapy chat interface │ ├── dashboard/ # Progress tracking dashboard │ ├── games/ # Relaxation games │ ├── login/ # Authentication pages │ ├── model-training/ # Custom model training │ ├── signup/ # User registration │ ├── layout.tsx # Root layout │ └── page.tsx # Home page ├── components/ # Reusable React components │ ├── games/ # Game components │ ├── ui/ # UI components (shadcn/ui) │ ├── auth-check.tsx # Authentication wrapper │ └── supabase-provider.tsx # Supabase context provider ├── hooks/ # Custom React hooks │ ├── use-chat.ts # Chat functionality │ └── use-toast.ts # Toast notifications ├── lib/ # Utility functions │ ├── game-service.ts # Game data services │ ├── supabase.ts # Supabase client │ └── utils.ts # Helper functions ├── public/ # Static assets └── database/ # Database scripts ```
- Integration with OpenAI for more advanced AI therapy
- Additional physics-based relaxation games
- Mobile application with notifications
- Group therapy sessions
- Integration with wearable devices for biometric feedback
- Export and sharing of progress reports
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Physics principles adapted from various academic sources
- Therapeutic approaches based on evidence-based practices
- Special thanks to all contributors and testers ```
This README provides a comprehensive overview of your MindPhysics project, including its features, setup instructions, and usage guidelines. It's designed to help users and developers understand the project without any references to the AI assistant that helped create it. ```