src/services/deepLinks.ts.
On the web a link is simply the page’s URL, so nothing extra runs there.
What happens when a link arrives
- The link is read: an https link must start with
VITE_APP_LINK_BASE, a scheme link must use the app’s scheme. Anything else is ignored (and logged). - Its path must be on the allow-list in
src/router/linkablePaths.ts. A path that is not listed is ignored, so no page becomes reachable from outside by accident. A bare link (https://app.example.com/,myapp://) only brings the app up. - A link that arrives while the app is still starting (a cold start) is held and opened by the splash screen instead of the usual landing page.
- A page that needs a session sends a signed-out user to sign-in first —
/login?redirect=<page>— and opens the page right after it (through onboarding first when that is still due). The same return works for any protected page, not only links.
Configure
-
Choose the addresses in
env/env.prod: -
List the pages in
src/router/linkablePaths.ts—:namestands for one path segment: -
Mirror the list natively — the OS decides which https links reach the app before the app runs:
- Android —
android/app/src/main/AndroidManifest.xml: theautoVerifyintent filter’sandroid:hostis your link host and itsandroid:path/android:pathPatternentries are your paths (/notes/:id→pathPattern="/notes/.*"); the second intent filter carries your scheme. - iOS —
ios/App/App/App.entitlements:applinks:<your host>;ios/App/App/Info.plist:CFBundleURLTypescarries your scheme. Enable Associated Domains for the App ID in the Apple Developer portal. - Desktop —
src-tauri/tauri.conf.json→plugins.deep-link.desktop.schemes.
- Android —
-
Publish the verification files on the link host — the kit’s web build serves
public/.well-known/at the site root:apple-app-site-association: replaceREPLACE_ME_APPLE_TEAM_IDwith your Team ID and keepcomponentsin step with your paths (/notes/:id→/notes/*). Serve it asapplication/json, without a redirect.assetlinks.json: replaceREPLACE_ME_RELEASE_SIGNING_CERT_SHA256with the SHA-256 of your release signing key (Play Console → App integrity, orkeytool -list -v). Add the debug key’s fingerprint too if you want App Links verified on debug builds.
Links that live under a prefix on another site (
https://example.com/open/myapp/...) work the
same way: the verification files go on that site, the paths in them and in the Android intent
filter carry the prefix, and the site should send a visitor without the app to your web app or
store pages.Share a link from the app
appLink('/notes/42') returns the https link when VITE_APP_LINK_BASE is set, else the scheme link —
use it wherever the app hands out a link to one of its pages.
Desktop
The desktop builds usetauri-plugin-deep-link with tauri-plugin-single-instance: when the OS opens
myapp://… while the app is running, the second launch only brings the running window forward and
hands it the link. macOS registers the scheme from the app bundle, the Windows and Linux installers
register it on install, and a development run registers it at start-up. https links open in the browser
on the desktop — that is how the desktop OSes treat them.
Test it
- Android:
adb shell am start -a android.intent.action.VIEW -d "myapp://notes"; for App Links,adb shell pm verify-app-links --re-verify <package>thenadb shell pm get-app-links <package>. - iOS Simulator:
xcrun simctl openurl booted "myapp://notes". Universal links need a device or a simulator with the associated domain reachable. - Desktop: open
myapp://notesfrom the browser’s address bar oropen myapp://notes(macOS).