1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
|
# Sailing Companion App — Component Design Document
**Version:** 1.0
**Date:** 2026-03-13
**Status:** Draft
---
## Table of Contents
1. [Overview & Vision](#1-overview--vision)
2. [Competitive Analysis](#2-competitive-analysis)
3. [Core Technical Components](#3-core-technical-components)
4. [Technical Boating Features](#4-technical-boating-features)
5. [System Architecture](#5-system-architecture)
6. [Data Model Essentials](#6-data-model-essentials)
7. [External Integrations](#7-external-integrations)
8. [UX Principles](#8-ux-principles)
9. [Constraints & Considerations](#9-constraints--considerations)
10. [Phased Roadmap](#10-phased-roadmap)
---
## 1. Overview & Vision
### Purpose
A sailing companion app that serves as an integrated bridge instrument, weather advisor, performance coach, and safety system — all in one offline-capable mobile application. It replaces the need to juggle multiple single-purpose apps while underway.
### Target Users
| Segment | Use Case |
|----------------------|-------------------------------------------------------------|
| **Daysailors** | Quick weather check, anchor alarm, basic navigation |
| **Coastal cruisers** | Route planning, tide overlays, trip logging, safety alerts |
| **Passage makers** | Offshore weather routing, polar performance, watch keeping |
| **Club racers** | VMG optimization, layline calculation, polar targets |
| **Liveaboards** | Anchor watch, weather monitoring, logbook, maintenance logs |
### Key Differentiators
1. **Offline-first architecture** — full charting, routing, and safety features work without connectivity.
2. **Integrated performance polars** — real-time VMG coaching tied directly to weather and routing.
3. **Single-pane-of-glass bridge** — weather, chart, instruments, and safety on one screen.
4. **NMEA integration without proprietary lock-in** — works with any standard instrument bus.
5. **Glance-able UI designed for the cockpit** — large targets, high contrast, wet-hand friendly.
### Value Proposition
> "One app, one screen, everything you need from dock to dock — online or off."
Existing solutions force sailors to switch between a charting app, a weather app, a performance app, and a tide app. This product unifies all four and adds safety features (MOB, anchor alarm, watch alerts) that currently require dedicated hardware or separate apps.
---
## 2. Competitive Analysis
### Feature Comparison Matrix
| Feature | Navily | Windy | PredictWind | OpenCPN | SailGrib | Tides (various) | Navico GoFree | **This App** |
|----------------------------------|:------:|:-----:|:-----------:|:-------:|:--------:|:----------------:|:-------------:|:------------:|
| Vector charts | - | - | - | ✓✓ | ✓ | - | ✓✓ | ✓✓ |
| Raster charts | - | - | - | ✓✓ | ✓ | - | ✓ | ✓ |
| Weather overlay (wind/pressure) | - | ✓✓ | ✓✓ | ✓ | ✓✓ | - | ✓ | ✓✓ |
| Tide/current predictions | ✓ | ✓ | ✓ | ✓ | ✓ | ✓✓ | ✓ | ✓✓ |
| Route planning | - | - | ✓✓ | ✓✓ | ✓✓ | - | ✓ | ✓✓ |
| Weather routing (isochrones) | - | - | ✓✓ | ✓* | ✓✓ | - | - | ✓✓ |
| Performance polars | - | - | ✓ | ✓* | ✓ | - | - | ✓✓ |
| NMEA instrument integration | - | - | - | ✓✓ | - | - | ✓✓ | ✓✓ |
| MOB alarm | - | - | - | ✓ | - | - | ✓ | ✓✓ |
| Anchor alarm | ✓ | - | - | ✓* | - | - | ✓ | ✓✓ |
| Offline charts/weather | - | ✓* | ✓* | ✓✓ | ✓✓ | ✓ | ✓ | ✓✓ |
| Trip logbook | ✓ | - | - | ✓* | - | - | - | ✓✓ |
| Mobile-native UI | ✓✓ | ✓✓ | ✓✓ | - | ✓ | ✓✓ | ✓ | ✓✓ |
✓✓ = strong, ✓ = present, ✓* = via plugin/limited, - = absent
### Gaps in Existing Solutions
| Gap | Who suffers | Our answer |
|------------------------------------------------------|----------------------|-----------------------------------------------|
| No single app combines charting + weather + polars | Coastal/offshore | Unified bridge view |
| OpenCPN is powerful but desktop-first | Mobile-only sailors | Native mobile with full OpenCPN-class features|
| Windy/PredictWind lack real-time instrument data | Performance sailors | NMEA integration with live polar overlay |
| Navily focuses on social/anchorages, not navigation | Passage makers | Full nav suite, no social features |
| Tide apps are standalone, not integrated with charts | Coastal cruisers | Tide/current overlays on the chart |
| Anchor alarms require separate apps | All anchoring sailors| Built-in anchor watch with configurable alerts|
| No good offline weather routing on mobile | Offshore sailors | Offline GRIB processing + isochrone routing |
---
## 3. Core Technical Components
### Component Architecture Overview
```
┌──────────────────────────────────────────────────────────────────┐
│ UI / Presentation │
│ ┌──────────┐ ┌──────────┐ ┌───────────┐ ┌──────────────────┐ │
│ │ Chart │ │Instrument│ │ Weather │ │ Safety / Alerts │ │
│ │ View │ │ Panel │ │ Overlay │ │ Panel │ │
│ └────┬─────┘ └────┬─────┘ └─────┬─────┘ └───────┬──────────┘ │
│ │ │ │ │ │
├───────┴─────────────┴─────────────┴───────────────┴──────────────┤
│ Application Services │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌──────────────┐ │
│ │ Navigation │ │ Weather │ │ Performance│ │ Safety │ │
│ │ Engine │ │ Service │ │ Tracker │ │ Monitor │ │
│ └─────┬──────┘ └─────┬──────┘ └─────┬──────┘ └──────┬───────┘ │
│ │ │ │ │ │
├────────┴──────────────┴──────────────┴───────────────┴───────────┤
│ Data Layer │
│ ┌──────────┐ ┌──────────┐ ┌───────────┐ ┌────────────────┐ │
│ │ Chart DB │ │ Weather │ │ Logbook │ │ Settings / │ │
│ │ (S-57/ │ │ Cache │ │ Store │ │ Boat Profile │ │
│ │ MBTiles)│ │ (GRIB) │ │ (SQLite) │ │ (SQLite) │ │
│ └─────┬────┘ └────┬─────┘ └─────┬─────┘ └───────┬────────┘ │
│ │ │ │ │ │
├────────┴───────────┴─────────────┴───────────────┴───────────────┤
│ Platform / Hardware │
│ ┌────────┐ ┌──────────┐ ┌───────────┐ ┌──────────────────┐ │
│ │ GPS │ │ NMEA │ │ Compass / │ │ Cloud Sync │ │
│ │ Module │ │ Bridge │ │ Sensors │ │ (optional) │ │
│ └────────┘ └──────────┘ └───────────┘ └──────────────────┘ │
└──────────────────────────────────────────────────────────────────┘
```
### 3.1 Navigation & Vector Charting Module
**Responsibility:** Render nautical charts, manage chart data, handle pan/zoom, and overlay navigation objects (waypoints, routes, tracks, AIS targets).
| Subcomponent | Technology | Notes |
|----------------------|-----------------------------------|--------------------------------------------|
| Chart renderer | MapLibre GL Native / custom tiles | GPU-accelerated vector rendering |
| Chart data store | MBTiles (SQLite-backed) | Offline-first; predownloaded chart regions |
| S-57/S-63 parser | Custom or libosmium-based | Converts ENC data to internal tile format |
| Symbol library | INT-1 compliant symbol set | IHO S-52 presentation library |
| Overlay engine | Canvas/GL overlay layer | Routes, tracks, AIS, weather, tides |
**Key behaviors:**
- Seamless zoom from overview to harbor-scale.
- Depth shading with configurable safety contour.
- Chart quilting (multiple chart scales blended).
- Tap-to-query chart objects (buoys, lights, depths).
### 3.2 Real-time Weather & Environmental Data
**Responsibility:** Ingest, cache, and visualize wind, pressure, temperature, precipitation, wave, current, and tide data.
| Data Type | Source(s) | Update Interval | Offline Strategy |
|------------------------|-------------------------------|-----------------|----------------------------|
| Surface wind | GFS/ECMWF via GRIB2 | 6h | Pre-download GRIB files |
| Barometric pressure | GFS, device sensor | 6h / real-time | GRIB + local sensor |
| Tide height | NOAA CO-OPS, UKHO, SHOM | Static harmonic | Harmonic constants on-device|
| Tidal current | NOAA, regional models | Static harmonic | Harmonic constants on-device|
| Sea state / swell | WW3 via GRIB2 | 6h | Pre-download |
| Precipitation / clouds | GFS/ECMWF | 6h | Pre-download |
| Lightning | Blitzortung / provider API | Real-time | Not available offline |
**GRIB processing pipeline:**
```
Download GRIB2 ──► Decode (eccodes) ──► Spatial index ──► Render to tile cache
│ │
│ ┌──────────────────┐ │
└──────────────────►│ Interpolation │◄────────────────┘
│ (bilinear, time) │
└────────┬─────────┘
│
Weather at lat/lon/time
```
### 3.3 Sailing Performance Tracking
**Responsibility:** Compute and display real-time performance metrics derived from GPS, NMEA instruments, and boat polars.
**Core metrics computed:**
| Metric | Source(s) | Computation |
|--------|-----------|-------------|
| SOG (Speed Over Ground) | GPS | Direct from GPS fix |
| COG (Course Over Ground) | GPS | Direct from GPS fix |
| BSP (Boat Speed) | NMEA paddlewheel | Direct from instrument |
| HDG (Heading) | NMEA compass / device | Magnetic + variation = True |
| TWS/TWD (True Wind) | AWS/AWA + BSP + HDG | Vector triangle resolution |
| VMG (Velocity Made Good) | TWA + BSP | BSP × cos(TWA) |
| VMC (Velocity Made good to Course) | COG + SOG + bearing to WP | SOG × cos(bearing delta) |
| Heel angle | NMEA or device accelerometer | Direct or computed |
| Leeway | Heel + BSP + boat model | Empirical formula per hull type |
| Current set/drift | SOG/COG vs BSP/HDG | Vector difference |
| Polar % | BSP vs target BSP at TWS/TWA | (BSP / polar_target) × 100 |
**Polar engine:**
- Stores polar tables as TWS × TWA → target BSP lookup.
- Interpolates between data points (bicubic).
- Computes optimal VMG angles (upwind/downwind) per TWS.
- Outputs target boat speed and target TWA for current conditions.
### 3.4 Route Planning & Optimization
**Responsibility:** Create, edit, and optimize sailing routes considering weather, currents, tides, and boat polars.
**Route planning modes:**
1. **Manual waypoint routing** — user taps waypoints on chart; system computes distance, bearing, ETAs.
2. **Great-circle / rhumb-line routing** — for offshore passages.
3. **Weather routing (isochrone)** — optimal route given GRIB forecast and boat polars.
**Isochrone weather routing algorithm:**
```
Start ──► Generate fan of headings (5° increments)
│
▼
For each heading, compute BSP from polars at
forecast wind (TWS/TWD) and current
│
▼
Advance position by BSP × Δt (typically 1-3h steps)
│
▼
Prune: remove dominated points (slower to same isochrone)
│
▼
Repeat until isochrone reaches destination
│
▼
Backtrace optimal path through isochrone tree
```
**Tide gate logic:** Route optimizer accounts for tidal current vectors at each waypoint leg, adjusting ETAs and optimal departure times.
### 3.5 Safety & Alerting System
**Responsibility:** Monitor conditions and trigger alerts for safety-critical events.
| Alert Type | Trigger | Priority | Action |
|--------------------|------------------------------------------------------|----------|----------------------------------|
| **MOB** | User activation (hardware button / screen button) | CRITICAL | Drop MOB waypoint, start timer, show bearing/distance, sound alarm |
| **Anchor drag** | Position exceeds watch circle radius | HIGH | Audible + visual alarm, log event|
| **Depth** | Depth < user-configured minimum | HIGH | Audible alarm |
| **Off-course** | XTE > user-configured limit | MEDIUM | Visual + optional audible |
| **Weather change** | Wind shift > 30° or gust > threshold | MEDIUM | Push notification |
| **Watch alarm** | Timer expires (configurable intervals) | LOW | Audible alarm |
| **AIS CPA/TCPA** | Closest Point of Approach < threshold | HIGH | Visual + audible alarm |
| **Waypoint arrival**| Distance to active WP < arrival radius | LOW | Notification, auto-advance route |
**MOB workflow:**
1. Single-tap large MOB button (always visible) → drops waypoint at current GPS position.
2. Screen switches to MOB view: bearing and distance to MOB point, elapsed time.
3. Compass ring shows bearing to MOB.
4. If NMEA autopilot connected: offer "Williamson Turn" or "Direct Return" course command.
5. MOB event logged with timestamp, position, conditions.
6. Cannot be silenced without explicit confirmation.
### 3.6 Data Persistence & Cloud Sync
**Local storage (SQLite + file system):**
| Store | Format | Size Estimate |
|--------------------|--------------|----------------------|
| Chart tiles | MBTiles | 500 MB – 5 GB |
| GRIB weather | GRIB2 files | 50 – 500 MB |
| Tide harmonics | SQLite table | ~10 MB |
| Logbook / tracks | SQLite | ~1 MB/year |
| Boat profiles | SQLite | <1 MB |
| Routes / waypoints | SQLite | <1 MB |
| Settings | SharedPrefs / UserDefaults | <100 KB |
**Cloud sync strategy:**
- Sync logbook, routes, waypoints, boat profiles, and settings.
- Do NOT sync charts or GRIB data (too large, user downloads per-region).
- Conflict resolution: last-write-wins with device ID tiebreaker; logbook entries are append-only (no conflicts).
- Sync protocol: RESTful API with delta payloads; background sync on connectivity.
- Optional: WebDAV or self-hosted sync for privacy-conscious users.
### 3.7 Hardware Integration
**GPS:**
- Primary: device GPS (CoreLocation / Android FusedLocation).
- Secondary: external GPS via NMEA over TCP/UDP, Bluetooth, or USB serial.
- Fix rate: 1 Hz minimum; 5-10 Hz preferred for racing.
**NMEA 0183/2000 integration:**
```
┌───────────────────┐ ┌──────────────────┐
│ NMEA Instruments │ │ WiFi/BT NMEA │
│ (wind, depth, │────────►│ Gateway │
│ speed, compass) │ wired │ (e.g. Yacht │
└───────────────────┘ │ Devices, iKonvert│
│ Digital Yacht) │
└────────┬─────────┘
│ TCP/UDP
▼
┌──────────────────────┐
│ NMEA Parser Module │
│ ─────────────────── │
│ $WIMWV → Wind │
│ $GPGGA → Position │
│ $HCHDG → Heading │
│ $SDDBT → Depth │
│ $VWVHW → Speed │
│ $GPRMB → Nav info │
│ !AIVDM → AIS │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Sensor Fusion │
│ & Smoothing │
└──────────────────────┘
```
**Supported NMEA sentences (priority):**
| Sentence | Data | Priority |
|----------|---------------------|----------|
| GGA/GLL | GPS position | P0 |
| RMC | Position + SOG/COG | P0 |
| MWV | Wind angle/speed | P0 |
| HDG/HDM | Heading | P0 |
| DBT/DPT | Depth | P1 |
| VHW | Boat speed/heading | P1 |
| VDM/VDO | AIS messages | P1 |
| XTE | Cross-track error | P2 |
| MTA/MMB | Air temp / pressure | P2 |
| RSA | Rudder angle | P3 |
### 3.8 UI Framework & Visualization
**Rendering stack:**
- **Charts:** MapLibre GL Native (iOS/Android) for GPU-accelerated vector tile rendering.
- **Instruments:** Custom canvas/Skia-rendered gauges (avoid DOM/layout overhead).
- **Weather overlay:** Particle animation (wind flow) + contour fill (pressure) rendered as GL overlay.
- **Performance dials:** Custom circular gauge widgets with polar target arcs.
**Layout modes:**
```
┌─────────────────────────────────────────────┐
│ NAVIGATION MODE │
│ ┌─────────────────────────┬──────────────┐ │
│ │ │ Wind: 15kt │ │
│ │ │ TWA: 45° │ │
│ │ CHART VIEW │ BSP: 6.2kt │ │
│ │ (routes, AIS, tides) │ VMG: 4.4kt │ │
│ │ │ Depth: 12m │ │
│ │ │ COG: 225°T │ │
│ ├─────────────────────────┴──────────────┤ │
│ │ [MOB] [Anchor] [Route] [Weather] │ │
│ └────────────────────────────────────────┘ │
└─────────────────────────────────────────────┘
┌─────────────────────────────────────────────┐
│ INSTRUMENT MODE │
│ ┌───────────┬───────────┬────────────────┐ │
│ │ WIND │ COMPASS │ BOAT SPEED │ │
│ │ ◯ dial │ ◯ rose │ ◯ dial │ │
│ │ AWS TWS │ HDG COG │ BSP SOG │ │
│ ├───────────┼───────────┼────────────────┤ │
│ │ VMG │ DEPTH │ POLAR % │ │
│ │ 4.4 kt │ 12.3 m │ 94% │ │
│ ├───────────┴───────────┴────────────────┤ │
│ │ [MOB] [Anchor] [Route] [Weather] │ │
│ └────────────────────────────────────────┘ │
└─────────────────────────────────────────────┘
```
### 3.9 External API Integration Layer
**Design:** All external data access goes through an integration layer with:
- Retry logic with exponential backoff.
- Response caching with configurable TTL.
- Offline fallback to cached data with staleness indicator.
- Provider abstraction (swap weather sources without touching business logic).
```
┌──────────────────────────────────────────┐
│ API Integration Layer │
├──────────────────────────────────────────┤
│ ┌────────────┐ ┌────────────────────┐ │
│ │ Rate │ │ Cache Manager │ │
│ │ Limiter │ │ (TTL, staleness) │ │
│ └──────┬─────┘ └─────────┬──────────┘ │
│ │ │ │
│ ┌──────┴──────────────────┴──────────┐ │
│ │ Provider Adapters │ │
│ │ ┌──────┐ ┌──────┐ ┌───────────┐ │ │
│ │ │ NOAA │ │Windy │ │OpenWeather│ │ │
│ │ │ │ │ │ │ │ │ │
│ │ └──────┘ └──────┘ └───────────┘ │ │
│ └────────────────────────────────────┘ │
└──────────────────────────────────────────┘
```
---
## 4. Technical Boating Features
### 4.1 Real-time Wind Visualization and Laylines
**Wind field rendering:**
- Animated particle flow showing wind direction and relative speed across the chart.
- Color gradient encodes wind speed (Beaufort scale palette).
- Particle density increases with wind strength.
**Layline computation:**
```
WIND (TWD)
│
│
╱ │ ╲
╱ TWA │ TWA ╲
╱ (opt) │ (opt) ╲
╱ │ ╲
Port layline │ Starboard layline
╲ │ ╱
╲ │ ╱
╲ │ ╱
╲ │ ╱
╲ │ ╱
╲ │ ╱
╲ │ ╱
╲│╱
MARK / WP
```
- Laylines computed from optimal VMG angles at current TWS (from polars).
- Adjusted for current set/drift.
- Displayed as semi-transparent cones on chart overlay.
- Tack/gybe point suggested where layline intersects course to waypoint.
### 4.2 Tide/Current Predictions and Overlays
**Tide height display:**
- Tide curve graph for selected station (24h view with current time marker).
- High/low predictions with times.
- Color-coded depth on chart adjusts for tide height relative to chart datum.
**Tidal current overlay:**
- Animated arrows on chart showing current direction and speed.
- Arrow length/color proportional to current strength.
- Time-scrubbing: user can slide a time bar to see predicted currents at future times.
- Current vectors used in route ETA calculation and weather routing.
**Computation:** Harmonic analysis using on-device tidal constituent databases (NOAA, UKHO). No network required after initial download.
### 4.3 Waypoint and Route Management
**Waypoint properties:**
| Field | Type | Notes |
|----------------|----------|-------------------------------|
| Name | String | User-editable label |
| Position | LatLon | WGS-84 |
| Symbol | Enum | IHO-compatible icon set |
| Arrival radius | Float(m) | Triggers waypoint arrival |
| Notes | Text | Free-form |
| Created | DateTime | Auto-set |
**Route features:**
- Ordered waypoint list with per-leg distance, bearing (true/magnetic), and ETA.
- Drag-to-reorder and drag-to-insert intermediate waypoints.
- Route statistics: total distance, estimated time (at configurable speed or from polars + weather).
- Import/export: GPX, KML.
- Reverse route (one tap).
**Distance/bearing engine:**
- Vincenty inverse formula for accuracy on all distances.
- Rhumb line and great circle options.
- Automatic magnetic variation from WMM (World Magnetic Model) coefficients.
### 4.4 Boat Performance Metrics
**Instrument data flow:**
```
NMEA / GPS sensors
│
▼
┌──────────────┐
│ Raw data │
│ buffer │ ← 1-10 Hz input
└──────┬───────┘
│
▼
┌──────────────┐
│ Damping & │ ← Configurable: 1s, 3s, 10s, 30s
│ smoothing │
└──────┬───────┘
│
▼
┌──────────────┐
│ Derived │ ← True wind, VMG, leeway, current, polar %
│ calculations│
└──────┬───────┘
│
▼
┌──────────────┐
│ UI display │ ← Instruments, chart overlays, alerts
│ + logging │
└──────────────┘
```
**Damping:** Exponential moving average with user-configurable time constant. Racing mode uses shorter damping; cruising mode uses longer for stability.
### 4.5 Polar Performance Diagrams
**Polar diagram display:**
```
0° (head to wind)
│
│ No-sail zone
315°──┼──045°
╱ │ ╲
╱ ┌───┼───┐ ╲
270° │ │ │ 090°
╲ │ │ │ ╱
╲ └───┼───┘ ╱
225°──┼──135°
│
180° (dead downwind)
── Polar curve at current TWS
-- Target BSP at each TWA
• Current boat position on polar
```
**Features:**
- Display polar diagram with target curve for current TWS.
- Interpolate between stored TWS values.
- Show current BSP/TWA as a dot on the polar.
- Highlight optimal VMG angles (upwind and downwind).
- Polar % shown as percentage of target at current TWA.
- Support user-editable polar tables or import from ORC/manufacturer data.
### 4.6 MOB (Man Overboard) Quick Activation
- **Activation:** Single tap on persistent on-screen MOB button (minimum 60×60pt touch target, high-contrast red).
- **Immediate actions:**
1. Record GPS position at moment of activation.
2. Sound continuous alarm.
3. Switch display to MOB navigation view.
4. Start elapsed timer.
5. Log event to logbook.
- **MOB navigation view:**
- Large bearing arrow pointing to MOB position.
- Distance in meters/feet (auto-scales).
- Elapsed time since MOB.
- Current position and MOB position on chart.
- Wind and current conditions at time of event.
- **Recovery:** Explicit "Recovered" confirmation required to exit MOB mode.
### 4.7 Anchor Alarm and Watch Circle
**Configuration:**
- Drop anchor position: auto (GPS at time of set) or manual (tap on chart).
- Watch circle radius: user-configurable (default: calculated from scope × depth + freeboard).
- Alert threshold: distance from anchor position exceeding radius.
**Monitoring:**
- Continuous GPS monitoring at configurable interval (default: 10s, high-accuracy mode: 1s).
- Displays current swing radius on chart as a circle overlay.
- Historical track shows boat movement around anchor.
- Alert escalation: visual → audible → persistent notification (survives app background/screen lock).
**Anchor scope calculator:**
```
Scope = Chain/Rode Out ÷ (Depth + Freeboard)
Input: Depth (from sounder or manual), Freeboard (from boat profile)
Recommended: 5:1 chain, 7:1 mixed rode
Watch circle radius = Rode Out × cos(asin((Depth + Freeboard) / Rode Out))
```
### 4.8 Trip Logging and Electronic Logbook
**Automatic entries (system-generated):**
- Track recording: continuous GPS track at configurable interval (5s – 60s).
- Hourly log: position, SOG, COG, wind, barometer, depth (if available).
- Event log: route activation, waypoint arrival, anchor set/weigh, MOB, alarms.
**Manual entries:**
- Sail changes, engine on/off, weather observations, crew notes.
- Photo attachment (geo-tagged).
**Log format:**
| Time (UTC) | Position | SOG | COG | Wind | Baro | Depth | Event / Notes |
|------------|-----------------|-----|-----|----------|-------|-------|------------------------|
| 08:00 | 41°23.4N 71°12.1W | 6.2 | 225 | 15kt SW | 1018 | 14m | Departed slip |
| 09:00 | 41°18.7N 71°08.3W | 5.8 | 210 | 18kt SW | 1017 | 22m | Full main + jib |
| 09:15 | 41°17.2N 71°07.1W | 6.5 | 195 | 20kt SW | 1016 | 28m | Reef #1 main |
**Export:** CSV, GPX (track), PDF (formatted logbook page).
### 4.9 True/Magnetic Heading Conversion
- World Magnetic Model (WMM) coefficients stored on-device (updated annually).
- Auto-compute magnetic variation for any position and date.
- All headings displayed with user preference: True (°T), Magnetic (°M), or both.
- Compass rose on chart rotates to show magnetic north offset.
- All NMEA headings tagged as magnetic are auto-converted using local variation.
### 4.10 Night Vision Mode
- Single-tap toggle from any screen.
- Color scheme: red-on-black (preserves night adaptation).
- All chart colors remapped to red spectrum.
- Screen brightness reduced (app-controlled dimming below OS minimum).
- Instrument displays switch to red numerals on black background.
- No white flashes from notifications or overlays.
- Chart light symbols (Fl, Iso, Oc, etc.) rendered with visible flash patterns on dark background.
---
## 5. System Architecture
### 5.1 Platform Stack
| Layer | Technology |
|---------------|------------------------------------------------------|
| Mobile UI | Kotlin Multiplatform (Android) + Swift (iOS) |
| Chart engine | MapLibre GL Native (shared C++ core) |
| Local DB | SQLite (via SQLDelight / GRDB) |
| Chart storage | MBTiles (SQLite-backed tile packages) |
| Weather | Custom GRIB2 decoder (Rust/C FFI for performance) |
| Networking | Ktor (KMP) / URLSession (iOS) |
| Background | WorkManager (Android) / BGTaskScheduler (iOS) |
| Web (future) | Kotlin/JS or separate PWA consuming same API layer |
**Rationale:** Native per-platform for performance-critical operations (chart rendering, GRIB decoding, GPS). Shared business logic via Kotlin Multiplatform where feasible.
### 5.2 Backend Services
```
┌──────────────────────────────────────────────┐
│ Cloud Backend │
│ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Auth / User │ │ Sync API │ │
│ │ Service │ │ (routes, logs, prefs)│ │
│ └──────────────┘ └──────────────────────┘ │
│ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Chart Index │ │ Weather Proxy / │ │
│ │ & Download │ │ GRIB Distribution │ │
│ └──────────────┘ └──────────────────────┘ │
│ ┌──────────────────────────────────────┐ │
│ │ Push Notification Service │ │
│ └──────────────────────────────────────┘ │
└──────────────────────────────────────────────┘
```
- **Auth:** OAuth 2.0 / email+password. Optional — app is fully functional without account.
- **Sync API:** REST with JSON delta payloads. Supports offline queue with conflict resolution.
- **Chart index:** Catalog of available chart regions with version metadata. Client downloads tiles directly (CDN-backed).
- **Weather proxy:** Aggregates GRIB data from multiple sources; serves cropped/subsetted GRIB files for requested regions to minimize bandwidth.
- **Push notifications:** Weather alerts, anchor drag (if device loses connectivity, companion device can alert).
### 5.3 Offline-First Data Model
**Principle:** Every core feature works without connectivity. Online access enhances but never gates functionality.
| Feature | Offline capability | Online enhancement |
|----------------------|--------------------------------------------------------|-------------------------------------|
| Chart display | Pre-downloaded chart tiles | On-demand tile streaming |
| Navigation | Full waypoint/route with GPS | — |
| Weather | Last downloaded GRIB (with staleness warning) | Fresh GRIB download |
| Tides | Full harmonic prediction (no network needed) | — |
| Performance | Full (all computation is local) | — |
| Safety (MOB, anchor) | Full (GPS-only) | — |
| Logbook | Full recording; sync queued for later | Real-time cloud backup |
| AIS | Via NMEA hardware receiver | Internet AIS feed |
### 5.4 Hardware Sensor Integration Strategy
**Abstraction layer:** `SensorProvider` interface with implementations for:
1. Device GPS (built-in).
2. Device compass/accelerometer (built-in).
3. NMEA TCP/UDP (WiFi multiplexer — e.g., Yacht Devices, Vesper, Digital Yacht).
4. NMEA Bluetooth (Bluetooth serial adapters).
5. Signal K (JSON-based open marine data protocol over WebSocket).
**Priority / fallback chain:**
```
NMEA instrument data (highest precision)
└─► Signal K server
└─► Device built-in sensors (GPS, compass, barometer)
└─► Manual entry / last known (lowest priority)
```
**Sensor fusion:** When multiple sources provide the same data (e.g., GPS from device + NMEA), use highest-priority source with automatic fallback on signal loss.
### 5.5 Cloud Synchronization Approach
```
Device A (phone) Cloud Device B (tablet)
┌──────────────┐ ┌──────────┐ ┌──────────────┐
│ Local SQLite │──── push ──────►│ Sync API │◄─── push ───│ Local SQLite │
│ │◄─── pull ───────│ │──── pull ───►│ │
└──────────────┘ └──────────┘ └──────────────┘
```
- **Sync granularity:** Per-entity (route, waypoint, log entry, setting).
- **Conflict strategy:** Last-write-wins using monotonic device clocks + server timestamp.
- **Append-only entities:** Logbook entries, track points — no conflicts possible.
- **Queue:** Offline changes queued in local `sync_outbox` table; drained on connectivity.
- **Bandwidth budget:** Sync payloads are JSON deltas — typically < 10 KB per sync cycle.
---
## 6. Data Model Essentials
### 6.1 Key Entities
```
┌─────────────┐ ┌──────────────┐ ┌───────────────┐
│ Route │1────*│ Waypoint │ │ BoatProfile │
├─────────────┤ ├──────────────┤ ├───────────────┤
│ id │ │ id │ │ id │
│ name │ │ route_id(FK) │ │ name │
│ created_at │ │ seq_order │ │ hull_type │
│ updated_at │ │ lat │ │ loa │
│ total_dist │ │ lon │ │ beam │
│ notes │ │ name │ │ draft │
└─────────────┘ │ arrival_rad │ │ displacement │
│ symbol │ │ freeboard │
│ notes │ │ polar_data │
└──────────────┘ └───────────────┘
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ BoatPosition │ │ WeatherData │ │ PerformanceLog │
├──────────────────┤ ├──────────────────┤ ├──────────────────┤
│ id │ │ id │ │ id │
│ timestamp │ │ timestamp │ │ timestamp │
│ lat │ │ lat │ │ position_id(FK) │
│ lon │ │ lon │ │ bsp │
│ sog │ │ tws │ │ vmg │
│ cog │ │ twd │ │ polar_pct │
│ hdg_true │ │ pressure_hpa │ │ heel_deg │
│ hdg_mag │ │ wave_height_m │ │ leeway_deg │
│ depth_m │ │ wave_period_s │ │ current_set │
│ source (enum) │ │ wave_dir │ │ current_drift │
│ fix_quality │ │ temp_c │ │ twa │
└──────────────────┘ │ source (enum) │ │ tws │
│ model_run │ │ aws │
└──────────────────┘ │ awa │
└──────────────────┘
┌──────────────────┐ ┌──────────────────┐
│ LogEntry │ │ AnchorWatch │
├──────────────────┤ ├──────────────────┤
│ id │ │ id │
│ trip_id(FK) │ │ anchor_lat │
│ timestamp │ │ anchor_lon │
│ position_id(FK) │ │ radius_m │
│ type (enum) │ │ set_time │
│ text │ │ depth_at_set │
│ auto_generated │ │ rode_out_m │
│ photo_path │ │ active │
└──────────────────┘ └──────────────────┘
```
### 6.2 Real-time Streaming vs Historical Storage
| Data Class | Real-time Buffer | Historical Storage |
|-------------------|-------------------------------------|-------------------------------------------|
| GPS position | Ring buffer, last 60s at full rate | Downsampled to 5s–60s intervals in SQLite |
| Instrument data | Ring buffer, last 60s | Hourly averages in PerformanceLog |
| Weather grid | In-memory GRIB slice for current t | Full GRIB files on disk (last 3 downloads)|
| AIS targets | In-memory map (MMSI → last report) | Not stored (ephemeral) |
| Tide predictions | Computed on-demand | Harmonic constants are static reference |
### 6.3 Data Freshness and Caching Strategy
| Data | TTL / Freshness Rule | Staleness Indicator |
|--------------------|--------------------------------------------------------|----------------------------------|
| GRIB weather | Valid until model run + forecast hour; stale after | Yellow "outdated" badge on chart |
| Tide harmonics | Valid for calendar year (annual coefficient update) | — |
| Chart tiles | Valid until chart edition update (check weekly) | "Update available" on chart menu |
| AIS positions | Stale after 5 min (class A) / 30 min (class B) | Target fades on chart |
| GPS fix | Stale after 10s (lost fix) | Red "No GPS" warning bar |
| NMEA instruments | Stale after 5s (no data) | Dashes (--) replace values |
---
## 7. External Integrations
### 7.1 Weather APIs
| Provider | Data | Format | Cost Model | Notes |
|----------------|-------------------------|--------|--------------------|---------------------------------|
| NOAA (GFS) | Global wind, pressure | GRIB2 | Free | 0.25° resolution, 6h updates |
| ECMWF (open) | Global wind, pressure | GRIB2 | Free (open data) | 0.1° resolution, 6h updates |
| Windy API | Multi-model access | JSON | Paid (per request) | Good fallback, easy integration|
| OpenWeather | Point forecasts | JSON | Freemium | Useful for simple point lookups|
| NOAA NDBC | Buoy observations | Text | Free | Real-time buoy data |
**Strategy:** Primary: NOAA GFS (free, GRIB2). Secondary: ECMWF open data. Fallback: Windy API for regions with poor GFS coverage.
### 7.2 Chart Data Sources
| Source | Coverage | Format | License |
|---------------------|-----------------|--------------|------------------|
| NOAA ENC | US waters | S-57 | Public domain |
| OpenSeaMap | Global | Vector tiles | ODbL |
| Navionics (license) | Global | Proprietary | Commercial |
| LINZ | New Zealand | S-57 | CC BY 4.0 |
| BSH | Germany | S-57 | Government |
**Strategy:** Ship with NOAA ENC + OpenSeaMap. Offer Navionics integration as premium add-on.
### 7.3 AIS Feeds
- **Hardware:** NMEA-connected AIS receiver (preferred — works offline).
- **Internet:** AIS APIs (MarineTraffic, AISHub) for supplemental coverage when online.
- **Display:** AIS targets rendered on chart with MMSI, vessel name, SOG/COG vector, CPA/TCPA.
### 7.4 GPS / NMEA Protocols
| Protocol | Transport | Use Case |
|--------------|------------------|-------------------------------------------|
| NMEA 0183 | TCP/UDP/serial | Legacy instruments (most common) |
| NMEA 2000 | CAN bus → gateway| Modern instrument buses |
| Signal K | WebSocket (JSON) | Open-source boat data server |
| GPX import | File | Route/waypoint exchange |
---
## 8. UX Principles
### 8.1 Glance-able Critical Information
- **Primary data** (SOG, COG, depth, wind) visible without any interaction.
- **Font sizing:** minimum 24pt for primary values; 18pt for secondary.
- **Color coding:** depth alarm = red, normal = green/white, stale data = yellow.
- **No modals during navigation** — all alerts are non-blocking banners (except MOB).
### 8.2 Minimal Taps While Underway
| Action | Max taps | Notes |
|----------------------------|----------|--------------------------------------|
| View current conditions | 0 | Always visible |
| Activate MOB | 1 | Persistent button |
| Set anchor alarm | 2 | Long-press position → set radius |
| Check next waypoint | 0 | Shown in nav bar |
| Switch day/night mode | 1 | Toggle button |
| View tide at current pos | 1 | Tap tide icon |
| Log a note | 2 | Quick-entry with voice option |
### 8.3 High-Contrast Readability
- **Day mode:** Dark text on light background; chart uses standard ECDIS color scheme.
- **Dusk mode:** Reduced brightness, muted colors.
- **Night mode:** Red on black, no blue/white light sources.
- **Sunlight testing:** All UI elements must pass WCAG AAA contrast ratio (7:1) in day mode.
### 8.4 Touch Optimization for Wet/Gloved Hands
- Minimum touch target: 60×60pt (larger than standard 44pt).
- Generous spacing between interactive elements (minimum 16pt gap).
- No swipe-only gestures for critical functions — always provide tap alternative.
- Support for hardware buttons (volume keys) as configurable shortcuts (e.g., MOB, mark waypoint).
- Edge gestures disabled in navigation mode to prevent accidental OS navigation.
---
## 9. Constraints & Considerations
### 9.1 Bandwidth & Connectivity
| Scenario | Expected bandwidth | Strategy |
|-------------------|--------------------|-----------------------------------------------|
| Harbor WiFi | 1-10 Mbps | Bulk download charts, GRIB, updates |
| Coastal cellular | 100 Kbps – 5 Mbps | Incremental GRIB, sync, AIS feed |
| Offshore (none) | 0 | Full offline; queue sync for later |
| Satellite (Iridium)| 2.4 Kbps | Text-only weather (GRIB subset), position reports|
**GRIB bandwidth optimization:**
- Request only needed parameters (wind, pressure — skip temperature, clouds if not needed).
- Crop to planned route corridor + 200nm buffer.
- Typical offshore GRIB: 200 KB – 2 MB (manageable on satellite with patience).
### 9.2 Battery Life
**Target:** 24+ hours of continuous navigation on a full charge (modern smartphone).
| Optimization | Impact |
|-------------------------------------------|-----------|
| GPS polling rate: 1 Hz normal, 5 Hz race | High |
| Screen brightness: user-controlled dimming| High |
| Chart rendering: cache rendered tiles | Medium |
| GRIB decode: on-demand, not continuous | Medium |
| Network: batch requests, no polling | Medium |
| Background: limit to anchor alarm + track | Low-Med |
**Power modes:**
- **Full:** All features active. ~6-8h screen-on.
- **Economy:** Reduced GPS rate (0.2 Hz), no weather animation, dimmed screen. ~16-24h.
- **Anchor watch:** Screen off, GPS at 0.1 Hz, wake on alarm. ~48-72h.
### 9.3 Screen Visibility
- Support for both OLED and LCD displays.
- Day mode uses maximum contrast; no subtle gradients.
- Night mode: pure black background (#000000) on OLED saves power and reduces glare.
- Anti-glare: avoid white backgrounds that reflect sunlight; prefer dark/medium chart backgrounds.
- User-adjustable brightness independent of OS brightness.
### 9.4 Reliability & Safety-Critical Fail-Safes
- **No single point of failure for position:** Device GPS + optional external GPS.
- **MOB button always accessible:** Rendered above all other UI layers; not dismissible.
- **Anchor alarm survives:** app background, screen lock, low-battery mode, OS memory pressure.
- **Watchdog:** Background process monitors GPS feed; alerts if fix lost for > 30s while underway.
- **Data integrity:** SQLite WAL mode; logbook writes are atomic.
- **Disclaimer:** App is an aid to navigation, not a replacement for proper seamanship, paper charts, and official publications. Displayed prominently at first launch and in About screen.
### 9.5 Data Privacy & Local Storage
- **Default local:** All data stored on device. Cloud sync is opt-in.
- **No telemetry of position data** without explicit consent.
- **Track data:** Stays on device unless user explicitly exports or syncs.
- **Account optional:** App is fully functional without creating an account.
- **Self-host option:** Publish sync server specification so users can run their own.
- **Data export:** Users can export all their data (routes, logs, tracks) at any time in open formats (GPX, CSV, JSON).
---
## 10. Phased Roadmap
### Phase 1 — Foundation (Months 1–4)
| Deliverable | Priority |
|------------------------------------|----------|
| Chart display (NOAA ENC + OpenSeaMap) | P0 |
| GPS navigation (position, SOG, COG) | P0 |
| Waypoint & route management | P0 |
| Basic instrument display | P0 |
| MOB alarm | P0 |
| Anchor alarm | P0 |
| Day/night mode | P1 |
| GPX import/export | P1 |
### Phase 2 — Weather & Tides (Months 5–7)
| Deliverable | Priority |
|--------------------------------------|----------|
| GRIB weather download & display | P0 |
| Wind overlay on chart | P0 |
| Tide predictions (harmonic) | P0 |
| Tidal current overlay | P1 |
| Barometric pressure trend | P1 |
| Offline GRIB storage & staleness | P0 |
### Phase 3 — Performance & Routing (Months 8–10)
| Deliverable | Priority |
|--------------------------------------|----------|
| NMEA 0183 integration (TCP/UDP) | P0 |
| True wind calculation | P0 |
| Polar diagram display | P0 |
| VMG / polar % instruments | P0 |
| Layline rendering | P1 |
| Isochrone weather routing | P1 |
| Signal K integration | P2 |
### Phase 4 — Logbook & Polish (Months 11–13)
| Deliverable | Priority |
|--------------------------------------|----------|
| Trip logbook (auto + manual) | P0 |
| Track recording & playback | P0 |
| Cloud sync (opt-in) | P1 |
| AIS display (hardware + internet) | P1 |
| CPA/TCPA alerts | P1 |
| PDF logbook export | P2 |
| Compass/heading instrument | P0 |
### Phase 5 — Advanced & Optimization (Months 14+)
| Deliverable | Priority |
|--------------------------------------|----------|
| NMEA 2000 via gateway | P1 |
| Navionics chart integration | P2 |
| Satellite weather (Iridium GRIB) | P2 |
| Apple Watch / Wear OS companion | P2 |
| Web dashboard (trip review) | P3 |
| Voice commands for logbook entries | P3 |
| Battery economy mode | P1 |
---
*This document focuses exclusively on sailing/navigation technical features. Social features (crew networking, race communities, marina reviews) are explicitly out of scope.*
|