Deep Links and Universal Links with Expo Router
A shared product link should open the right screen, whether a customer taps it in a message, a browser, or another app. Expo Router makes the routing part straightforward: files become routes, and those routes can be reached through URLs. Getting the operating system to deliver an HTTPS link to your app still requires platform configuration.
This guide builds a small /products/[id] route, then connects it to custom-scheme links and verified web links.
Start with a route
Assume a project using Expo Router has this structure:
src/app/
_layout.tsx
index.tsx
products/
[id].tsx
Create src/app/products/[id].tsx:
import { useLocalSearchParams } from 'expo-router';
import { Text, View } from 'react-native';
export default function ProductScreen() {
const { id } = useLocalSearchParams<{ id: string }>();
return (
<View style={{ flex: 1, padding: 24 }}>
<Text>Product: {id}</Text>
</View>
);
}
The route /products/42 is now understood by Expo Router. You can navigate to it inside the app using Link:
import { Link } from 'expo-router';
export function ProductLink() {
return <Link href="/products/42">View product</Link>;
}
This is different from configuring the operating system to open an installed app from an external link.
1. Configure a custom URL scheme
In app.json, give the application a unique scheme and platform identifiers:
{
"expo": {
"scheme": "shopdemo",
"ios": {
"bundleIdentifier": "dev.example.shopdemo"
},
"android": {
"package": "dev.example.shopdemo"
}
}
}
Replace the example bundle and package identifiers with your own values. Rebuild the native development app after changing native linking configuration.
With the app installed, try opening:
shopdemo://products/42
Expo Router maps the URL path to the file-backed route. A custom scheme is useful for development and app-to-app integrations, but it is not verified ownership: another application may register the same scheme.
2. Add iOS Universal Links
Universal Links use a normal HTTPS URL, such as https://links.example.com/products/42. They require both an entitlement in the app and a domain association file hosted by the website.
Merge the associated domain into your existing app.json, retaining the scheme and bundle identifier:
{
"expo": {
"ios": {
"associatedDomains": ["applinks:links.example.com"]
}
}
}
Serve an Apple App Site Association (AASA) file from:
https://links.example.com/.well-known/apple-app-site-association
A minimal illustrative file is:
{
"applinks": {
"details": [
{
"appID": "TEAMID1234.dev.example.shopdemo",
"paths": ["/products/*"]
}
]
}
}
Use your actual Apple Team ID and bundle identifier. Serve the JSON over HTTPS without a redirect. Apple also supports a newer components format; choose the format that matches your path-matching needs.
Once Apple verifies the association, eligible links can open the installed app. Test by tapping a link from a message or note on a physical device; manually typing the address into Safari is not a reliable Universal Link test.
3. Add Android App Links
Android App Links also use HTTPS, but verify domain ownership through Digital Asset Links.
Merge an intent filter for your domain into the existing Android configuration, retaining the package identifier:
{
"expo": {
"android": {
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "links.example.com",
"pathPrefix": "/products"
}
],
"category": ["BROWSABLE", "DEFAULT"]
}
]
}
}
}
Host this verification file:
https://links.example.com/.well-known/assetlinks.json
Example (replace the placeholder package and fingerprint):
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "dev.example.shopdemo",
"sha256_cert_fingerprints": [
"AA:BB:CC:DD:REPLACE_WITH_YOUR_SIGNING_CERTIFICATE_SHA256"
]
}
}
]
The fingerprint must be the SHA-256 fingerprint of the certificate that signs the installed build. Development, local release, and Google Play App Signing certificates may differ. Use the appropriate fingerprint for each distribution path.
4. Handle unavailable content safely
An incoming URL is untrusted input. It might reference a removed product or contain an invalid ID. Validate the parameter, fetch the actual product, and render a missing-item state instead of assuming every deep link is valid.
If the link points to protected content, authenticate the user first and then return them to the requested route. Do not place access tokens or other secrets in the URL.
5. Test the complete journey
A useful checklist for both platforms:
- Open
shopdemo://products/42on a device with your development build installed. - Open
https://links.example.com/products/42by tapping it outside the browser address bar. - Confirm the URL opens the intended screen on cold launch and when the app is already running.
- Test an invalid product ID, a signed-out user, and the case where the app is not installed.
- Verify domain-association files are publicly reachable, correct, and delivered over HTTPS.
Important: Expo Go has limitations for incoming-link testing. Prefer a development build for verification of native link associations.
Takeaway
Expo Router handles URL-to-screen routing. iOS Universal Links and Android App Links add the OS-level trust needed for verified HTTPS links. Treat these as separate layers, and test both with real installed builds.