Building a Laravel Cloud Pricing Calculator with Livewire
April 3, 2025
projectsI got early access to Laravel Cloud and deployed JSONL Tools there. That part was easy enough. What I couldn't quite work out was what it would cost when Cloud launched.
The Laravel team put out a video explaining the pricing, shared by Chris Sev. After watching it, I wanted something I could change the numbers in. So I built a Laravel Cloud pricing calculator.
Apparently my response to being confused about a hosting bill is to build another app.
Turning the pricing into a calculator
There are several things that make up the estimate: the plan, web and worker compute, database, key-value storage, object storage, and usage. Looking at one price doesn't tell you much about the whole application.
I put the pricing data in a configuration file, the calculations in a service, and the inputs in a Livewire component.
That separation is useful for a pretty mundane reason: the prices can change. I want to update the data without digging through the UI or rewriting the arithmetic.
I kept the selected configuration in one Livewire component. Change the compute size, add a worker, or change the database and the estimate updates. You can see the individual charges alongside the total, which is the part I wanted when I was trying to understand my own setup.
Okay, but which configuration do I need?
Once I had the calculator working, I realized I was still confused. I knew what kind of apps I had. I didn't necessarily know which compute and database choices that translated to.
I considered adding presets like “blog” or “SaaS app.” Then I tried a natural language input instead. Describe the app, give the model the available configuration data, and have it suggest a configuration with an explanation.
The initial assistant used GPT-4 Turbo. Its suggestions are applied to the calculator so you can inspect the estimate and change the choices. The pricing service still does the arithmetic using the configuration data.
That gives you a starting point to explore. It doesn't establish how much compute a real workload will need. Traffic, background jobs, storage, and the way the app behaves still matter.
Testing the arithmetic
I used Pest to test the pricing service: compute, databases, storage, allowances, and the other pieces that contribute to the total. The database cost tests, for example, check the compute charge plus the storage charge.
These tests check the calculations against the configured prices. Keeping those prices current is a separate job. For current rates and billing details, use the Laravel Cloud pricing documentation.
I'd like to add saved configurations and recipes so it's easier to compare a few options. For now, you can try the calculator, look through the code, or send feedback.