strait init: set up deep links from the terminal

After this page, your React Native, Expo, Flutter or Android app will have a file that starts Strait and receives every link, and you will have a numbered list of the few steps left.

  • Task
  • ~ 5 minutes
  • Android
  • iPhone
On this page 9
  1. 1. Get your key and link address
  2. 2. Look before you write
  3. 3. Write the file
  4. 4. Do the printed steps
  5. Options
  6. Check your setup: strait doctor
  7. Create links from the terminal: strait links
  8. Common errors
  9. Next steps
Time
About 5 minutes
You need
A React Native, Expo, Flutter or Kotlin Android app, Node.js 18.17 or newer, and your publishable key from Dashboard → Get started
Works on
React Native, Expo, Flutter and Android. iPhone steps are printed for you to do in Xcode

strait init is a command-line tool, @straitlink/cli on npm (0.2.1, published 3 November 2026). It looks at your app's files, writes one setup file with your key and link address filled in, and prints the rest of the setup as a checklist. It never edits a file you already have.

Four steps. Each one says what to do and what you should see.

Do this: open Dashboard → Get started. Copy two things: your publishable key (starts with st_pub_live_…) and your link address (like hilltop.strait.link).

You should see: both on that page. Use the publishable key, never a secret key: the tool refuses a secret key, because it would end up inside your app.

2. Look before you write

Do this: open a terminal in your app's folder (the one with package.json or pubspec.yaml) and paste this. Put in your key and address.

Terminal
npx @straitlink/cli init --key st_pub_live_… --host hilltop.strait.link --dry-run

--dry-run means "show me, change nothing".

You should see: Found: React Native (or Expo, Flutter or Android), the file it would create with your key in it, and a numbered list under Next steps:. Nothing in your folder has changed. If the scheme line says it was guessed and it isn't the one in Apps & stores, run it again with --scheme yourscheme.

3. Write the file

Do this: run the same command without --dry-run:

Terminal
npx @straitlink/cli init --key st_pub_live_… --host hilltop.strait.link
Your app The file it writes
React Native links.ts (or links.js)
Expo links.ts, plus app/+native-intent.tsx if you use Expo Router
Flutter lib/links.dart
Android (Kotlin) app/src/main/java/<your package>/StraitLinks.kt

You should see: the new file in your folder. It creates the Strait client and has one onLink handler where every link arrives.

4. Do the printed steps

Do this: follow the Next steps: list from top to bottom. It has your exact install command, the Android intent filters with your scheme (or the app.json block for Expo), the iPhone Associated Domains entry, what to fill in on the dashboard, and two curl checks for your verification files. Steps your project already has are marked [already done].

You should see: after the last step, a line starting Strait link: in your app's log when you open the test link the list gives you.

Options

Option What it does
--key Your publishable key. Or set STRAIT_PUBLISHABLE_KEY
--host Your link address, like hilltop.strait.link. A pasted link works too. Or set STRAIT_LINK_HOST
--scheme Your app's own scheme, the one you typed in Apps & stores, like hilltopshop. If you leave it out it's guessed, and the output says so
--framework react-native, expo, flutter or android, to skip detection
--dry-run Show the files and steps; write nothing
--force Replace a setup file an earlier run made
--yes Never ask a question; stop with exit code 2 if something is missing (for CI and AI agents)

Run it with no flags in a terminal and it asks for the key and address instead. Exit codes: 0 done, 2 something to fix (the message says what), 1 an unexpected error.

Check your setup: strait doctor

strait doctor runs the same checks as doctor() in the Strait SDKs, with the same messages, from your terminal. It reads the two verification files on your link address and tells you whether your app is listed.

Do this: put in your link address and your app's package (Android) and bundle ID (iPhone):

Terminal
npx @straitlink/cli doctor --host hilltop.strait.link --android com.hilltop.shop --ios com.hilltop.shop

You should see: ok app.listed under Android and under iPhone, and All checks passed. If a line says error, the Fix: under it says what to change in Apps & stores. Add --cert with your signing certificate's SHA-256 to check it too (debug, release and Play App Signing each have their own). --json prints the result for CI. The exit code is 1 when a check fails.

These use a secret key (Dashboard → Settings → Secret keys), never the publishable key. Put it in the environment so it stays out of your shell history; the tool never prints it.

Terminal
export STRAIT_SECRET_KEY=st_live_…
npx @straitlink/cli links create summer https://hilltop.example/summer --campaign sale
npx @straitlink/cli links list --limit 20
npx @straitlink/cli links qr summer --size 512

You should see: Created https://hilltop.strait.link/summer, then your links one per line, then Saved the QR code for summer to …/summer.png. A QR file is never replaced unless you add --force; --format svg saves an SVG.

Common errors

  • Missing --key and --host. You ran it with --yes or outside a terminal. Pass both flags as in step 2.
  • Not overwriting links.ts (or another file). An earlier run made it. Keep it, or add --force to write it again.
  • … is the example key from the docs. You pasted the placeholder. Copy your key from Dashboard → Get started (the Publishable key box).

Next steps