Skip to content

SoCool-Theo/Mental_Health_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LYFE β€” Mental Health Clinic Management System

Next.js Django PostgreSQL Docker

A comprehensive, containerized full-stack web application designed to manage clinic operations, patient records, therapist schedules, and secure communications.


πŸ—οΈ System Architecture

This project uses a decoupled, Dockerized architecture to ensure isolated environments and seamless deployment.

Layer Technology
Frontend Next.js (React), Axios, CSS Modules
Backend Django, Django REST Framework (DRF)
Database PostgreSQL
Auth JWT Authentication
Infrastructure Docker & Docker Compose
Networking Tailscale (secure remote tunnel access)

✨ Features

  • Role-Based Dashboards β€” Distinct interfaces and access levels for Admins, Therapists, and Patients.
  • Secure Authentication β€” JWT-based login and session management.
  • User Management β€” Admins can onboard staff, register patients, and manage account statuses.
  • Profile Management β€” Dynamic profile updates including secure image uploading.
  • Messaging System β€” Integrated chat threads for secure communication between patients and their assigned therapists.
  • Dynamic Routing β€” Environment variable-driven networking allowing seamless switching between localhost and Tailscale VPN IPs.

πŸ“‹ Prerequisites

Before running this project, ensure you have the following installed:


πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/SoCool-Theo/Mental_Health_System
cd Mental_Health_System

2. Configure Environment Variables

Frontend β€” Create a .env.local file inside the frontend/ directory:

NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
NEXT_PUBLIC_API_URL=http://localhost:8000/api/

Replace localhost with your Tailscale IP if testing across multiple devices on a VPN.

Backend β€” Ensure your backend/.env file or docker-compose.yml includes the required PostgreSQL credentials (e.g. POSTGRES_PASSWORD).

3. Build and Start the Containers

docker compose up --build -d

4. Run Database Migrations

docker compose exec backend python manage.py makemigrations
docker compose exec backend python manage.py migrate

# Explicitly migrate custom apps
docker compose exec backend python manage.py makemigrations communications
docker compose exec backend python manage.py migrate

5. Create an Admin Superuser

docker compose exec backend python manage.py createsuperuser

🌐 Accessing the Application

Service URL
Frontend (Next.js) http://localhost:3000
Backend API (Django) http://localhost:8000/api/

Remote Demo via Tailscale

To access the app from another device on your Tailscale network, bridge the Docker ports from your host Linux environment:

sudo tailscale serve --bg --tcp 8000 tcp://127.0.0.1:8000
sudo tailscale serve --bg --tcp 3000 tcp://127.0.0.1:3000

Then update your frontend/.env.local with your Tailscale IP and rebuild:

docker compose up --build

πŸ› οΈ Useful Commands

Command Description
docker compose down Stop all running containers
docker compose logs -f Stream live container logs
docker builder prune -a Clear build cache (fixes snapshot errors)

πŸ“ Project Structure

Mental_Health_System/
β”œβ”€β”€ frontend/                       # Next.js application
β”‚   β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ .env.local.example
β”‚   β”œβ”€β”€ package.json
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ backend/                        # Django backend
β”‚   └── mental_health_clinic/       # Django root directory
β”‚       β”œβ”€β”€ appointments/
β”‚       β”œβ”€β”€ communications/
β”‚       β”œβ”€β”€ users/
β”‚       β”œβ”€β”€ mental_health_clinic/   # Django project settings
β”‚       β”œβ”€β”€ manage.py
β”‚       β”œβ”€β”€ requirements.txt
β”‚       └── Dockerfile
β”œβ”€β”€ .env.example
└── docker-compose.yml

πŸ“„ License

This project was developed as part of a university submission. All rights reserved.

About

πŸš€ A comprehensive web application for managing mental health clinic operations, therapist schedules, and patient records. Dockerized and powered by Django & Next.js.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors