Live Firestore Scan Results
V2 Schema Cutover
Legacy V1 collections (/trailSystems, trails, and /waypoints) have been removed from this V2 reference. They remain active in Firestore during the mobile transition window while all V2 vector geometry & POIs live inside atomic systems_v2/{systemId}/{systemId}.geojson.gz bundles paired with /trailSystems_v2.
V2 Database & Storage Relationships
Active V2 production collections and their links to Cloud Storage bundles.
Rider profiles, app preferences, favorites, and admin flags.
Registered vehicles, machines, and ride gear.
System metadata, bounds, ownership, visibility, and rating scale.
Atomic Gzip GeoJSON bundle (tracks + waypoints + topology).
Recorded rider GPX logs linked to ownerId & trailSystem.
| Field Name | Type | Description |
|---|---|---|
| displayName | string | The user's display name. |
| string | The rider's verified email address. | |
| phoneNumber | string | SMS authenticated phone number. |
| createdAt | timestamp | Time when the user registered. |
| isAdmin | boolean | Determines access to administrative dashboard panel. |
| hideTrackingOverlay | boolean | Toggle status for hiding or displaying user's tracking paths. |
| keepScreenOn | boolean | Keeps device display active during active mobile navigation. |
| favoriteTrailSystemIds | array <string> | Set of user-selected favorite trail network document IDs. |
| showLocationDotControl | boolean | Controls display visibility of user GPS tracking marker. |
| uid | string | System unique user ID copy mapping Auth token validation. |
| preferredTrailSystemId | string | Default starting trail system ID chosen by the rider. |
| enableDirectionAlwaysUp | boolean | Direction Facing Always Up — rotates the map to match rider heading while following. |
| showNavPanel | boolean | Show Nav Panel — displays the live telemetry & navigation banner on the map. |
Subcollection: equipment
| Field Name | Type | Description |
|---|---|---|
| name | string | Friendly name for the vehicle or tool (e.g. "Jeep Wrangler"). |
| model | string | Model type/specification details. |
| Field Name | Type | Description |
|---|---|---|
| ownerId | string | User ID of the track owner (links to `/users/{uid}`). |
| displayName | string | Friendly name of the track creator shown in lists. |
| rideDate | timestamp | The date when the ride was recorded. |
| equipmentName | string | Vehicle used on the ride. |
| trailSystem | string | ID of the associated trail system (links to `/trailSystems_v2/{systemId}`). |
| storagePath | string | Path to GPX file located in Cloud Storage (`/tracks/{uid}/...`). |
| isPublic | boolean | Sets whether the track is readable by other signed-in users. |
| fileName | string | Original filename of the imported GPX log file. |
| uploadStatus | string | Processing state of file uploads (e.g. "completed"). |
| localPath | string | Log file location mapping references on mobile recording device. |
| Field Name | Type | Description |
|---|---|---|
| systemId | string | Canonical slug ID matching the document ID (immutable for non-Super-Admins). |
| name | string | Display name of the trail system. |
| state | string | 2-letter US state code (e.g. `"TN"`, `"WV"`) or `"RG"` for regional multi-state networks. |
| accessCategory | string | `"official"` (Super Admin managed, no 3 MB cap) or `"community"` (1 system / 3.0 MB cap; locked on update). |
| accessLevel | string | Visibility enum: `"public"` | `"shared"` | `"private"`. Defaults to `"public"`; owner-only update. |
| isPaid | boolean | Paywall flag (`true` requires signed-in/entitled access; defaults to `false`). |
| ownerId | string | Creator Firebase Auth UID (required on community create, immutable). |
| adminUIDs | array <string> | UIDs authorized to edit trails/bundles (`[creator, superAdmin]` on create; immutable to non-Super-Admins). |
| sharedUIDs | array <string> | View-only invited UIDs when `accessLevel == "shared"` (owner-only update). |
| trailAccess | string | Rider access label (e.g. `"Public"`, `"Gate Fee Required"`, `"Membership Required"`). |
| trailAuthority | string | Managing club, park, or land agency name. |
| baseMapImage | string | Cloud Storage path to raster overlay / base PNG (e.g. `"basepngs/{systemId}-base.png"` or `"basepngs/placeholder.png"`). |
| hasVectorTrails | boolean | `true` for vector trail systems; `false` for raster overlay-only systems (and during initial bootstrap before `.geojson.gz` upload completes). |
| hasOverlay | boolean | `true` if the system includes a georeferenced ground-overlay raster map. |
| vectorStoragePath | string | Cloud Storage path to the gzipped GeoJSON bundle (`"systems_v2/{systemId}/{systemId}.geojson.gz"`). |
| segmentCount | number | Total dissolved trail `LineString` segments in the `.geojson.gz` package. |
| waypointCount | number | Total POI `Point` features bundled inside the `.geojson.gz` package. |
| nodeCount | number | Computed topological junction/endpoint node count. |
| edgeCount | number | Computed topological routing edge count. |
| totalMileage | number | Combined length in miles across all trail segments. |
| initialLatitude | number | Starting trailhead/center latitude for map load. |
| initialLongitude | number | Starting trailhead/center longitude for map load. |
| minLat / maxLat / minLon / maxLon | number | Authoritative geographic bounding box coordinates (4 separate numeric fields). |
| trailRatingScale | array <map> | Difficulty & vector line style tiers (`difficulty`, `colorName`, `colorRGBA`, `lineStyle`, `overlayColorRGBA`, `strokeWidth`, `textColorOverride`). |
| activeTrailIDs / activeWaypointIDs | array <string> | Optional empty arrays (`[]`) written by Overlay Studio V2 for mobile model parity. |
| version | timestamp | Server timestamp bumped on publish; drives client offline cache invalidation. |
| createdAt / updatedAt | timestamp | Server timestamps for initial bootstrap creation and latest metadata/package update. |
Paired Cloud Storage Bundle: systems_v2/{systemId}/{systemId}.geojson.gz
Gzipped GeoJSON `FeatureCollection` containing: (1) trail `LineString` features (`documentID`, `trailNumber`, `trailName`, `colorName`, `colorRGBA`, `direction`, `condition`, `lineStyle`, `overlayColorRGBA`, `strokeWidth`, `textColorOverride`, `lengthMiles`, `trailSystemId`), (2) POI `Point` features (`feature_type: "waypoint"`, `documentID`, `name`, `type`, `description`, `visibilityPriority`, `trailSystemId`), and (3) embedded routing `topology` (`nodes`, `edges`). Community uploads are capped at `3.0 MB`.
| Field Name | Type | Description |
|---|---|---|
| trailSystemId | string | Target trail system ID (links to `/trailSystems_v2/{systemId}`). |
| trailId | string (optional) | Legacy V1 trail document ID (omitted in V2; V2 relies on `location` coordinates and `trailSystemId`). |
| trailName | string | Name of the trail path where issue was reported. |
| trailNumber | string | number | Trail designation / number label (e.g. "12A"). |
| reporterUid | string | User ID of the submitter (must match `auth.uid` on create; immutable). |
| displayName | string (optional) | Public rider display name / handle for recognition (no private PII). |
| issueType | string | Category of issue (e.g. `"washout"`, `"downed_tree"`, `"mud"`, `"closure"`). |
| comment | string | Detailed text notes describing the hazard or issue. |
| location | GeoPoint | Latitude & Longitude coordinate of the issue location (immutable). |
| reportedAt | timestamp | Original timestamp when the issue was first reported. |
| status | string | Resolution status (`"open"` required on create; updatable to `"closed"`). |
| lastConfirmedAt | timestamp (optional) | Timestamp of the most recent rider "Yes (Still there?)" confirmation. |
| lastConfirmedByUid | string (optional) | User ID of the last rider who confirmed the issue is still present (must match `auth.uid`). |
| confirmCount | number (optional) | Confirmation counter incremented (`FieldValue.increment(1)`) each time a rider taps "Yes". |
| resolvedAt | timestamp (optional) | Timestamp set when `status` changes to `"closed"`. |
| resolvedByUid | string (optional) | User ID of the rider or operator who marked the issue `"closed"` (must match `auth.uid`). |
| resolvedByDisplayName | string (optional) | Public display handle (if set) of the rider or operator who closed the issue. |
| Field Name | Type | Description |
|---|---|---|
| name | string | Name of the submitter. |
| string | Email address of the submitter. | |
| type | string | Category (e.g. `"General Feedback"`, `"Feature Suggestion"`, `"Bug Report"`, `"Request TrailTastic Status"`, `"Other"`). |
| message | string | The detailed feedback message content. |
| timestamp | timestamp | Server timestamp when the feedback was submitted. |
| Field Name | Type | Description |
|---|---|---|
| enable_vector_v2 | boolean | Controls whether mobile clients default to `/trailSystems_v2` + `.geojson.gz`. |
| enable_paywall | boolean | Feature flag enabling monetization/paywall gating on mobile. |
| min_supported_build_ios | number | Minimum required iOS `CFBundleVersion` build number. |
| min_supported_build_android | number | Minimum required Android `versionCode` build number. |
| kill_switch_message | string | Optional notice displayed to riders when an emergency flag or force-update triggers. |
Security Rules Flowcharts (firestore.rules & storage.rules)
Decision paths enforced on every V2 Firestore document operation and Cloud Storage bundle/image request.
1. firestore.rules — /trailSystems_v2/{systemId} & Subcollections
allow list: if true (client UI filters private/shared)get & /{subcollection}/{docId}
isSuperAdmin() or resource == null?request.auth != null)?• accessLevel != 'private' (public/shared) → ALLOW
• 'private' → ALLOW only if ownerId or in adminUIDs
• accessLevel omitted or 'public' AND isPaid != true → ALLOW
• Otherwise → DENY
/trailSystems_v2/{systemId}
isSuperAdmin()?ownerId == auth.uidaccessCategory == 'community'accessLevel in ['public', 'shared', 'private']adminUIDs is exact 2-item list [auth.uid, superAdmin]systemId (if set) == doc ID & sharedUIDs is list/trailSystems_v2/{systemId}
isSuperAdmin()? → ALLOW, else ↓ownerId OR in adminUIDsownerId, systemId, adminUIDsaccessCategory locked (no switching community → official)accessLevel or sharedUIDs → ownerId onlyaccessLevel & sharedUIDscreate/update/delete allows Super Admin, ownerId, or adminUIDs./trailSystems_v2/{systemId}
isSuperAdmin()?ownerId == auth.uid (admins cannot delete)accessCategory != 'official''community' (or missing category) OR accessLevel == 'private'.geojson.gz before deleting this Firestore doc, because storage.rules reads this doc to authorize deletion.
2. storage.rules — Cross-Service Checks via Firestore /trailSystems_v2/{systemId}
Applies to systems_v2/ & basepngs/systems_v2/{systemId}/{allPaths=**}
accessLevel != 'private' OR owner/admin)public + isPaid != trueownerId / adminUIDsownerId when accessCategory != 'official' (must run while Firestore doc still exists)basepngs/{fileName}
{systemId}.geojson.gz or trails.geojson.gz, gzip contentType, Firestore doc exists, and official OR size <= 3 MBtrue); Write = Super Admin OR signed-in image/* <= 15 MB (non-placeholder); Delete = Super Admin only.3. Role-Based Access & Sharing Flow — 6 Personas (Current Live vs. Planned)
Super Admin, ownerId, adminUIDs, sharedUIDs, Authenticated, and Non-Authenticated users resolve across V2 systems./trailSystems_v2/{systemId} or systems_v2/{systemId}/...
public + free (isPaid != true).shared, private, isPaid == true, and all writes.allow list: if true returns directory docs (UI hides private/shared); PLANNED scoped public query lets rules lock list too.uid == xBKs52...Wq1) → Full read, edit, share, & delete on every system (official + community, no 3 MB cap).
uid == ownerId) → See/edit/upload bundle for own public/shared/private, manage accessLevel & sharedUIDs, delete non-official system.
uid in adminUIDs) → See & edit trails/metadata/bundles on public/shared/private. Cannot change visibility/sharing or delete system.
uid in sharedUIDs) → See & download public and shared systems (view-only). Blocked from private and all edits/deletes.
public systems (paywall in UI if isPaid); blocked from private. See shared difference below ↓
uid == xBKs52...Wq1
basepngs/)uid == doc.ownerId
accessLevel & sharedUIDs (adminUIDs locked)adminUIDs)uid in doc.adminUIDs
shared & private:
adminUIDsadminUIDsuid in doc.sharedUIDs
shared Access:
isPaid)sharedUIDsauth != null (other)
shared Behavior:
get by systemId ("Join via Slug")get unless uid in sharedUIDs (or redeemed via invite token)public subject to isPaid)request.auth == null
public AND isPaid != true (isPaid == true is blocked at Rules)list):
allow list: if true (UI hides shared & private)public query lets list rules block shared/private tooallow list: if true returns all docs; Web/iOS/Android filter out private & shared in client UI.sharedUIDs is only checked in client UIs. Firestore get & Storage get still let any signed-in user fetch a shared system if they know its systemId.adminUIDs for shared/private, while iOS & Android directory filters currently check only ownerId & sharedUIDs.sharedUIDs or promote co-admins into adminUIDs.accessLevel = 'shared' and invites riders (by email/handle or share link) as Viewer (sharedUIDs) or Co-Admin (adminUIDs via Cloud Function).shared: Tighten canSignedInReadV2System & Storage canSignedInGetV2System so shared requires ownerId, adminUIDs, or uid in sharedUIDs (blocking uninvited slug guessing)..get() with scoped queries (public + ownerId + adminUIDs + sharedUIDs) on iOS, Android, & Web so allow list can also lock down private/shared.adminUIDs check to iOS & Android filters so assigned admins see & edit shared/private parks on all platforms.| Path | Read Access | Write / Delete Access |
|---|---|---|
| /users/{uid} (+ equipment) | Owner (auth.uid == uid) or Super Admin |
Owner (auth.uid == uid) only |
| /tracks/{trackId} & Storage /tracks/{uid} | Firestore: isPublic, owner, or Super Admin; Storage: any signed-in user |
Owner (ownerId == auth.uid) only |
| /trailIssues/{issueId} | Public (true) |
Create: signed-in (reporterUid == uid, status == 'open'); Update: signed-in status updates (core fields immutable) |
| /feedback & /testers | Denied (false) — write-only |
Create: public (true); Update/Delete: denied (false) |
| /app_config/{docId} | Public (true) |
Super Admin only |
| /tracksVideo/{trackId} | Public (true) |
Any signed-in user |
Planned Features & Schema Roadmap
Experimental structures, feature brainstorms, and work-in-progress collections reserved for future releases.
tracksVideo In Development
/tracksVideo/{id}Designed to link video assets, offset markers, and multi-segment playback configs to ride tracks for video map synchronization features.
subscriptions Future Brainstorm
/users/{uid}/subscriptions/{systemId}Proposed user subcollection for managing paid trail system subscriptions, start/end validity dates, auto-renew status, and offline trailhead access tokens.