Multi-tenant Doc App with Independent Databases

This repository contains a multi-tenant doctor appointments application with independent databases for each tenant domain. It is designed to provide a scalable and secure solution for managing appointments across multiple tenants while ensuring data isolation and privacy.

Features

How It Works

For each created tenant with a domain, there will be a separate database independent from the other tenants. You can create users and doctors, assign users to doctors, and assign doctors to the domain (tenant) via the admin panel. Each doctor manages their own patients and appointments, with data isolated by database IDs, ensuring no cross-user interference.

Repository Structure

Installation

  1. Clone the repository:
    git clone https://github.com/TsvetanG2/Multi-tenant-DocApp-with-independent-database-for-each-tenant-domain.git
    cd Multi-tenant-DocApp-with-independent-database-for-each-tenant-domain
  2. Install dependencies:
    pip install -r requirements.txt
  3. Set up the database in settings.py:
    DATABASES = {
        "default": {
            "ENGINE": 'django_tenants.postgresql_backend',
            "NAME": "your_database",
            "USER": "your_user",
            "PASSWORD": "your_password",
            "HOST": "your_default_host",
            "PORT": "your_default_port",
        }
    }

Run App

  1. Make migrations:
    python manage.py makemigrations
  2. Migrate:
    python manage.py migrate_schemas --shared
    python manage.py migrate
  3. Create a superuser:
    python manage.py createsuperuser
  4. Create a tenant superuser:
    python manage.py create_tenant_superuser
  5. Run the app:
    python manage.py runserver

Usage

Once the app is running, visit your_default_host:your_default_port. To access the main admin panel, navigate to your_default_host:your_default_port/admin. Add tenants and domains, then assign users and doctors as needed. Login pages are available at your_custom_domain_name:your_default_port/login.

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes.

License

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

App Screenshots