A full-stack healthcare management system built with Django for the backend and React for the frontend. This project uses JWT (JSON Web Tokens) for user authentication and provides access control to various features, including user login, registration, and protected endpoints.
- Project Overview
- Technologies Used
- Backend Setup (Django)
- Frontend Setup (React)
- API Endpoints
- Database Schema
- Development
- Testing
- Contributing
- License
This project is a web-based healthcare portal designed to manage patient information, appointments, prescriptions, and more. The system allows healthcare professionals (doctors) and patients to interact efficiently and securely.
Key features include:
- Secure login and registration via JWT.
- Doctor's ability to manage time off and prescriptions.
- User roles for managing access to specific resources.
- Comprehensive user authentication with email, username, or phone number.
- Backend: Django, Django REST Framework (DRF)
- Authentication: JWT (via
djangorestframework-simplejwt) - Frontend: React.js
- Database: PostgreSQL (or any preferred database)
- Development Tools: Docker, Git
- API Documentation: Swagger (via
drf-yasg)
This section guides you through setting up the backend of the project using Django and Django REST Framework.
First, clone the project repository to your local machine:
git clone https://github.com/stephen-nene/Tiberbu.git
cd Tiberbu/apiIt's a good practice to use a virtual environment to manage dependencies.
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`mkv # On Zsh, with ohmyzsh`
vrunWe need a .env for our secrets
VITE_BACKEND_URL=http://127.0.0.1:8000/api/v1.0/
FRONTEND_URL=https://tiberbuke.vercel.app
SECRET_KEY=iuwgeuuwioehowheoifdhoqiehfioheiofh
DATABASE_URL=uiwfuiwueifouewuf
MAIL_SERVER=ejwgfjkwbrjkgfbejkbrgljb3jgrb
MAIL_USERNAME=ergui3guerjgbk
MAIL_PASSWORD=ifg3gruifui3rf
MAIL_PORT=567
DEBUG=True
ENVIRONMENT=developmentInstall the required dependencies using pip.
pip install -r requirements.txtMake sure to configure your database settings in settings.py. You can use PostgreSQL, SQLite, or any other database of your choice. If using PostgreSQL, configure the database in the following section of settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'your_database_name',
'USER': 'your_database_user',
'PASSWORD': 'your_database_password',
'HOST': 'localhost',
'PORT': '5432',
}
}Run the migrations to set up your database schema:
python manage.py migrateCreate an admin user to access the Django admin panel:
python manage.py createsuperuserStart the Django development server:
python manage.py runserverYour Django backend should now be accessible at http://127.0.0.1:8000.
This section will guide you on how to set up the frontend with React.
Clone the frontend directory to your local machine:
git clone https://github.com/stephen-nene/Tiberbu.git
cd Tiberbu/clientInstall the necessary frontend dependencies using pnpm, npm or yarn.
npm installor
yarn installor
pnpm installCreate a .env file in the root of the frontend directory to store the API URL:
VITE_BACKEND_URL=http://127.0.0.1:8000/api/v1.0/
Start the React development server:
npm start pnpm start Your React frontend should now be accessible at http://localhost:5173.
Here are the core API endpoints exposed by the backend:
To run both the backend and frontend simultaneously:
- Backend: Follow the instructions under the Backend Setup (Django) section.
- Frontend: Follow the instructions under the Frontend Setup (React) section.
If you prefer using Docker, you can run both the backend and frontend with Docker Compose. This setup requires a docker-compose.yml file for both services (frontend and backend).
docker-compose upTo run tests for the Django backend, use the following command:
python manage.py testTo run tests for the React frontend, use the following command:
npm testWe welcome contributions to improve this project! Here's how you can contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'). - Push to your branch (
git push origin feature/your-feature). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Django: For building a robust and scalable web framework.
- Django REST Framework: For enabling API development with minimal effort.
- React: For building a dynamic and responsive frontend.
- djangorestframework-simplejwt: For simplifying JWT authentication integration.
