HealLink is a mobile-first project (React Native / Expo) paired with a FastAPI backend and MongoDB that helps manage health campaigns, fundraisers (cagnottes), and donations. The mobile app integrates Firebase Authentication, QR scanning, maps, and real-time features via WebSocket.
- Features
- Tech Stack
- Getting Started
- API Documentation
- WebSocket Usage
- Data & Seeding
- Environment Variables
- Development Workflow
- Troubleshooting
- Contributing
- License & Contact
- Create and list health campaigns (vaccination drives, blood drives)
- Create and manage cagnottes (fundraisers)
- Make donations to cagnottes
- QR code generation and scanning
- Maps integration to show campaign locations
- Firebase Authentication (email/password + Google suggested)
- Real-time messaging / events via WebSocket
- Frontend: Expo / React Native (see
frontend/healLink-project)- Expo, React Navigation, Firebase, react-native-maps, QR code libraries
- Backend: FastAPI + Motor (async MongoDB client) (
backend/main.py) - Database: MongoDB (local or Atlas)
- Realtime: WebSocket endpoint (
/ws)
- Node.js (16+ recommended) and npm or Yarn
- Expo CLI (optional but recommended):
npm install -g expo-cli - Python 3.10+
- MongoDB (local or Atlas)
- (Optional) A Firebase project (for authentication)
- Open a terminal and go to the backend folder:
cd backend- Create a virtual environment and install requirements:
python -m venv .venv
# Windows
.venv\Scripts\activate
# Unix/macOS
source .venv/bin/activate
pip install -r requirements.txt- Configure MongoDB connection (environment variable):
MONGO_DETAILS- Mongo connection string (default:mongodb://localhost:27017)
- Run the backend:
# run directly
python main.py
# or use uvicorn
uvicorn main:app --reload --host 0.0.0.0 --port 8000The backend endpoints are served on http://localhost:8000 by default.
- Install dependencies and start the app:
cd frontend/healLink-project
npm install
# or
# yarn
# start expo
npm run start
# run on Android
npm run android
# run on iOS
npm run ios- Firebase settings are read from environment variables (see
src/config/firebaseConfig.js).
Base URL: http://localhost:8000
-
GET
/campagnes— List campaigns -
POST
/campagnes— Create a campaign (send JSON matching model) -
GET
/cagnottes— List active cagnottes -
POST
/cagnottes— Create a cagnotte -
POST
/cagnottes/{cagnotte_id}/don— Make a donation to a cagnotte -
GET
/dons— Get recent donations
Example: Create a cagnotte with curl
curl -X POST http://localhost:8000/cagnottes \
-H "Content-Type: application/json" \
-d '{"titre":"Soutien clinique X","objectif":1000}'Connect to: ws://<backend-host>:8000/ws
A simple client example (JavaScript):
const ws = new WebSocket('ws://localhost:8000/ws');
ws.onopen = () => console.log('connected');
ws.onmessage = (evt) => console.log('message', evt.data);
// The server sends a welcome message with a `userID` stringYou can send messages to the server; the backend currently demonstrates a small poke-style messaging between clients by sending the recipient's userID as content.
There is a data_db/ folder with sample text files that represent sample data exports:
dataCagnotte.txt— sample cagnottesdataCampagne.txt— sample campagnesdataDon.txt— sample donations
You can import them into MongoDB manually or extend the backend with a small seeder script.
Backend:
MONGO_DETAILS— MongoDB connection string
Frontend (Expo — see src/config/firebaseConfig.js):
EXPO_PUBLIC_FIREBASE_API_KEYEXPO_PUBLIC_FIREBASE_AUTH_DOMAINEXPO_PUBLIC_FIREBASE_PROJECT_IDEXPO_PUBLIC_FIREBASE_STORAGE_BUCKETEXPO_PUBLIC_FIREBASE_MESSAGING_SENDER_IDEXPO_PUBLIC_FIREBASE_APP_IDEXPO_PUBLIC_FIREBASE_MEASUREMENT_ID(optional)
Set them using .env and expo-cli or your preferred secret management.
Sample .env (do NOT commit to repo):
EXPO_PUBLIC_FIREBASE_API_KEY=your_api_key
EXPO_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
EXPO_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
EXPO_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=12345
EXPO_PUBLIC_FIREBASE_APP_ID=1:12345:web:abcde
- Feature branches with clear names (
feature/*), test locally, then open a PR - Keep backend contract stable if planning frontend changes: update API docs
- Linting & unit tests: add test suites to backend (pytest) and frontend (Jest / React Native Testing Library) as needed
- MongoDB connection errors: check
MONGO_DETAILSand ensure Mongo is accessible from the host - Expo app not connecting to backend: ensure backend is reachable from the device/emulator (use LAN IP or set tunnels in Expo)
- Firebase auth errors: confirm env variables and Firebase console OAuth settings
Contributions are welcome! Please:
- Fork the repo
- Create a branch for your feature/fix
- Open a PR describing the change
Add tests and keep changes focused.
This project can be licensed under MIT (or choose your preferred license).
For questions or contribution discussions, open issues or contact the repository owner.
Thank you for using HealLink! 💙