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

# 5. Deployment

> Deploy your backend to the Railway.

<Steps>
  <Step>
    First, you need to create a new project on Railway.

    <Card title="Create an account on Railway" href="https://railway.com?referralCode=tt_weP" icon="rocket">
      Click to navigate to Railway and create a new account.
    </Card>
  </Step>

  <Step>
    Authorize Railway to access your GitHub repository.
  </Step>

  <Step>
    Click the "New" button.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/1.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=471b9d2d92195e23e628f6f0e409c1f2" alt="Firebase" className="w-full" width="226" height="120" data-path="images/aiwrapper/deployment/1.png" />
    </Frame>
  </Step>

  <Step>
    Click the "Deploy from Github Repo" button.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/2.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=96966b79a973088d2be4371b3e328956" alt="Firebase" className="w-full" width="1362" height="1492" data-path="images/aiwrapper/deployment/2.png" />
    </Frame>
  </Step>

  <Step>
    Pick the repository you want to deploy.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/3.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=07363e689a71d09435bf8f55beb8a924" alt="Firebase" className="w-full" width="800" height="769" data-path="images/aiwrapper/deployment/3.png" />
    </Frame>
  </Step>

  <Step>
    After you pick the repository, you need to abort the deployment.

    Because we need to import our `.env` variables into the Railway project.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/4.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=0f754e6a3e3a6353edecfb67bdd86619" alt="Firebase" className="w-full" width="1372" height="742" data-path="images/aiwrapper/deployment/4.png" />
    </Frame>
  </Step>

  <Step>
    Now, click the Variables section and then click the "Raw Editor" button.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/5.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=951c0aec6e5bbbf5246fbd3a49c9aca6" alt="Firebase" className="w-full" width="895" height="652" data-path="images/aiwrapper/deployment/5.png" />
    </Frame>
  </Step>

  <Step>
    Copy the `.env` variables from the `[your-app-name]-backend/.env.production` file and paste it into the Railway project.

    Then click Update Variables.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/6.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=026018337e689a629e58fe5b8856be38" alt="Firebase" className="w-full" width="773" height="703" data-path="images/aiwrapper/deployment/6.png" />
    </Frame>
  </Step>

  <Step>
    As you can see, the variables are imported successfully. But not done yet.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/7.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=4bdc38fb87efc17213ef649820d8f582" alt="Firebase" className="w-full" width="945" height="930" data-path="images/aiwrapper/deployment/7.png" />
    </Frame>
  </Step>

  <Step>
    Now click the "New Variable" button.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/8.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=706c4ab6e3167ba9b4e4354f4f17121d" alt="Firebase" className="w-full" width="864" height="269" data-path="images/aiwrapper/deployment/8.png" />
    </Frame>
  </Step>

  <Step>
    Name should be `FIREBASE_SERVICE_ACCOUNT` and the value should be the content of the `[your-app-name]-backend/firebase-service-account.json` file.

    Click the Add button.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/9.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=d26480fc788f1c3d79cd698bde0d75c9" alt="Firebase" className="w-full" width="848" height="495" data-path="images/aiwrapper/deployment/9.png" />
    </Frame>
  </Step>

  <Step>
    Now, we are ready to deploy the backend.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/10.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=1d019c48d17271d005369b68ae4d9fc1" alt="Firebase" className="w-full" width="511" height="106" data-path="images/aiwrapper/deployment/10.png" />
    </Frame>
  </Step>

  <Step>
    After successfully deploying the backend, go to the settings section and click the "Generate Domain" button.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/11.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=f1537c8021d3af13afb311fe36d11407" alt="Firebase" className="w-full" width="861" height="734" data-path="images/aiwrapper/deployment/11.png" />
    </Frame>
  </Step>

  <Step>
    After generating the domain, you can add it to the Expo environment variables. (Especially for the .env.production file)

    <Info>
      You can run it with ngrok or localhost on dev mode.
    </Info>

    Copy the domain and paste it into the `.env.production` file.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/12.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=b4b392a454b3799f526223b6611a88ab" alt="Firebase" className="w-full" width="594" height="174" data-path="images/aiwrapper/deployment/12.png" />
    </Frame>
  </Step>

  <Step>
    When you want to publish your app, it is okey to go with that.

    But in development, you don't need to deploy the backend.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/13.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=c6b9ef68f04ac14d7a261956835edbaf" alt="Firebase" className="w-full" width="772" height="277" data-path="images/aiwrapper/deployment/13.png" />
    </Frame>
  </Step>

  <Step>
    Open Expo App and try something. (I have all API keys so I can try everything)

    As you can see, our request is successfully sent to the backend.

    <Frame>
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/14.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=a1e379793cd6f83cb29d0c63a7f4d19f" alt="Firebase" className="w-full" width="595" height="419" data-path="images/aiwrapper/deployment/14.png" />
    </Frame>
  </Step>

  <Step>
    Some of the results are shown below.

    <Frame className="flex flex-row w-full h-full gap-2">
      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/15.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=40539dcc8599cec5fcf11c4d5498b0cb" alt="Firebase" className="rounded-lg" width="1179" height="2556" data-path="images/aiwrapper/deployment/15.png" />

      <img src="https://mintcdn.com/shipmobilefast-51a499dc/4ztR-scAO2Zjz6Y6/images/aiwrapper/deployment/16.png?fit=max&auto=format&n=4ztR-scAO2Zjz6Y6&q=85&s=92384d1ff5981151d34ed01ff40bd17c" alt="Firebase" className="rounded-lg" width="1179" height="2556" data-path="images/aiwrapper/deployment/16.png" />
    </Frame>
  </Step>
</Steps>
