By:
This is the development branch of Hello-There, for the production branch, switch to "Master" The guide below provides step-by-step instructions to set up, run, and use the development version of the Proximity Chat App, a decentralized, proximity-based chat application.
Production PWA https://hellothere-client.onrender.com/
The app uses:
- A Flask backend for signaling
- A Create React App (CRA) frontend (deployable as a PWA)
- WebRTC for peer-to-peer communication
- Geolocation APIs for proximity detection
- Built with Create React App (CRA) for a Progressive Web App (PWA)
- Uses React, WebRTC, and Browser Geolocation API
- Flask server for WebRTC signaling
- Uses
flask-corsfor CORS handling - Runs locally with gunicorn and gevent
| Layer | Stack |
|---|---|
| Frontend | JavaScript, React, WebRTC, Browser Geolocation API |
| Backend | Python, Flask, flask-cors |
- Frontend:
https://localhost:3000 - Backend:
https://localhost:5000 - Uses mkcert to generate a self-signed SSL certificate.
Make sure your Ubuntu system has the following installed:
-
Git:
sudo apt install git -
Python 3.12.3:
sudo apt install python3.12 python3.12-venv -
Node.js 18:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt install -y nodejs -
npm: Comes with Node.js (
npm -v) -
mkcert:
sudo apt install libnss3-tools wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64 sudo mv mkcert-v1.4.4-linux-amd64 /usr/local/bin/mkcert sudo chmod +x /usr/local/bin/mkcert
-
Google Chrome:
sudo apt install google-chrome-stable
git clone https://github.com/<your-username>/proximity-chat-app.git
cd proximity-chat-appReplace <your-username> with your GitHub username.
Project structure:
server/ # Flask backend
client/ # CRA frontend
render.yaml # Deployment config (not used locally)
cd server
python3.12 -m venv venv
source venv/bin/activatepip install -r requirements.txtExpected packages:
- flask==2.0.1
- flask-cors==3.0.10
- gevent==24.2.1
- greenlet==3.1.1
- gunicorn==22.0.0
- werkzeug==2.2.3
mkdir -p .cert
cd .cert
mkcert localhostThis creates:
localhost.pem(certificate)localhost-key.pem(key)
Update .gitignore:
echo ".cert/" >> ../.gitignore-
Open
chrome://settings/security -
Click Manage certificates
-
Go to Trusted Root Certification Authorities
-
If not already trusted, import:
~/.local/share/mkcert/rootCA.pem -
Restart Chrome
To verify, visit:
https://localhost:5000/debug_peer_to_room
cd ../../client
npm install
npm list --depth=0cd ../server
source venv/bin/activate
python app.pyEnsure app.py includes:
ssl_context=('.cert/localhost.pem', '.cert/localhost-key.pem')Expected output:
* Running on https://localhost:5000
Test with:
curl -k https://localhost:5000/debug_peer_to_roomOpen a new terminal:
cd proximity-chat-app/client
npm startOpens browser at http://localhost:3000.
- Chrome (2 tabs) or
- Chrome + Firefox
-
Open DevTools → More Tools → Sensors
-
Set location to:
Latitude: 41.7234944 Longitude: 44.7807488
Edit client/src/App.jsx:
<RoomManager peerId="peer1" />Click Connect in both windows.
Expected:
- Loader disappears
- “Room joined” popup
- “Connected to 1 peer(s)” displayed
Type and send a message.
Expected:
- Styled messages (green for self, gray for other)
Click ✕ Leave
Expected:
- Loader reappears
- Peer count updates to 0
- Click + icon in Chrome to install the PWA
- Launch offline to test graceful failure
| Issue | Fix |
|---|---|
| Backend fails to start | Check for ImportError. Run pip check. Ensure .cert/*.pem files exist |
| CORS errors | Ensure: CORS(app, resources={r"/*": {"origins": "http://localhost:3000"}}) |
| Chrome shows “Not Secure” | Ensure mkcert root cert is trusted. Re-run mkcert -install if needed |
| Frontend can’t connect | Check fetch URLs in RoomManager.jsx. Backend must be running |
| WebRTC not working | Check client/src/utils/webrtc.js config. Ensure permissions for mic, camera, location |
-
Local vs Production:
Local Production (Render) http://localhost:3000 https://proximity-chat-frontend.onrender.com https://localhost:5000 https://proximity-chat-backend.onrender.com