---
title: 'Deploy'
---

# Deploying the proxy

<Warning>
**USERS!**

Please use the extension instead unless you are familiar with self hosting Docker images!
</Warning>


<Warning>
**Selfhosting the client as well?**

Please read [THIS](./introduction.mdx) and use Method 1 (Docker) or Method 2 (Manual)!

Cloudflare and Netlify's IPs are blocked by most sites and the proxy MUST be hosted on a VPS or other server that is not IP/ASN banned.

</Warning>

## Method 1 - Docker (Recommended)

This is the recommended method for deploying on a VPS or home server. Experience with Docker, domains and web hosting is recommended.

<Warning>
  Experience with Docker, domains and web hosting is **highly recommended** for
  this method. <br />
  You are exposing your server at your own risk!
</Warning>

P-Stream does not have a Docker image for the proxy, but there is a Dockerfile within the repo.

<Steps>
  <Steps.Step>
    Clone the repo on your server:  
    <code>git clone https://github.com/p-stream/simple-proxy</code>
  </Steps.Step>

  <Steps.Step>
    Locate the <code>Dockerfile</code> in the root folder.
  </Steps.Step>

  <Steps.Step>
    Build the Docker image:  
    <code>docker build -t p-stream-proxy ./simple-proxy</code>
  </Steps.Step>

  <Steps.Step>
    (Optional) Create and edit a <code>.env</code> file in the <code>simple-proxy</code> directory to configure secrets such as <code>JWT_SECRET</code> and other environment variables as documented in the configuration guide.
  </Steps.Step>

  <Steps.Step>
    Run the Docker container (replace values as needed):  
    <code>docker run -d --name p-stream-proxy -p 3000:3000 --env-file .env p-stream-proxy</code>
  </Steps.Step>

  <Steps.Step>
    (Optional) Configure your firewall or reverse proxy (such as NGINX or Caddy) to expose port <code>3000</code> or your desired HTTP/HTTPS port.
  </Steps.Step>
</Steps>


The container exposes the HTTP port (Without TLS/SSL) as `3000/TCP`.

## Method 2 - Manual (Advanced)

This method is for advanced users who want full control over their deployment. We recommend using automated package managers like nixpacks for easier deployment.

Manually installing the proxy on your server. You may want to use an automated package manager like nixpacks to do this.

<Steps>
  <Steps.Step>
    Clone the repo on your server `git clone https://github.com/p-stream/simple-proxy`
  </Steps.Step>

  <Steps.Step>
    Navigate to the directory `cd simple-proxy`
  </Steps.Step>

  <Steps.Step>
    Install packages `pnpm i`
  </Steps.Step>

  <Steps.Step>
    Build the app `pnpm build`
  </Steps.Step>

  <Steps.Step>
    Start the proxy `pnpm start`
  </Steps.Step>
</Steps>

You'll need to configure port forwarding and firewall settings. Good luck.

---

# Deprecated Methods

<Warning>
**These methods are DEPRECATED** and should not be used for new deployments. Cloudflare, Netlify, and Railway IPs have been heavily abused and are now blocked by most streaming sites. Use Docker or Manual deployment on a VPS or home server with a residential/private IP instead.
</Warning>

## Method 3 - Cloudflare (DEPRECATED)

Cloudflare has a generous free plan, so you don't need to pay anything unless you get thousands of users.

[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/p-stream/simple-proxy)

<Steps>
  <Steps.Step>
    Create a GitHub account at https://github.com if you don't have one.
  </Steps.Step>

  <Steps.Step>Click the `Deploy with workers` button above.</Steps.Step>

  <Steps.Step>Configure any aditional settings if desired.</Steps.Step>

  <Steps.Step>Click `Deploy` to deploy to Cloudflare Workers.</Steps.Step>

  <Steps.Step>
    Congratulations! Your worker is now deploying. Please wait for the GitHub
    Action to build and publish your worker.
  </Steps.Step>

  <Steps.Step>
    You can click the [`Worker
    dash`](https://dash.cloudflare.com/sign-up?to=/:account/workers-and-pages)
    and `GitHub repo` buttons to see the status of the deploy.
  </Steps.Step>

  <Steps.Step>
    When the worker has deployed, you will need to take note of the URL. This
    can be found on Cloudflare under [Workers and Pages ->
    Overview](https://dash.cloudflare.com/sign-up?to=/:account/workers-and-pages)
    -> Proxy.
  </Steps.Step>

  <Steps.Step>
    Use the URL you took note of and [set up a custom proxy in the
    client](../extra/streaming.mdx#method-1-self-hosted-proxy).
  </Steps.Step>
</Steps>

## Method 4 - Netlify (DEPRECATED)

Netlify has a very generous free plan, so you'll be able to host your proxy for free unless you get hundreds of users.

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/p-stream/simple-proxy)

<Steps>
   <Steps.Step>
     Create a GitHub account at https://github.com/signup if you don't have one already.
   </Steps.Step>

{' '}
<Steps.Step>
  Click on the `Deploy to Netlify` button above. - Authorize Netlify to connect
  with GitHub by clicking the `Connect to GitHub` button.
</Steps.Step>

{' '}
<Steps.Step>There should now be a `Save & Deploy` button, click it.</Steps.Step>

{' '}
<Steps.Step>
  Once the deployment is complete, click on the `Get Started` button that pops
  up, this will redirect you to the dashboard of your site.
</Steps.Step>

{' '}
<Steps.Step>
  Click on the only site in the `Sites` section of your dashboard.
</Steps.Step>

   <Steps.Step>
     Find the link of your site near the top of the page, it should look something like `https://<random-words>.netlify.app`. Right click the link, click `Copy link address`. [Now you'll just have to set up the client](../extra/streaming.mdx#method-1-self-hosted-proxy)!
   </Steps.Step>
</Steps>

## Method 5 - Railway (DEPRECATED)

Railway provides $5 in free credits once you verify your account. These credits expire after 1 month and are usually enough to keep the proxy running for about that time.
(Tip: You can delete your account and create a new one to receive additional credits.)

[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/dyYHq1)

<Steps>
  <Steps.Step>
    Login to your [Railway](https://railway.app) account if you have one, otherwise create one [here](https://railway.app/login).
      - If you are signing up, then verify your account by clicking the link in the email Railway sends you.
      - If you created your account with an email, then to verify your account further, go to your account, then plans and verify your account with a GitHub account.
  </Steps.Step>

{' '}
<Steps.Step>
  Click the [`Deploy on Railway`](https://railway.app/template/dyYHq1) button
  above.
</Steps.Step>

{' '}
<Steps.Step>
  If a `Configure` button is displayed, click on it and allow Railway to access
  your GitHub account.
</Steps.Step>

{' '}
<Steps.Step>
  The `Deploy` button at the bottom of the template should be active, click on
  it.
</Steps.Step>

  <Steps.Step>
    Once the proxy has deployed, copy the URL from the `Deployments` page.
  </Steps.Step>

  <Steps.Step>
    Congratulations! You have deployed the proxy, [you can now set up the client](../extra/streaming.mdx#method-1-self-hosted-proxy).
  </Steps.Step>
</Steps>
