How I Deployed Laravel API with Laravel Forge
Chapters10
Explain the plan to use Laravel Forge to deploy a Laravel project and publish API docs without external hosting.
A practical, hands-on look at deploying a Laravel API with Laravel Forge, including a live server setup, auto-deploy tweaks, and publishing OpenAPI docs to RapidAPI.
Summary
Laravel Daily’s video takes you through a real-world deployment workflow using Laravel Forge to host a Laravel API. The host walks through spinning up a Laravel VPS inside Forge, pointing to a GitHub repository, and selecting the main branch to deploy. He demonstrates handling a live OpenAPI/JSON setup for documentation, revealing how Forge can deploy even when front-end assets aren’t needed and how manual deployment still works if auto-deploy hiccups. The video also covers tweaking the deployment script to skip unnecessary steps (no database migrations, npm builds, or storage links) to avoid downtime and speed up rollout. A key moment shows Forge deploying with zero downtime on new servers, a notable improvement for production releases. Finally, the host shows how to update environment variables and how to push changes back to Forge automatically, culminating in a live, accessible API documentation page. If you’re curious about the end-to-end lifecycle from repo to live API docs, this walkthrough makes the process tangible and actionable.
Key Takeaways
- Forge can host a Laravel API on a dedicated Laravel VPS without needing DigitalOcean or similar services.
- Choose the repository and branch (e.g., main) in Forge to trigger automatic deployment to a new or existing site.
- Deployment scripts can be customized to skip migrations, npm, and storage links when you don’t need a database or assets.
- New Forge deployments can achieve zero downtime by deploying without full asset recompilation on every push.
- After deployment, you can update environment variables via the Forge settings panel and deploy changes automatically.
- You can upload live API docs (OpenAPI/JSON) and publish them to RapidAPI by using a live URL rather than a local file.
- Forge’s recent updates emphasize faster deployments and smoother user experience when going live.
Who Is This For?
Laravel developers and DevOps engineers who want a practical, end-to-end guide to deploying an API with Laravel Forge and publishing API docs to RapidAPI.
Notable Quotes
"Hello guys, if you haven't seen Laravel Forge in action, especially newer 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."
—Introduction to the Forge-focused demo and the intent to share a concise example.
"I will deploy the project to somewhere and that somewhere I will demonstrate with Laravel Forge."
—Shows the core plan: deploy to Forge-hosted server as the demonstration target.
"deployment complete is faster because it's not compiling the npm anymore."
—Highlights a key performance benefit of the streamlined Forge deployment.
"Now we can click deploy again. And it will get the changes from git and deploy it with zero downtime."
—Describes the zero-downtime deployment capability when re-deploying.
"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."
—Shows how to tailor the deployment script to a database-free, asset-light API.
Questions This Video Answers
- how do I set up a Laravel API on Forge without a database
- can Laravel Forge deployments be zero downtime
- how to publish an OpenAPI JSON to RapidAPI from a Laravel project
- what parts of a Forge deployment can be safely skipped for API-only apps
- how to update environment variables in Forge after deployment
Laravel ForgeLaravel VPSOpenAPIRapidAPIDeployment scriptsZero downtime deploymentsEnvironment management
Full Transcript
Hello guys, if you haven't seen Laravel Forge in action, especially newer 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 rapid API.
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.est 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 that text cleaner rapid API branch main connect to database. We don't need the database for 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 it 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. There's 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 laral 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 env file. So let's see how Forge handles that. I will show you. So settings then environment and then you have envit. But actually let's 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 change I will also show you how to 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 will not see any downtime. So deployment complete is 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.json from what I remember.
And this is exactly what we need to put into Rapid API. So I will save that as a JSON file. API v1 for example.json JSON and now I go to Rapid API studio and add API project. So yeah, that was a quick demonstration of Forge. What do you 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 time and see you guys in other
More from Laravel Daily
Get daily recaps from
Laravel Daily
AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.









