---
title: 'How I Deployed a Laravel API with Laravel Forge'
source: 'https://youtube.com/watch?v=gel-35Wtw-E'
video_id: 'gel-35Wtw-E'
date: 2026-08-12
duration_sec: 316
---

# How I Deployed a Laravel API with Laravel Forge

> Source: [How I Deployed a Laravel API with Laravel Forge](https://youtube.com/watch?v=gel-35Wtw-E)

## Summary

This video is a 4-minute clip from a longer 24-minute Laravel Daily video demonstrating how to deploy a Laravel API project to a Laravel VPS using Laravel Forge. The goal is to get a live hosted URL with working documentation so the OpenAPI/Postman JSON can be uploaded to RapidAPI. The creator walks through creating a site in Forge, connecting a GitHub repository, tweaking the deployment script and .env file, fixing restricted docs access, and finally submitting the live JSON to RapidAPI.

### Key Points

- **Clip purpose** [00:01] — 4-minute clip from a longer 24-minute video about an API built for a real Upwork job. Demonstrates how Laravel Forge works and how a project is deployed to a Laravel VPS managed inside Forge, so no separate Digital Ocean purchase was needed.
- **RapidAPI requires live URL** [00:28] — To submit an API to RapidAPI you must upload an OpenAPI or Postman collection (JSON or other format) from a live URL, because links in the JSON documentation cannot be tested from localhost.
- **Reusing a server for a new site** [00:58] — The creator reuses an existing Forge server to create a new site, selecting the already-pushed GitHub repository (text cleaner RapidAPI, branch main). No database is needed for this project.
- **Forge domain and site creation** [01:27] — Forge suggests a free demo domain (xxx.on-forge.com), which is fine for a demo project. Composer install is enabled and the site is created; Forge tries to auto-deploy but this can fail the first time (e.g. it tries to migrate a database that isn't needed).
- **First deployment results** [02:07] — Site is ready in roughly a minute. Forge builds front-end assets by default even when not needed. The first auto-deploy failed, so deployment was triggered manually. Deployment completed with errors but the page still loaded showing Laravel 13 successfully deployed.
- **Docs API forbidden** [02:54] — The docs API URL returned 'Forbidden' because the .env file needs changing. In Forge, you edit the .env via Settings > Environment. The restriction comes from 'config scramble' with restricted docs access middleware that lives in /vendor and cannot be edited directly.
- **Commenting out the middleware** [03:23] — Since the vendor middleware can't be edited, the creator comments it out in code, commits the change, and lets Forge pull it. Automatic deployment can be enabled; a deployment script is viewable under Settings > Deployments.
- **Optimizing the deployment script** [03:39] — For this project the script doesn't need 'migrate force', NPM commands, or 'storage link'. Removing these makes deployment faster because NPM is no longer compiled. Save and redeploy to fetch changes from Git with zero downtime.
- **Zero downtime deployment** [04:08] — Recently released in Forge for new servers: redeployment pulls Git changes and deploys with zero downtime. After refresh, the docs page is no longer forbidden and shows live documentation with live URLs.
- **Uploading JSON to RapidAPI** [04:38] — The live docs JSON (API V1.json) is saved and uploaded to RapidAPI Studio by adding an API project with that file, completing the process.

### Conclusion

Laravel Forge makes it simple to quickly deploy a Laravel API to a managed VPS with a live URL, which is essential for submitting the API to RapidAPI. Knowing how to trim the deployment script and .env file removes friction and speeds up zero-downtime deploys.

## Transcript

Forge in action, especially newer version, this will be a 4-minute clip version, this will be a 4-minute clip from my longer video about API from real Upwork job that I posted another clip yesterday on this channel. So, this
24-minute video and in this case, I decided to just demonstrate to you how Laravel Forge works, at least for me, and how I deployed project to a server, which is Laravel VPS, which is inside of Forge. So, I didn't have to buy any
Digital Ocean or anything. So, how does that work? Let me demonstrate. And now, I will try to submit that API to RapidAPI. I'm shooting that the next morning and to add API project, these are the fields and we need to upload
open API or Postman collection with JSON or other format, but from live URL already because the links in the JSON in the documentation cannot be dot test from local. So, for that, I will deploy the project to somewhere and that
somewhere I will demonstrate with Laravel Forge. I have one of the servers just to play around for native PHP demos, but I can use the same server to create a new site. I already have the GitHub repository here with API
uploaded, pushed, and let's create new site, Laravel, and deploy to Laravel Forge. This will be also demonstration of Forge in action. I need to choose the repository and I choose the text cleaner RapidAPI branch main. Connect to
database. We don't need the database for this particular project and it suggests this particular project and it suggests the Forge domain with dot on-forge.com, which I'm happy with it. It's a demo project. I don't really need any real
domain. I will just remove that at the end to be more readable and install composer. Okay, create site. And it will actually try to deploy it automatically, but sometimes it fails the first time because it's still in progress and
sometimes, for example, tries to migrate the database where I don't need the database. So, we'll see what happens. In roughly a minute or so, it should be ready. And it's building front-end assets in this case, but we don't really
need front-end assets, but it comes with Laravel by default. And as I said, Forge was unable to push deploy, but we can click deploy manually and I will show you what actually happens. What's the deployment script? So, you can see
composer install and will it succeed at the end? So, it's running composer install, migrations, nothing to migrate, and there's something with NPM. But actually, it proceeded later and says deployment complete. So, when deployment
complete, it was with errors, but still we can try to visit the page. And yeah, I see Laravel 13 successfully deployed. And what we need here is docs API from what I remember the URL. Forbidden, of course, because we need to
change the dot ENV file. So, let's see how Forge handles that. I will show you. So, settings, then environment, and then you have dot ENV, which you may edit however you want. But actually, let's leave that here as production and I will
leave that here as production and I will probably change the code logic when that docs API is forbidden or not. So, here we have config scramble again, restricted docs access, which is in vendor. So, I cannot edit that
middleware, but I can comment it out. And now, if I commit the deploy to Forge. You can do that automatically, enable the automatic deployment. Actually, see issue and let's dismiss that notification. And
now, we can go to setting deployments and here's the actual deployment script. And in our deployment script, actually, we don't need migrate force because we don't use database. We don't need NPM anything. We don't need storage link
actually because we don't work with storage. Everything else, let's keep it and hit save. And now, we can click deploy again and it will get the changes from Git and deploy it with zero downtime. By the way, deployment
recently in Forge, they released that for new servers. So, your actual users deployment complete. It's faster because it's not compiling the NPM anymore. And
if we refresh the page now, it should be not forbidden anymore. Great. Let me zoom that in so you would see. So, we have live documentation with the live URLs here. Great. So, now let's upload that JSON. We have docs API
dot JSON from what I remember. And this is exactly what we need to put into RapidAPI. So, I will save that as a JSON file, API V1, for example, dot JSON. And
now, I go to RapidAPI studio and add API project. So, yeah, that was a quick think about this process? And in general, are you a user of Forge or have you tried and maybe were disappointed by something? Let's discuss Laravel Forge
as usual in the comments below. And again, the full video, 24 minutes, if you want to watch it for premium members of Laravel Daily. That's it for this of Laravel Daily. That's it for this time and see you guys in other videos.
