Skip to content
RicoCTYPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

OpenTrace

OpenTrace

Hong Kong, one step at a time.
A map, an AI planner, and a community of walking routes.

iOS 18+ Swift 6 SwiftUI Supabase MapKit DeepSeek

OpenTrace is an iOS app for getting around Hong Kong. Home is a community feed of routes people publish. The map shows nearby toilets, seating, air-conditioned places, and restaurants. AI plans a walk from a short request, including clarifying questions when the request is open. Saved places, chat history, and a personal footprint stay with the account.

Tech stack

Layer Choice
App Swift 6, SwiftUI, iOS 18
Maps and location MapKit and Core Location
On-device data GRDB 7 and a bundled SQLite place catalog
Accounts and sync Supabase Auth, Postgres, Storage, and Edge Functions
AI DeepSeek on the device, from a curated list of Hong Kong places
Voice Speech and AVFoundation
Weather and transit Hong Kong Observatory, MTR, KMB, and Citybus open data (DATA.GOV.HK)
Offline bundle Python 3.12, uv, Shapely, and PyYAML

Requirements

  • macOS with a current Xcode that can build for iOS 18
  • An iOS 18 or later simulator, or an iPhone
  • A Supabase project with this repository’s migrations applied
  • A DeepSeek API key, for AI routes and community drafts

Run the app

Clone the repository and open the Xcode project:

git clone https://github.com/RicoCTY/walktogether.git
cd walktogether
open OpenTrace.xcodeproj

Create the local secrets file, then fill in the values from the next section:

cp Config/Secrets.xcconfig.example Config/Secrets.xcconfig

In Xcode, select the OpenTrace scheme and an iPhone simulator, then press Run.

Config/Secrets.xcconfig is gitignored. A clone without that file still builds. Sign-in and AI stay unavailable until the file contains real keys, and Xcode must be restarted or the build folder cleaned after you add them. xcconfig values are baked into Info.plist at build time.

Configuration

The iOS app does not read a .env file. Debug, Staging, and Release each include Config/Secrets.xcconfig when it exists, and those values are copied into the app bundle.

xcconfig treats // as a comment. Write URL slashes as /$()/:

SUPABASE_URL = https:/$()/YOUR_PROJECT.supabase.co
SUPABASE_PUBLISHABLE_KEY = sb_publishable_YOUR_KEY
LINK_DOMAIN = links.yourdomain.com
DEEPSEEK_API_KEY = YOUR_DEEPSEEK_KEY
DEEPSEEK_MODEL = deepseek-flash
Key Required to Where to get it
SUPABASE_URL Sign in, sync, and the community feed Supabase → Project Settings → Data API
SUPABASE_PUBLISHABLE_KEY Same as the URL. This is the publishable or anon key, never the service-role key Supabase → Project Settings → API Keys
DEEPSEEK_API_KEY Plan a route and draft a community post DeepSeek dashboard
DEEPSEEK_MODEL Choose the model. deepseek-flash is the default Optional
LINK_DOMAIN Universal links. opentrace.example is enough for local development Optional

For a local Supabase stack the URL is:

SUPABASE_URL = http:/$()/127.0.0.1:54321

Use the anon key printed by supabase status.

Empty or placeholder values are detected at launch. The app opens on the sign-in screen, and sign-in reports that it cannot reach the server. AI replies are skipped when DEEPSEEK_API_KEY is missing. Do not commit this file, and do not put a service-role key or an Apple private key in it.

Sign in

Create an account from the first screen. Passwords must be at least 8 characters. If the Supabase project requires email confirmation, the app asks for the 6-digit code. On a local stack that mail is in Inbucket.

Tests

Parser tests run from the Swift package:

cd Packages/OpenTraceKit
xcodebuild test \
  -scheme OpenTraceKit \
  -destination 'platform=iOS Simulator,name=iPhone 16'

Use any installed iPhone simulator name if iPhone 16 is not available.

Project layout

OpenTrace/                  App target, assets, and entry point
Packages/OpenTraceKit/      SwiftUI features, map, transit, and local database
Config/                     xcconfig, Info.plist, and entitlements
supabase/                   Postgres migrations, seed data, and Edge Functions
data/                       Curated places, transit, and amenity inputs
data-pipeline/              Jobs that rebuild the offline SQLite bundle
docs/                       Privacy copy, attributions, and operator runbooks

Local backend

The hosted project is enough to run the app. Use the Supabase CLI when you need to change the database or the Edge Functions.

supabase start
supabase db reset

supabase db reset applies supabase/migrations and supabase/seed.sql. Studio is at http://127.0.0.1:54323.

Edge Functions read their own environment from the Supabase CLI, not from Secrets.xcconfig. supabase/.env is gitignored. Set secrets with the CLI and never commit them:

supabase secrets set \
  APPLE_TEAM_ID=... \
  APPLE_KEY_ID=... \
  APPLE_CLIENT_ID=io.github.ricocty.opentrace \
  APPLE_PRIVATE_KEY="$(cat AuthKey_XXX.p8)"

SUPABASE_URL, SUPABASE_ANON_KEY, and SUPABASE_SERVICE_ROLE_KEY are injected by Supabase for deployed functions. See docs/runbooks/backend.md and docs/runbooks/secrets.md for staging, production, and key rotation.

Offline data

The app already contains a built place bundle. Rebuild it only after the curated inputs change:

cd data-pipeline
uv sync --extra dev
uv run python bundle/build_offline_db.py

The full import order and data credits are in docs/runbooks/data-pipeline.md and docs/compliance/attributions.md.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages