fuzzyworld

north-star / mobile / files / readme.md

Branch mobile · default branch · all branches

readme.md

9.2 KB · history · blame

Friend Compass

What is it?

Friend Compass is a web application that lets users share location in real-time with others. It provides a simple interface to see where everyone is relative to themselves, and does not require any accounts or authentication. Just share the room link or QR code, and everyone can join and see each other's location on a map.

Features

FYI: The app is free to use, but hosting is not always free. It relies on Firebase Realtime Database, which has a generous free tier but may incur costs if usage exceeds those limits.

Requirements

How to use it?

  1. Open Friend Compass.
  2. Share the room QR code or room link with your friends so they can join the same "room".
  3. Everyone who joins the room can see each other's relative location as an arrow.
  4. Everyone can set a custom name and color for their marker.
  5. You can hide or reorder friends.
  6. The North participant is a special marker that always points north.
  7. If North is not pointing to true north, orient your phone so "up" on the screen faces north, then click "Calibrate North". This sets the current orientation as north.
  8. A misaligned north is only a visual issue and does not affect actual location sharing.

How does it work?

The app uses Firebase Realtime Database to store and sync location data of all friends in real-time. When a user joins a room, they are added to the database with location and profile info. The app listens for database changes and updates the map accordingly.

Is it secure?

The app does not require authentication, so anyone with the room information can join and see locations of all their friends.

The room link/QR code contains a unique room id and encryption key. Even if someone gained database access (including myself), they could not read location data without the room link.

Share the room QR code/link only with trusted people to protect your privacy.

If a link is leaked or compromised, create a new room and share the new QR code/link with your friends.

Here is a screenshot of database info currently stored (March 2026) for test rooms. Room and friend ids are random strings, and friend info is encrypted. Without the room link, data in the database cannot be tied to real-world identities or locations.

Firebase Realtime Database view (March 2026) with encrypted participant
information

Links

Inspiration

Totem Compass and Crowd Compass provide similar functionality, but they are physical products made for off-the-grid use cases such as hiking or festivals where cellular connectivity may be limited.

This app is designed for phone-first scenarios where people want to share location with friends (or strangers) in real-time and have internet connectivity.

Development

Local development

  1. Install dependencies:

    bash npm install

  2. Run the dev server:

    bash npm run dev

  3. Build production artifacts into ./public:

    bash npm run build

  4. Preview the production build locally:

    bash npm run preview

Features Implemented

User-Facing Features

Technical Improvements

Future Work

Planned Features

Mobile Platform Support

Firebase database rules

This repo includes Realtime Database security rules in config/firebase/database.rules.json.

The rules can be deployed using the Firebase CLI, with

npm run firebase:deploy-rules

Without these rules, your database may allow unsafe writes.

Firebase stale room cleanup

The app does not currently implement any automatic cleanup of stale rooms or participants. This means that if a room is created and then abandoned, its data will remain in the database indefinitely.

To clean up stale rooms, we're using GitLab's scheduled pipelines to run a cleanup script every week.

The script can be called manually in preview mode with

npm run clean-old-firebase:preview-30d

and actually executed with

npm run clean-old-firebase:run-30d

Absolute location

I explicitly chose not to expose direct map deep links in the UI, and this feature will not be added.

The app keeps precise coordinates internally for relative-arrow calculations, but intentionally shows only relative directions.

This is a current design choice. Feel free to bring this up in an issue if you have strong feelings about it.

Testing

Is it open source?

You're looking at it.

License

This project is licensed under the MIT License.

Why MIT for this project?

Short version: emotional simplicity and momentum.

Tradeoff accepted:

If priorities change later (for example, stronger anti-closed-clone goals), future versions can be relicensed with a different strategy.

Source
1# Friend Compass
2
3## What is it?
4
5Friend Compass is a web application that lets users share location in
6real-time with others. It provides a simple interface to see where everyone
7is relative to themselves, and does not require any accounts or
8authentication. Just share the room link or QR code, and everyone can join
9and see each other's location on a map.
10
11## Features
12
13- Real-time location sharing with multiple friends
14- No authentication required, just share the room link or QR code to join
15- No app to install, works on mobile browsers with geolocation support
16- Relative location markers on a map showing direction and distance to each
17 friend
18- Customizable markers with names and colors
19- A special "North" marker that always points north and can be used to
20 calibrate the app for better accuracy
21- Works on iOS and Android devices with modern browsers (Safari, Chrome,
22 etc.)
23- Privacy-focused design with encrypted location data and no personally
24 identifiable information stored in the database
25- Open source and free to use for anyone with a compatible device and
26 internet connection
27
28> FYI: The app is free to use, but hosting is not always free. It relies on
29> Firebase Realtime Database, which has a generous free tier but may incur
30> costs if usage exceeds those limits.
31
32## Requirements
33
34- A smartphone with a modern browser that supports geolocation (for example,
35 Safari on iOS or Chrome on Android)
36- An internet connection to sync location data in real-time
37- Location permissions granted to the browser for the app to access your
38 location
39- Camera to scan QR codes (optional, but helps users join rooms faster)
40- For best results, use the app outdoors or in areas with good GPS signal,
41 since indoor locations may have reduced accuracy
42
43## How to use it?
44
451. Open [Friend Compass][app-link].
462. Share the room QR code or room link with your friends so they can join the
47 same "room".
483. Everyone who joins the room can see each other's relative location as an arrow.
494. Everyone can set a custom name and color for their marker.
505. You can hide or reorder friends.
516. The North participant is a special marker that always points north.
527. If North is not pointing to true north, orient your phone so "up" on the
53 screen faces north, then click "Calibrate North". This sets the current
54 orientation as north.
558. A misaligned north is only a visual issue and does not affect actual
56 location sharing.
57
58## How does it work?
59
60The app uses Firebase Realtime Database to store and sync location data of all
61friends in real-time. When a user joins a room, they are added to the database
62with location and profile info. The app listens for database changes and
63updates the map accordingly.
64
65## Is it secure?
66
67The app does not require authentication, so anyone with the room information
68can join and see locations of all their friends.
69
70The room link/QR code contains a unique room id and encryption key. Even if
71someone gained database access (including myself), they could not read
72location data without the room link.
73
74Share the room QR code/link only with trusted people to protect your privacy.
75
76If a link is leaked or compromised, create a new room and share the new QR
77code/link with your friends.
78
79Here is a screenshot of database info currently stored (March 2026) for test
80rooms. Room and friend ids are random strings, and friend info is encrypted.
81Without the room link, data in the database cannot be tied to real-world
82identities or locations.
83
84![Firebase Realtime Database view (March 2026) with encrypted participant
85information][firebase-db-screenshot]
86
87## Links
88
89- Repo: [GitLab repository][repo-link]
90- App: [Friend Compass app][app-link]
91
92## Inspiration
93
94[Totem Compass](https://totemlabs.com/) and
95[Crowd Compass](https://www.crowdcompass.io/) provide similar functionality,
96but they are physical products made for off-the-grid use cases such as hiking
97or festivals where cellular connectivity may be limited.
98
99This app is designed for phone-first scenarios where people want to share
100location with friends (or strangers) in real-time and have internet
101connectivity.
102
103## Development
104
105### Local development
106
1071. Install dependencies:
108
109 ```bash
110 npm install
111 ```
112
1132. Run the dev server:
114
115 ```bash
116 npm run dev
117 ```
118
1193. Build production artifacts into `./public`:
120
121 ```bash
122 npm run build
123 ```
124
1254. Preview the production build locally:
126
127 ```bash
128 npm run preview
129 ```
130
131### Features Implemented
132
133#### User-Facing Features
134
135- **Wake-Lock (Stay-Awake Mode)** - Emoji toggle button (💤/🔆) keeps device
136 screen active during tracking
137- **Toast Notifications** - Contextual feedback for compass events,
138 calibration status, and wake-lock actions
139- **Compass Calibration Feedback** - Toast messages for permission denied,
140 enabled, unavailable, and calibrated states
141- **User Profile Persistence** - Custom name and color saved locally and
142 restored on app reload
143- **Dark Mode Support** - Toggle dark mode with persistent preference storage
144- **Accessibility Improvements** - ARIA labels, semantic HTML, and keyboard
145 navigation support
146
147#### Technical Improvements
148
149- **Strict TypeScript Mode** - All ~40 files migrated; zero type errors
150- **Domain-Driven Folder Structure** - Organized into `src/core`,
151 `src/features`, and `src/platform` with domain subfolders
152- **Barrel Index Files** - Simplified imports across feature modules
153- **Naming Convention Standardization** - All filenames use underscores, not
154 dashes
155
156### Future Work
157
158#### Planned Features
159
160- Optional user-facing low-power tracking mode toggle (battery saver style
161 control)
162- Friend stale-state UX polish (for example: clearer badges, subtle icons,
163 better wording)
164- Export/share diagnostics mode for easier field testing (sensor
165 availability, last sync times, etc.)
166- Continue migrating behavior-tuning constants into public settings (for
167 example initial seed position and other non-sensitive runtime defaults)
168
169#### Mobile Platform Support
170
171- **React Native + Expo Migration** - Reuse ~80% of TypeScript logic (crypto,
172 utils, Firebase sync) while rebuilding the UI layer for iOS/Android native
173 support with background geolocation
174- **Background Geolocation** - Continuous location tracking even when the app
175 is in the background (requires native implementation)
176- **Battery Optimization** - Configurable tracking intervals and geofencing so
177 users can define regions where they care about updates (or where they do
178 not)
179
180### Firebase database rules
181
182This repo includes Realtime Database security rules in
183[config/firebase/database.rules.json](config/firebase/database.rules.json).
184
185The rules can be deployed using the Firebase CLI, with
186
187```bash
188npm run firebase:deploy-rules
189```
190
191Without these rules, your database may allow unsafe writes.
192
193### Firebase stale room cleanup
194
195The app does not currently implement any automatic cleanup of stale rooms or
196participants. This means that if a room is created and then abandoned, its
197data will remain in the database indefinitely.
198
199To clean up stale rooms, we're using GitLab's scheduled pipelines to run a
200cleanup script every week.
201
202The script can be called manually in preview mode with
203
204```bash
205npm run clean-old-firebase:preview-30d
206```
207
208and actually executed with
209
210```bash
211npm run clean-old-firebase:run-30d
212```
213
214### Absolute location
215
216I explicitly chose not to expose direct map deep links in the UI, and this
217feature will **not** be added.
218
219The app keeps precise coordinates internally for relative-arrow calculations,
220but intentionally shows only relative directions.
221
222This is a current design choice. Feel free to bring this up in an issue if
223you have strong feelings about it.
224
225### Testing
226
227- BrowserStack test link: [Open BrowserStack session][browserstack-link]
228- Firebase console: [North Star Firebase console][firebase-console-link]
229
230### Is it open source?
231
232You're looking at it.
233
234### License
235
236This project is licensed under the MIT License.
237
238#### Why MIT for this project?
239
240Short version: emotional simplicity and momentum.
241
242- This is a weekend project, and I want low-friction freedom to build, share,
243 and potentially monetize my own work without overthinking legal structure
244- I considered stricter licenses (for example AGPL) to make clone
245 monetization harder, but that adds policy/process overhead I do not want
246 right now
247- MIT is the simplest path to keep shipping and enjoying the project
248
249Tradeoff accepted:
250
251- MIT allows others to clone and monetize too, including with better
252 marketing
253- For this project, that risk is acceptable compared to the cost (time +
254 mental load) of managing a more restrictive licensing setup
255
256If priorities change later (for example, stronger anti-closed-clone goals),
257future versions can be relicensed with a different strategy.
258
259[repo-link]: https://gitlab.com/PavelSafronov/north-star
260[app-link]: https://pavelsafronov.gitlab.io/north-star/
261[firebase-db-screenshot]: ./firebase-realtime-database-view.png
262[browserstack-link]: https://live.browserstack.com/dashboard#os=iOS&os_version=26.0&device_browser=safari&zoom_to_fit=true&full_screen=true&url=https%3A%2F%2Fpavelsafronov.gitlab.io%2Fnorth-star&speed=1
263[firebase-console-link]: https://console.firebase.google.com/project/north-star-e5dee/overview