Skip to content

Latest commit

Β 

History

19 Commits

Folders and files

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

Repository files navigation

🌟 Solace

Your Gentle Companion for Mental Wellness

A warm, supportive digital mental health platform designed with love for students. Here, your mental health matters, your feelings are valid, and you're never alone on this journey.

License: MIT Node.js Version Express.js Firebase OpenAI

Features β€’ Installation β€’ Documentation β€’ Deployment β€’ Contributing


πŸ“‹ Table of Contents


🎯 About Solace

Solace is a comprehensive digital mental health platform specifically designed for students. In a world where 60% of students feel overwhelmed by anxiety and 80% hesitate to seek help due to stigma, Solace provides a safe, judgment-free space for mental wellness support.

Our Mission

To provide accessible, empathetic, and effective mental health support to students worldwide, breaking down barriers and reducing stigma associated with seeking help.

Key Statistics

  • πŸ“Š 60% of students feel overwhelmed by anxiety
  • πŸ’™ 40% experience feelings of sadness
  • 🚫 80% hesitate to seek help due to stigma
  • βœ… 95% of users report feeling better after using Solace

✨ Features

πŸ€– AI Companion Chat

  • 24/7 Availability: Like having a caring friend available around the clock
  • Instant Support: Get immediate responses to mental health concerns
  • Coping Strategies: Receive personalized guidance and techniques
  • Gentle Guidance: Empathetic AI-powered conversations powered by OpenAI GPT-3.5

πŸ“… Safe Space Booking

  • Professional Counselors: Connect with licensed mental health professionals
  • Complete Privacy: Your conversations are protected and confidential
  • Easy Scheduling: Simple appointment booking system
  • Secure Sessions: End-to-end privacy protection

πŸ‘₯ Gentle Community

  • Peer Support Groups: Find your tribe in moderated support communities
  • Judgment-Free Environment: Share, listen, and grow together
  • Moderated Discussions: Safe spaces with community guidelines
  • Shared Experiences: Connect with others on similar journeys

πŸ“ Journal & Mood Tracking

  • Digital Journal: Private space for thoughts and reflections
  • Mood Tracking: Visualize your emotional journey over time
  • Progress Insights: Track your mental wellness progress
  • Personal Growth: Identify patterns and celebrate improvements

🧘 Healing Resources

  • Curated Content: Carefully selected wellness materials
  • Breathing Exercises: Guided relaxation techniques
  • Meditation Guides: Mindfulness and meditation resources
  • Multilingual Support: Content in your preferred language

πŸ†˜ Crisis Support

  • 24/7 Helplines: Instant access to crisis support services
  • Emergency Resources: Quick access to emergency contacts
  • Safety Protocols: Immediate support when you need it most
  • India-Specific: Includes Indian mental health helplines (AASRA, iCALL, YourDOST)

πŸ“Š Admin Dashboard

  • Institutional Analytics: Insights for educational institutions
  • Student Wellness Metrics: Aggregate data (privacy-preserving)
  • Resource Management: Manage content and resources
  • User Support Tools: Administrative tools for platform management

🎨 User Experience

  • Modern UI/UX: Beautiful, intuitive interface design
  • Dark/Light Mode: Theme toggle for comfortable viewing
  • Responsive Design: Works seamlessly on desktop and mobile
  • Accessibility: Built with accessibility best practices

πŸ›  Tech Stack

Frontend

  • HTML5 - Semantic markup and structure
  • CSS3 - Modern styling with animations and responsive design
  • Vanilla JavaScript - Interactive functionality and DOM manipulation
  • Firebase SDK (v10.7.1) - Authentication and database services

Backend

  • Node.js (β‰₯18.0.0) - Runtime environment
  • Express.js (v4.18.2) - Web application framework
  • Axios (v1.6.0) - HTTP client for API requests
  • CORS (v2.8.5) - Cross-origin resource sharing
  • dotenv (v16.3.1) - Environment variable management

Services & APIs

  • Firebase Authentication - User authentication and authorization
  • Cloud Firestore - NoSQL database for user data
  • OpenAI GPT-3.5 - AI-powered chat companion
  • Render/Railway/Vercel - Deployment platforms

Development Tools

  • Nodemon (v3.0.1) - Development server auto-reload
  • http-server (v14.1.1) - Local static file serving

πŸš€ Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (version 18.0.0 or higher)
  • npm (comes with Node.js) or yarn
  • Git (for version control)
  • Firebase Account (for authentication and database)
  • OpenAI API Key (for AI chat functionality)

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/solace-main.git
    cd solace-main
  2. Install dependencies

    # Install root dependencies
    npm install
    
    # Install backend dependencies
    cd backend
    npm install
    cd ..
  3. Set up Firebase

    • Create a Firebase project at Firebase Console
    • Enable Authentication (Email/Password and Google Sign-In)
    • Create a Firestore database
    • Copy your Firebase configuration
    • Update scripts/firebase-config.js with your credentials
  4. Configure environment variables

    Create a .env file in the root directory:

    # Server Configuration
    PORT=3000
    CORS_ORIGIN=*
    
    # OpenAI Configuration
    OPENAI_API_KEY=your-openai-api-key-here
    
    # Firebase Configuration (optional, can be in firebase-config.js)
    # FIREBASE_API_KEY=your-firebase-api-key
    # FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
    # FIREBASE_PROJECT_ID=your-project-id
  5. Start the development server

    # Development mode (with auto-reload)
    npm run dev
    
    # Production mode
    npm start
    
    # Or serve static files only
    npm run serve
  6. Access the application

    • Open your browser and navigate to http://localhost:3000
    • The landing page should load successfully

Configuration

Firebase Setup

  1. Create Firebase Project

  2. Enable Authentication

    • Navigate to Authentication β†’ Sign-in method
    • Enable Email/Password
    • Enable Google Sign-In (optional but recommended)
  3. Create Firestore Database

    • Go to Firestore Database
    • Click "Create database"
    • Start in test mode (or configure security rules)
    • Choose your preferred location
  4. Get Configuration

    • Go to Project Settings β†’ General
    • Scroll to "Your apps" section
    • Click the web icon (</>)
    • Copy the configuration object
  5. Update Configuration

    • Open scripts/firebase-config.js
    • Replace the firebaseConfig object with your values

OpenAI API Setup

  1. Create OpenAI Account

  2. Generate API Key

    • Go to API Keys section
    • Click "Create new secret key"
    • Copy the key immediately (it won't be shown again)
  3. Set Environment Variable

    • Add OPENAI_API_KEY to your .env file
    • Or set it in your deployment platform's environment variables

πŸ“ Project Structure

solace-main/
β”‚
β”œβ”€β”€ πŸ“„ index.html                 # Landing page
β”œβ”€β”€ πŸ“„ dashboard.html             # Main user dashboard
β”œβ”€β”€ πŸ“„ auth.html                  # Authentication page (login/signup)
β”œβ”€β”€ πŸ“„ ai-chat.html              # AI chat interface
β”œβ”€β”€ πŸ“„ appointments.html          # Counselor booking page
β”œβ”€β”€ πŸ“„ journal.html               # Journaling interface
β”œβ”€β”€ πŸ“„ mood-tracker.html          # Mood tracking dashboard
β”œβ”€β”€ πŸ“„ community.html             # Community support page
β”œβ”€β”€ πŸ“„ resources.html             # Wellness resources
β”œβ”€β”€ πŸ“„ admin-dashboard.html       # Admin analytics dashboard
β”œβ”€β”€ πŸ“„ onboarding.html            # User onboarding flow
β”œβ”€β”€ πŸ“„ profile.html               # User profile page
β”œβ”€β”€ πŸ“„ contact.html               # Contact page
β”œβ”€β”€ πŸ“„ help.html                  # Help and support
β”œβ”€β”€ πŸ“„ privacy.html               # Privacy policy
β”œβ”€β”€ πŸ“„ terms.html                 # Terms of service
β”‚
β”œβ”€β”€ πŸ“‚ scripts/                   # JavaScript files
β”‚   β”œβ”€β”€ firebase-config.js        # Firebase configuration
β”‚   β”œβ”€β”€ landing.js                # Landing page logic
β”‚   β”œβ”€β”€ auth.js                   # Authentication logic
β”‚   β”œβ”€β”€ dashboard.js              # Dashboard functionality
β”‚   β”œβ”€β”€ ai-chat.js                # AI chat interface logic
β”‚   β”œβ”€β”€ onboarding.js             # Onboarding flow
β”‚   β”œβ”€β”€ profile.js                # Profile management
β”‚   β”œβ”€β”€ admin-dashboard.js        # Admin dashboard logic
β”‚   └── pages.js                  # Shared page utilities
β”‚
β”œβ”€β”€ πŸ“‚ styles/                    # CSS stylesheets
β”‚   β”œβ”€β”€ landing.css               # Landing page styles
β”‚   β”œβ”€β”€ dashboard.css             # Dashboard styles
β”‚   β”œβ”€β”€ auth.css                  # Authentication styles
β”‚   β”œβ”€β”€ ai-chat.css               # Chat interface styles
β”‚   β”œβ”€β”€ onboarding.css            # Onboarding styles
β”‚   β”œβ”€β”€ profile.css               # Profile styles
β”‚   β”œβ”€β”€ admin-dashboard.css       # Admin dashboard styles
β”‚   └── pages.css                 # Shared page styles
β”‚
β”œβ”€β”€ πŸ“‚ backend/                   # Backend server
β”‚   β”œβ”€β”€ server.js                 # Express server with AI chat API
β”‚   β”œβ”€β”€ package.json              # Backend dependencies
β”‚   └── setup.sh                  # Setup script
β”‚
β”œβ”€β”€ πŸ“„ server.js                  # Root server file
β”œβ”€β”€ πŸ“„ package.json               # Root package configuration
β”œβ”€β”€ πŸ“„ render.yaml                # Render deployment config
β”œβ”€β”€ πŸ“„ deploy.sh                  # Deployment script
β”‚
β”œβ”€β”€ πŸ“„ README.md                  # This file
β”œβ”€β”€ πŸ“„ DEPLOYMENT.md              # Detailed deployment guide
└── πŸ“„ QUICK_DEPLOY.md            # Quick deployment reference

πŸ“š API Documentation

Base URL

Development: http://localhost:3001
Production: https://your-domain.com

Endpoints

Health Check

Check if the API server is running.

GET /health

Response:

{
  "status": "ok",
  "timestamp": "2025-01-XX",
  "service": "Solace AI Backend"
}

AI Chat

Send a message to the AI companion and receive a response.

POST /api/chat

Headers:

{
  "Content-Type": "application/json"
}

Request Body:

{
  "message": "I'm feeling anxious about my exams",
  "userId": "user-id-123",
  "conversationHistory": [
    {
      "role": "user",
      "content": "Hello"
    },
    {
      "role": "assistant",
      "content": "Hello! How can I help you today?"
    }
  ]
}

Response:

{
  "response": "I understand that exam anxiety can be really challenging...",
  "timestamp": "2025-01-XXT12:00:00Z"
}

Error Responses:

400 Bad Request

{
  "error": "Missing required field: message"
}

429 Too Many Requests

{
  "error": "Rate limit exceeded",
  "message": "Too many requests. Please try again later.",
  "retryAfter": 45
}

500 Internal Server Error

{
  "error": "Internal server error",
  "message": "Failed to process chat request"
}

Rate Limiting

  • Limit: 10 requests per minute per IP address
  • Window: 60 seconds (1 minute)
  • Headers: Retry-After header included in 429 responses

Authentication

Currently, the API uses simple rate limiting by IP address. For production, consider implementing:

  • JWT token authentication
  • User-based rate limiting
  • API key authentication for admin endpoints

πŸ’» Usage Guide

For Users

  1. Getting Started

    • Visit the landing page
    • Click "Get Started" or "Begin Your Journey"
    • Sign up with email/password or Google account
    • Complete the onboarding process
  2. Using AI Chat

    • Navigate to the AI Chat section
    • Type your message and press Enter
    • The AI companion will respond with empathetic guidance
    • Conversation history is maintained during your session
  3. Booking Appointments

    • Go to the Appointments page
    • Browse available counselors
    • Select a date and time
    • Confirm your booking
  4. Journaling

    • Access the Journal section
    • Write your thoughts and feelings
    • Entries are saved automatically
    • View your journal history
  5. Mood Tracking

    • Use the Mood Tracker to log your daily mood
    • View weekly and monthly trends
    • Identify patterns in your emotional well-being

For Developers

  1. Local Development

    # Start development server with auto-reload
    npm run dev
    
    # Start production server
    npm start
  2. Testing API Endpoints

    # Health check
    curl http://localhost:3001/health
    
    # Chat endpoint (example)
    curl -X POST http://localhost:3001/api/chat \
      -H "Content-Type: application/json" \
      -d '{"message": "Hello", "userId": "test-user"}'
  3. Building for Production

    # Install production dependencies
    npm ci --production
    
    # Start server
    npm start

🚒 Deployment

Solace can be deployed on various platforms. We provide detailed guides for multiple options:

Quick Deploy Options

  • Render (Recommended) - Free Node.js hosting
  • Railway - Alternative free hosting
  • Vercel - Static + serverless functions

Detailed Deployment Guides

Environment Variables for Production

Make sure to set these in your deployment platform:

PORT=3000
OPENAI_API_KEY=your-production-api-key
CORS_ORIGIN=https://your-domain.com
NODE_ENV=production

Deployment Checklist

  • Firebase project configured
  • Environment variables set
  • OpenAI API key configured
  • CORS origin set correctly
  • Database security rules configured
  • Custom domain configured (optional)
  • SSL certificate enabled
  • Error tracking set up (optional)

πŸ”’ Security & Privacy

Data Protection

  • Encryption: All data transmitted over HTTPS
  • Firebase Security: Firestore security rules protect user data
  • API Security: Rate limiting prevents abuse
  • Privacy-First: User data is not shared with third parties

Compliance

  • MoHFW Compliant: Aligns with Indian Ministry of Health guidelines
  • Privacy Policy: Comprehensive privacy policy available
  • Terms of Service: Clear terms and conditions
  • Data Retention: User data retention policies in place

Best Practices

  • Never commit API keys or secrets to version control
  • Use environment variables for sensitive configuration
  • Regularly update dependencies for security patches
  • Implement proper authentication and authorization
  • Monitor API usage for suspicious activity

Reporting Security Issues

If you discover a security vulnerability, please email security@solace.com (or create a private security advisory on GitHub). Do not open a public issue.


🀝 Contributing

We welcome contributions to Solace! Here's how you can help:

How to Contribute

  1. Fork the repository

    # Click the Fork button on GitHub
    # Then clone your fork
    git clone https://github.com/yourusername/solace-main.git
  2. Create a branch

    git checkout -b feature/your-feature-name
    # or
    git checkout -b fix/your-bug-fix
  3. Make your changes

    • Write clean, readable code
    • Follow existing code style
    • Add comments where necessary
    • Update documentation if needed
  4. Test your changes

    • Test locally before submitting
    • Ensure no breaking changes
    • Test edge cases
  5. Commit your changes

    git add .
    git commit -m "feat: Add new feature description"
    # Use conventional commit messages:
    # feat: New feature
    # fix: Bug fix
    # docs: Documentation changes
    # style: Code style changes
    # refactor: Code refactoring
    # test: Adding tests
    # chore: Maintenance tasks
  6. Push and create Pull Request

    git push origin feature/your-feature-name
    # Then create a PR on GitHub

Contribution Guidelines

  • βœ… Follow the existing code style
  • βœ… Write meaningful commit messages
  • βœ… Update documentation for new features
  • βœ… Add comments for complex logic
  • βœ… Test your changes thoroughly
  • βœ… Keep PRs focused and small
  • βœ… Respond to code review feedback

Areas for Contribution

  • 🌍 Localization: Add support for more languages
  • 🎨 UI/UX Improvements: Enhance user interface and experience
  • πŸ§ͺ Testing: Add unit and integration tests
  • πŸ“š Documentation: Improve docs and add examples
  • πŸ› Bug Fixes: Fix reported issues
  • ✨ Features: Suggest and implement new features
  • πŸ”§ Performance: Optimize code and improve performance

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2025 Solace AI Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

πŸ†˜ Support

Crisis Support (India)

If you're experiencing a mental health crisis, please reach out to:

  • AASRA (24/7): πŸ“ž 9152987821
  • iCALL Mental Health: πŸ“ž 9820466726
  • National Health Helpline: πŸ“ž 104
  • YourDOST (Students): πŸ“ž 8448440632

Note: Solace is not a replacement for emergency medical or mental health services. If you're in immediate danger, please contact your local emergency services.

Frequently Asked Questions

Q: Is Solace free to use?
A: Yes, the basic features are free. Some premium features like 1-on-1 counseling may have associated costs.

Q: Is my data private?
A: Absolutely. We use industry-standard encryption and follow strict privacy policies. Your data is never shared with third parties.

Q: Can I use Solace anonymously?
A: Some features require an account, but you can use minimal information to sign up. We prioritize your privacy.

Q: Is Solace available in languages other than English?
A: We're working on multilingual support. Currently, resources are available in multiple languages.

Q: How accurate is the AI companion?
A: The AI is designed to provide empathetic support and general guidance, but it's not a replacement for professional therapy.


πŸ™ Acknowledgments

  • OpenAI - For providing the GPT-3.5 API that powers our AI companion
  • Firebase - For authentication and database services
  • Express.js Community - For the robust web framework
  • Mental Health Advocates - For inspiration and guidance
  • Open Source Community - For the amazing tools and libraries
  • Students Worldwide - For trusting us with your mental wellness journey

πŸ“Š Project Status

Current Version: 1.0.0
Status: βœ… Active Development
Last Updated: January 2026

Roadmap

  • Mobile app (iOS/Android)
  • Advanced analytics dashboard
  • Video counseling sessions
  • Group therapy sessions
  • Multilingual AI support
  • Integration with university systems
  • Gamification and wellness challenges
  • Peer mentoring program

Made with πŸ’™ for Student Mental Wellness

Solace - Because your mental health matters.

Website


⭐ Star this repo if you find it helpful! ⭐

About

Your Gentle Companion for Mental Wellness. A warm, supportive digital mental health platform designed with love for students. Here, your mental health matters, your feelings are valid, and you're never alone on this journey.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages