A therapeutic web application that combines journaling with AI-powered emotional coaching. Users can express their thoughts and feelings through a beautiful, plant-themed interface while receiving supportive guidance from an AI coach.
- User Authentication: Secure signup and login system
- AI-Powered Coaching: Get supportive responses from an AI coach based on your mood and messages
- Session Summaries: Automatic conversation summaries saved to your personal garden
- Beautiful UI: Plant-themed interface with calming colors and animations
- Mood Tracking: Express and track your emotional state
- Responsive Design: Works on desktop and mobile devices
- Node.js with Express.js
- MongoDB with Mongoose
- JWT for authentication
- OpenAI API for AI coaching
- bcrypt for password hashing
- CORS enabled for cross-origin requests
- Vanilla JavaScript (no frameworks)
- HTML5 with semantic markup
- CSS3 with modern styling
- Local Storage for session management
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher) - Download here
- MongoDB - Either:
- MongoDB Atlas (cloud) - Sign up here
- MongoDB Community Server (local) - Download here
- Git - Download here
git clone <your-repo-url>
cd HackMidwestnpm installCreate a .env file in the root directory:
cp .env.example .envEdit the .env file with your configuration:
# Server Configuration
PORT=5000
NODE_ENV=development
# Database
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/memory-garden?retryWrites=true&w=majority
# Authentication
JWT_SECRET=your-super-secret-jwt-key-here
# OpenAI Configuration
OPENAI_API_KEY=sk-your-openai-api-key-here
# CORS Configuration (for development)
CORS_ORIGIN=http://localhost:5500,http://127.0.0.1:5500- Go to OpenAI Platform
- Sign up or log in to your account
- Create a new API key
- Copy the key and paste it in your
.envfile
Option A: MongoDB Atlas (Recommended)
- Go to MongoDB Atlas
- Create a free account
- Create a new cluster
- Get your connection string and update
MONGODB_URIin.env
Option B: Local MongoDB
- Install MongoDB Community Server
- Start MongoDB service
- Use
MONGODB_URI=mongodb://localhost:27017/memory-garden
npm run devThe backend will start on http://localhost:5000
You can use any static file server. Here are a few options:
Option A: Live Server (VS Code Extension)
- Install "Live Server" extension in VS Code
- Right-click on
index.htmland select "Open with Live Server"
Option B: Python HTTP Server
# Python 3
python -m http.server 5500
# Python 2
python -m SimpleHTTPServer 5500Option C: Node.js HTTP Server
npx http-server -p 5500The frontend will be available at http://localhost:5500
- Open your browser and navigate to
http://localhost:5500 - Create an account or login with existing credentials
- Start journaling by clicking on the confession page
- Express your feelings and get AI-powered coaching responses
- View your session summaries in your personal garden
HackMidwest/
├── src/ # Backend source code
│ ├── app.js # Express app configuration
│ ├── server.js # Server entry point
│ ├── db.js # Database connection
│ ├── models/ # Database models
│ │ ├── User.js # User model
│ │ ├── entry.js # Entry model
│ │ └── summary.model.js
│ ├── routes/ # API routes
│ │ ├── auth.routes.js # Authentication routes
│ │ └── ai.routes.js # AI coaching routes
│ └── middleware/ # Custom middleware
│ └── auth.js # Auth middleware
├── public/ # Frontend files
│ ├── index.html # Login/Signup page
│ ├── home.html # Main dashboard
│ ├── confession.html # Journaling interface
│ ├── mood_progression.html
│ ├── app.js # Frontend JavaScript
│ ├── home.js # Home page logic
│ └── styles.css # Styling
├── .env # Environment variables
├── .env.example # Environment template
├── package.json # Dependencies
└── README.md # This file
POST /auth/signup- Create new user accountPOST /auth/login- User loginGET /auth/me- Get current user info
POST /ai/coach- Get AI coaching responsePOST /ai/summarize- Generate session summary
GET /health- Server health status
- Check OpenAI API key: Ensure it's valid and has credits
- Check console logs: Look for specific error messages
- Verify API key format: Should start with
sk-
- Check CORS_ORIGIN: Ensure your frontend URL is included
- Verify port numbers: Make sure frontend and backend ports match
- Check browser console: Look for CORS error messages
- Check MongoDB URI: Ensure connection string is correct
- Verify network access: For Atlas, check IP whitelist
- Check credentials: Ensure username/password are correct
- Check JWT_SECRET: Ensure it's set and consistent
- Clear browser storage: Clear localStorage if having login issues
- Check token expiration: Tokens expire after 7 days
- Check if port 5000 is in use:
lsof -ti:5000 - Kill existing processes:
kill -9 $(lsof -ti:5000) - Change port: Update PORT in
.envfile
To enable debug logging:
NODE_ENV=development npm run devTo clear all data:
# Connect to MongoDB and drop database
mongo
use memory-garden
db.dropDatabase()- Backend: Add routes in
src/routes/ - Frontend: Add pages and update
app.js - Database: Create models in
src/models/
- Use ES6+ features
- Follow async/await pattern
- Add error handling to all routes
- Use meaningful variable names
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -m 'Add feature' - Push to branch:
git push origin feature-name - Submit a pull request
This project is licensed under the ISC License.
If you encounter any issues:
- Check the troubleshooting section above
- Look at the console logs for error messages
- Verify all environment variables are set correctly
- Ensure all dependencies are installed
- OpenAI for the AI coaching capabilities
- MongoDB for the database solution
- Express.js community for the web framework
- All contributors who helped build this project
Happy Gardening! 🌱✨