Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

✨ AI Companion β€” Mental Wellness App Live Site

A full-stack AI-powered mental wellness companion featuring empathetic chat, mood tracking, smart journaling, and guided wellness exercises.


πŸ“Œ Application Name

AI Companion β€” referred to internally as my-v0-project, built and scaffolded using v0.dev by Vercel.


🧠 Overview

AI Companion is a full-stack mental wellness web application that provides users with a judgment-free space to track their mood, journal their thoughts, chat with an empathetic AI, and practice guided wellness exercises. It is designed with privacy, simplicity, and emotional accessibility in mind.


βœ… Features

  • AI Companion Chat β€” Judgment-free conversation with empathetic AI responses (mock responses included; OpenAI integration ready)
  • Smart Journaling β€” Write journal entries and receive AI-generated reflections
  • Mood Tracking β€” Log daily moods (calm, happy, anxious, sad, neutral) with intensity scores and notes
  • Guided Exercises β€” Four types of calming exercises: Breathing, Grounding, Affirmations, and Visualization
  • Wellness Dashboard β€” Mood history, insights, and progress overview
  • Dynamic Theming β€” Light / Dark / Auto theme switching with mood-reactive theming support
  • Authentication β€” Login, Signup, and Demo login support

πŸ—‚οΈ Project Structure

v0-ai-wellness-companion/
β”‚
β”œβ”€β”€ app/                          # Next.js App Router (Frontend)
β”‚   β”œβ”€β”€ page.tsx                  # Login / Signup page
β”‚   β”œβ”€β”€ layout.tsx                # Root layout with providers
β”‚   β”œβ”€β”€ globals.css               # Global styles
β”‚   └── dashboard/
β”‚       └── page.tsx              # Protected dashboard page
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   └── sidebar.tsx           # App sidebar with navigation
β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   └── dashboard-view.tsx    # Main dashboard view
β”‚   └── ui/                       # shadcn/ui component library
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ auth-context.tsx          # Auth state (login, signup, logout)
β”‚   β”œβ”€β”€ mood-context.tsx          # Mood state management
β”‚   └── theme-context.tsx         # Theme (light/dark/auto) + mood theme
β”‚
β”œβ”€β”€ backend/                      # FastAPI Backend (Python)
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py               # FastAPI app entry point + CORS
β”‚   β”‚   β”œβ”€β”€ database.py           # MongoDB connection handlers
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   └── user.py           # Pydantic models (User, Token)
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.py           # POST /auth/signup, /auth/login
β”‚   β”‚   β”‚   β”œβ”€β”€ chat.py           # POST /chat/send, GET /chat/history
β”‚   β”‚   β”‚   β”œβ”€β”€ journal.py        # POST /journal/create, GET /journal/list
β”‚   β”‚   β”‚   β”œβ”€β”€ mood.py           # POST /mood/log, GET /mood/history
β”‚   β”‚   β”‚   └── exercises.py      # GET /exercises/list, GET /exercises/:id
β”‚   β”‚   └── services/             # Business logic services
β”‚   └── requirements.txt          # Python dependencies
β”‚
β”œβ”€β”€ docker-compose.yml            # Docker setup (MongoDB + Backend + Frontend)
β”œβ”€β”€ next.config.mjs               # Next.js configuration
β”œβ”€β”€ tsconfig.json                 # TypeScript configuration
└── package.json                  # Node.js dependencies

πŸ› οΈ Tech Stack

Frontend

Technology Purpose
Next.js 16 React framework (App Router)
React 19 UI library
TypeScript 5 Type safety
Tailwind CSS 4 Utility-first styling
shadcn/ui + Radix UI Accessible component library
Recharts Mood analytics & data visualization
Lucide React Icon set
next-themes Dark/Light/Auto theming
Vercel Analytics Usage analytics
React Hook Form + Zod Form handling & validation

Backend

Technology Purpose
FastAPI Python web framework
Uvicorn ASGI server
MongoDB + Motor NoSQL database (async driver)
Pydantic v2 Data validation & serialization
PyJWT / python-jose JWT authentication
Passlib + bcrypt Password hashing
OpenAI SDK AI response generation (ready to integrate)
python-dotenv Environment variable management

Infrastructure

Technology Purpose
Docker Compose Local multi-service orchestration
MongoDB 7.0 Persistent data store
Vercel (recommended) Frontend deployment
Gunicorn Production WSGI for backend

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • Python 3.10+
  • MongoDB (local or Atlas)
  • An OpenAI API key (for real AI responses)

Frontend Setup

# Install dependencies
npm install
 
# Start the development server
npm run dev

The app will run at http://localhost:3000.

Environment variable (create a .env.local file):

VITE_API_URL=http://localhost:8000

Backend Setup

cd backend
 
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate         # On Windows: venv\Scripts\activate
 
# Install dependencies
pip install -r requirements.txt
 
# Create your .env file
cp .env.example .env
# Edit .env with your values (see Environment Variables below)
 
# Start the backend server
uvicorn app.main:app --reload

The API will run at http://localhost:8000.


Docker (All Services)

docker-compose up -d

This starts MongoDB, the FastAPI backend, and the Next.js frontend together.


πŸ” Environment Variables

Backend .env

DATABASE_URL=mongodb://localhost:27017/ai-companion
JWT_SECRET=your-super-secret-key
OPENAI_API_KEY=your-openai-api-key
ENVIRONMENT=development
FRONTEND_URL=http://localhost:3000

Frontend .env.local

VITE_API_URL=http://localhost:8000

πŸ”— API Reference

All routes are prefixed with /api.

Auth β€” /api/auth

Method Endpoint Description
POST /auth/signup Register a new user
POST /auth/login Log in and receive a JWT token

Chat β€” /api/chat

Method Endpoint Description
POST /chat/send Send a message; receive an AI response
GET /chat/history/{session_id} Retrieve chat history for a session

Journal β€” /api/journal

Method Endpoint Description
POST /journal/create Create a new journal entry with AI reflection
GET /journal/list/{user_id} List all journal entries for a user

Mood β€” /api/mood

Method Endpoint Description
POST /mood/log Log a mood (calm / happy / anxious / sad / neutral) with intensity 1–10
GET /mood/history/{user_id} Retrieve mood history for a user

Exercises β€” /api/exercises

Method Endpoint Description
GET /exercises/list Get all available guided exercises
GET /exercises/{exercise_id} Get a specific exercise by ID

Health

Method Endpoint Description
GET / API info and status
GET /health Health check endpoint

πŸ—„οΈ Database Models

User

{
  "_id": ObjectId,
  "email": str,
  "password": str,       # bcrypt hashed
  "name": str,
  "created_at": datetime,
  "updated_at": datetime
}

ChatSession

{
  "_id": ObjectId,
  "user_id": ObjectId,
  "messages": [
    { "role": "user" | "assistant", "content": str, "timestamp": datetime }
  ],
  "created_at": datetime
}

JournalEntry

{
  "_id": ObjectId,
  "user_id": ObjectId,
  "title": str,
  "content": str,
  "ai_reflection": str,
  "date": datetime,
  "created_at": datetime
}

MoodLog

{
  "_id": ObjectId,
  "user_id": ObjectId,
  "mood": "calm" | "happy" | "anxious" | "sad" | "neutral",
  "intensity": int,      # 1–10
  "note": str,
  "date": datetime
}

🧭 Navigation

The sidebar provides access to all app sections:

Page Route Description
Dashboard /dashboard Overview, mood insights
Chat /chat AI companion conversation
Journal /journal Personal journal with AI reflections
Mood Tracker /mood Daily mood logging and history
Exercises /exercises Guided breathing, grounding, affirmations, visualization
Settings /settings Theme and account preferences

🎭 Demo Credentials

To try the app without creating an account:

Email:    demo@example.com
Password: demo123

Or click the "Try Demo" button on the login page.


🚒 Deployment

Frontend β€” Vercel (recommended)

npm run build
# Deploy via Vercel CLI or connect your GitHub repo at vercel.com

Backend β€” Heroku / AWS / Railway

pip install gunicorn
gunicorn app.main:app --workers 4

Docker Production

docker-compose -f docker-compose.yml up -d --build

πŸ§ͺ Development Scripts

Frontend

npm run dev       # Start dev server (localhost:3000)
npm run build     # Production build
npm run lint      # Lint with ESLint
npm run start     # Start production server

Backend

uvicorn app.main:app --reload      # Dev server with hot reload
pytest                             # Run test suite
black .                            # Format code
flake8 .                           # Lint code

⚠️ Current Limitations / Known TODOs

  • Chat responses are currently mocked (random pre-written replies). Swap in the OpenAI SDK call in backend/app/api/chat.py with your OPENAI_API_KEY for real AI responses.
  • Authentication uses an in-memory store in the current backend. Wire up MongoDB properly for production persistence.
  • Password hashing is not yet applied in auth.py β€” integrate passlib bcrypt before going to production.
  • JWT tokens are issued as "demo_token" β€” implement real JWT signing using python-jose.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m "feat: add your feature"
  4. Push to the branch: git push origin feature/your-feature
  5. Open a pull request

πŸ“„ License

MIT License β€” see LICENSE for details.


πŸ™ Acknowledgements

  • Scaffolded with v0.dev by Vercel
  • UI components by shadcn/ui
  • Icons by Lucide
  • Built with care for mental health and wellness πŸ’œ

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages