TubeSum

Laravel Forge API Deployment — Step-by-Step Guide & Transcript

How I Deployed a Laravel API with Laravel Forge

0h 05m video Published Apr 21, 2026 Transcribed Aug 12, 2026 L Laravel Daily
Intermediate 3 min read For: Laravel/PHP developers who want to deploy APIs quickly with Laravel Forge and publish them on platforms like RapidAPI.
AI Trust Score 72/100
⚠️ Average / Some Fluff

"Delivers exactly what the title promises — a real, step-by-step Forge deployment demonstration — though it's a short clip padded by a promo for the premium full video."

AI 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.

[00:01]
Clip purpose

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.

[00:28]
RapidAPI requires live URL

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.

[00:58]
Reusing a server for a new site

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.

[01:27]
Forge domain and site creation

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).

[02:07]
First deployment results

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.

[02:54]
Docs API forbidden

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.

[03:23]
Commenting out the middleware

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.

[03:39]
Optimizing the deployment script

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.

[04:08]
Zero downtime deployment

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.

[04:38]
Uploading JSON to RapidAPI

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.

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.

Mentioned in this Video

Tutorial Checklist

1 00:58 In Laravel Forge, create a new site on an existing server and connect your GitHub repository, selecting the appropriate branch.
2 01:27 Skip the database if not needed, accept the suggested .on-forge.com demo domain, enable composer install, and create the site.
3 01:40 If auto-deploy fails, trigger a manual deploy from the Forge dashboard and review the deployment script output (composer install, migrations, NPM).
4 02:54 If the docs/API route is 'Forbidden', edit the .env file via Settings > Environment in Forge to adjust production environment variables.
5 03:23 In your code, comment out the restricted docs access middleware (in config scramble under /vendor) that blocks public documentation, then commit the change.
6 03:39 Under Settings > Deployments, edit the deployment script to remove unnecessary steps (migrate force, NPM, storage link) if your project doesn't need them, then save.
7 04:08 Click Deploy again to pull Git changes with zero downtime, then refresh the live site to confirm the docs are accessible with live URLs.
8 04:38 Save the live docs output as a JSON file (e.g. API V1.json) and upload it to RapidAPI Studio by adding a new API project.

Study Flashcards (8)

Why must an OpenAPI/Postman collection be submitted to RapidAPI from a live URL?

easy Click to reveal answer

Because the links in the JSON documentation cannot be tested from localhost.

00:28

What fields does RapidAPI require when adding an API project?

medium Click to reveal answer

An OpenAPI or Postman collection in JSON or other format, uploaded from a live URL.

00:42

Why can the first auto-deploy in Forge sometimes fail?

medium Click to reveal answer

Because the site is still in progress and Forge may try to run a database migration even when the project doesn't need a database.

01:40

What does the default Forge deployment script run?

medium Click to reveal answer

Composer install, database migrations, and NPM (building front-end assets).

02:23

What caused the docs API route to return 'Forbidden'?

medium Click to reveal answer

The 'config scramble' restricted docs access middleware located in /vendor, which blocks public access to documentation.

03:09

How do you fix restricted middleware that lives in /vendor?

hard Click to reveal answer

You cannot edit the vendor middleware directly, so you comment it out in your code, commit the change, and redeploy via Forge.

03:23

Which steps were removed from the deployment script in this project?

hard Click to reveal answer

Migrate force (no database), NPM commands (no front-end assets), and storage link (no storage usage).

03:39

What benefit did removing the NPM step from the deployment script provide?

easy Click to reveal answer

Deployment became faster because NPM assets were no longer compiled.

04:08

💡 Key Takeaways

💡

Forge includes managed Laravel VPS

Shows that Forge provides its own Laravel VPS, removing the need to buy a separate Digital Ocean droplet for deployment.

00:13
📊

Free demo domain

Forge suggests a free .on-forge.com domain, which is convenient for quick demo and prototype projects without buying a real domain.

01:27
🔧

Vendor middleware blocks docs

Explains a common gotcha where Scramble's restricted docs middleware lives in /vendor and must be commented out in code rather than edited directly.

03:09
🔧

Trimming deployment script speeds deploys

Removing unnecessary migrate, NPM, and storage link steps makes zero-downtime deployments faster and cleaner.

03:39
💡

Zero downtime deployment feature

Highlights a recently released Forge feature for new servers that pulls Git changes and deploys without interrupting active users.

04:08

[00:01] 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

[00:13] 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

[00:28] 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

[00:42] 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

[00:58] 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

[01:12] 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

[01:27] 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

[01:40] 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

[01:55] 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

[02:07] 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

[02:23] 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

[02:38] 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

[02:54] 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

[03:09] 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

[03:23] 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

[03:39] 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

[03:52] 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

[04:08] 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

[04:21] 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

[04:38] 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

[04:51] 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

[05:06] 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.

More from Laravel Daily

View all

⚡ Saved you 0h 05m reading this? Transcribe any YouTube video for free — no signup needed.