> ## Documentation Index
> Fetch the complete documentation index at: https://docs.subtrace.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Porter

> Integrate your app with Subtrace on Porter

If you're using [Porter Cloud](https://cloud.porter.run) to manage your deployments,
you can easily integrate with Subtrace to monitor your app's network requests. Depending
on how you build your app on Porter, the instructions are different.

We'll use a Next.js app as an example, but you can do this with any language and framework.

<Tabs>
  <Tab title="Dockerfile">
    Make the following changes to your app's Dockerfile:

    ```diff theme={null}
    - CMD ["npm", "run", "start"]
    + RUN curl -fsSLO "https://subtrace.dev/download/latest/$(uname -s)/$(uname -m)/subtrace" && chmod +x ./subtrace
    + CMD ["./subtrace", "run", "--", "npm", "run", "start"]

    ```

    Get a `SUBTRACE_TOKEN` from the **Tokens** page on the [dashboard](https://subtrace.dev/dashboard)
    and set it as an environment secret on Porter:

    <img className="rounded-xl" src="https://mintcdn.com/subtrace/HYkx3fsnADiLXD9c/images/porter/secret.png?fit=max&auto=format&n=HYkx3fsnADiLXD9c&q=85&s=b494de023e0d7b88136dcab85d8e450a" width="2400" height="744" data-path="images/porter/secret.png" />

    <Note>Click the lock icon on the right to make it a secret.</Note>

    And then deploy your app as you normally would.

    That's it! You can now visit your app and make some requests to see them automatically appear in the Subtrace
    dashboard.
  </Tab>

  <Tab title="Buildpacks">
    If you're using Buildpacks, the easiest way to integrate Subtrace would be to just change the command
    that's used to start your app on Porter.

    Create a file called `start.sh` in your repo root that downloads Subtrace and starts your app:

    ```bash theme={null}
    #!/usr/bin/env bash
    curl -fSLO "https://subtrace.dev/download/$(uname -s)/$(uname -m)/subtrace" && chmod +x ./subtrace
    ./subtrace run -- npm run start # replace with your app command
    ```

    Change your app's start command on Porter to run this script:

    <img className="rounded-xl" src="https://mintcdn.com/subtrace/HYkx3fsnADiLXD9c/images/porter/start-command.png?fit=max&auto=format&n=HYkx3fsnADiLXD9c&q=85&s=4817be5541907dcc0f3d7d03bc7f1580" width="2340" height="638" data-path="images/porter/start-command.png" />

    Get a `SUBTRACE_TOKEN` from the **Tokens** page on the [dashboard](https://subtrace.dev/dashboard)
    and set it as an environment secret on Porter:

    <img className="rounded-xl" src="https://mintcdn.com/subtrace/HYkx3fsnADiLXD9c/images/porter/secret.png?fit=max&auto=format&n=HYkx3fsnADiLXD9c&q=85&s=b494de023e0d7b88136dcab85d8e450a" width="2400" height="744" data-path="images/porter/secret.png" />

    <Note>Click the lock icon on the right to make it a secret.</Note>

    And then deploy your app as you normally would.

    That's it! You can now visit your app and make some requests to see them automatically appear in the Subtrace
    dashboard.
  </Tab>
</Tabs>
