Skip to content
Ruby Bui edited this page May 11, 2025 · 1 revision

Welcome to the mind-matter wiki!

Mind Matter Wiki

Overview

Mind Matter is a mental health and wellness application that helps users track their mood, participate in surveys, and engage in wellness campaigns. The application consists of a Flask backend API and a React frontend.

Table of Contents

  1. Architecture
  2. Features
  3. API Documentation
  4. Database Schema
  5. Development Guide
  6. Deployment

Architecture

Backend

  • Framework: Flask (Python)
  • Database: SQLAlchemy ORM
  • API Documentation: Flasgger (Swagger)
  • Authentication: JWT-based authentication
  • Schema Validation: Marshmallow

Frontend

Features

User Management

  • User registration and authentication
  • Profile management
  • Data sharing preferences

Surveys

  • Dynamic survey creation and management
  • Multiple question types support
  • Survey scheduling and notifications
  • Response tracking and analysis

Mood Tracking

  • Daily mood logging
  • Activity tracking
  • Historical data visualization

Campaigns

  • Wellness campaign participation
  • Incentive management
  • Reward system

Emergency Contacts

  • Emergency contact management
  • Quick access to support resources

API Documentation

Authentication Endpoints

  • POST /auth/register - User registration
  • POST /auth/login - User login
  • POST /auth/refresh - Token refresh

Survey Endpoints

  • GET /surveys - List all surveys
  • POST /surveys - Create new survey
  • GET /surveys/{id} - Get survey details
  • POST /surveys/{id}/responses - Submit survey response
  • GET /surveys/{id}/responses - Get survey responses

User Endpoints

  • GET /users/me - Get current user profile
  • PUT /users/me - Update user profile
  • GET /users/me/responses - Get user's survey responses

Database Schema

Core Tables

  • users - User information
  • surveys - Survey definitions
  • survey_questions - Survey questions
  • survey_responses - User responses
  • survey_answers - Individual answers
  • mood_activity_logs - Mood and activity tracking
  • campaigns - Wellness campaigns
  • emergency_contacts - Emergency contact information

Development Guide

Prerequisites

  • Docker and Docker Compose
  • Python 3.12.8
  • Node.js (for frontend development)

Local Development Setup

  1. Clone the repository
  2. Copy .env.example to .env
  3. Build Docker containers:
    docker compose build
  4. Start development server:
    docker compose up mind-matter-flask-dev

Database Management

  • Initialize database:
    docker compose run --rm mind-matter-manage db init
  • Create migrations:
    docker compose run --rm mind-matter-manage db migrate
  • Apply migrations:
    docker compose run --rm mind-matter-manage db upgrade

Testing

  • Run tests:
    docker compose run --rm mind-matter-manage test
  • Run linter:
    docker compose run --rm mind-matter-manage lint

Deployment

Backend Deployment

  1. Build production Docker image
  2. Configure environment variables
  3. Deploy to your preferred hosting service

Frontend Deployment

  • Frontend is automatically deployed to Vercel
  • Environment variables are managed through Vercel dashboard

Additional Resources

Documentation

API Documentation

  • Swagger UI available at: http://localhost:5000/apidocs (when running locally)

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

[Add your license information here]