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.
- Multi-tenancy: Each tenant (organization or domain) has its own isolated database.
- Multi-user dashboard, records and calendar: Each doctor has it's own calendar, dashboard and records. Each patient registered under the doctor via "Add Records" will be assigned only to that doctor.
- Doctor Appointments: Manage appointments with a calendar view and dashboard categorizing appointments into active, archived, and completed.
- Patient Records: Maintain patient records, ensuring that only patients with existing records can be added to appointments.
- Patient Appointments: Multiple patients can be added to a single event, only if the record of the patient exist.
- User Authentication and Authorization: Secure user authentication and role-based access control (RBAC).
- RESTful API: Exposes a RESTful API for integration with other services.
- Scalable and Extendable: Built to accommodate growth and additional features.
- For each created tenant with domain, there will be a seperated database independent from the other tenants. You can create users and doctors. Assign the user to the doctor and assign the doctor to the domain(tenant) via the admin panel.
- Each doctor creates its own patients and appointments. Each element is being assigned to him by their id in the database and cannot be viewed, changed or deleted by other users(doctors).
- DoctorsApp/: Main application directory containing all the core functionalities and modules.
- manage.py: Command-line utility for administrative tasks.
- requirements.txt: List of dependencies required to run the application.
- 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
- Install dependencies:
pip install -r requirements.txt
- 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", }
}
- Make Migrations:
python manage.py makemigrations
- Migrate:
python manage.py migrate_schemas --shared python manage.py migrate
- Create a superuser, so you can add a tenant and domain:
python manage.py createsuperuser
- How to add tenant superuser
python manage.py create_tenant_superuser
- Run App:
python manage.py runserver
- Once you run the app you will be prompted to your_default_host:your_dafault_port . A Django default homepage will appear that installation has been completed.
- In order to access the main admin panel you have to go to:
your_default_host:your_dafault_port/admin Example(example.com:8000/admin)
- There you can add tenant and domain. First add a tenant, then assign the tenant to the domain.
To access the domain go to:
your_custom_domain_name:your_default_port Example(example.com:8000)
- Same way you can access admin if you add /admin by the end of the port.
- Create a user via the admin panel, then create a doctor and assign the doctor to the user and the domain.
- Login via adding /login page by adding it by the end of the port.
- Use the user's credentials to access the app.
- Contributions are welcome! Please fork the repository and create a pull request with your changes
This project is licensed under the MIT License - see the LICENSE file for details.