How to Monitor Inertia.js with Vigilmon
Inertia.js gives you the routing and state management of a single-page app while keeping your backend framework doing what it does best. No API layer, no serialization boilerplate — just server-side controllers returning Inertia responses that render as Vue, React, or Svelte components.
When it works, it's a productivity dream. When it breaks, diagnosing failures is trickier than with a pure API because the frontend and backend are tightly coupled. This tutorial shows you how to monitor an Inertia.js app so you catch failures fast and debug them faster.
What can go wrong in an Inertia.js app
Inertia's monolith architecture means failures tend to be backend failures that present as frontend symptoms:
- Server down — users see a blank page or connection refused
- 500 from a controller — Inertia renders the error but the component doesn't load
- Session issues — auth redirects loop, CSRF mismatches cause form failures
- Asset version mismatch — after a deploy, Inertia forces a full page reload; stale assets cause React/Vue errors in the console
- Database slow — controller response times spike, page loads feel sluggish
The asset version mismatch is subtle and often missed by teams new to Inertia. Vigilmon's response time tracking will show you this as a latency spike immediately after deploys.
Step 1: Add a health check endpoint (Laravel example)
This tutorial uses Laravel, but the same approach applies to Rails or any other Inertia backend.
composer require spatie/laravel-health
php artisan vendor:publish --tag="health-config"
Register checks:
// app/Providers/AppServiceProvider.php
use Spatie\Health\Checks\Checks\DatabaseCheck;
use Spatie\Health\Checks\Checks\CacheCheck;
use Spatie\Health\Facades\Health;
public function boot(): void
{
Health::checks([
DatabaseCheck::new(),
CacheCheck::new(),
]);
}
Register the route — note: use a plain JSON route, not an Inertia response, so monitoring tools can parse it without running JavaScript:
// routes/web.php
use Spatie\Health\Http\Controllers\HealthCheckResultsController;
Route::get('/health', HealthCheckResultsController::class);
Test:
curl -H "Accept: application/json" http://localhost:8000/health
Step 2: Add an Inertia-specific health check
Inertia requires session support and the X-Inertia header protocol. Add a lightweight check that verifies the Inertia layer is functioning:
// app/Http/Controllers/InertiaHealthController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class InertiaHealthController extends Controller
{
public function __invoke(Request $request)
{
$checks = [];
// Session writable
try {
$request->session()->put('_health_check', now()->timestamp);
$val = $request->session()->get('_health_check');
$request->session()->forget('_health_check');
$checks['session'] = is_numeric($val) ? 'ok' : 'mismatch';
} catch (\Exception $e) {
$checks['session'] = 'error';
}
// Database readable
try {
\DB::select('SELECT 1');
$checks['database'] = 'ok';
} catch (\Exception $e) {
$checks['database'] = 'error';
}
// Inertia version present
$checks['inertia_version'] = config('app.asset_version', 'none');
$healthy = !in_array('error', $checks);
return response()->json([
'status' => $healthy ? 'ok' : 'degraded',
'checks' => $checks,
], $healthy ? 200 : 503);
}
}
// routes/web.php
Route::get('/health/inertia', \App\Http\Controllers\InertiaHealthController::class);
Test it:
curl http://localhost:8000/health/inertia
# {"status":"ok","checks":{"session":"ok","database":"ok","inertia_version":"1.0.0"}}
Step 3: Set up Vigilmon monitoring
Add your endpoints to Vigilmon:
- Sign up at vigilmon.online
- Click New Monitor → HTTP
Monitor 1 — Server health:
- URL:
https://yourdomain.com/health - Method: GET
- Expected status: 200
- Interval: every 1 minute
Monitor 2 — Inertia stack health:
- URL:
https://yourdomain.com/health/inertia - Method: GET
- Expected status: 200
- Expected body contains:
"status":"ok" - Interval: every 1 minute
Monitor 3 — Root page load time (optional but valuable):
- URL:
https://yourdomain.com/ - Expected status: 200
- Interval: every 5 minutes
The root page monitor catches asset-serving issues that the API monitors won't detect — if Vite's manifest file is missing or your CDN is serving stale assets, the root page load will show elevated response times or a 500.
Step 4: Configure Slack alerts
- In Vigilmon go to Settings → Integrations → Slack
- Click Connect Slack, choose your channel
- Open each monitor and enable Alert on failure
For production Inertia apps, we recommend enabling recovery alerts too — knowing when the service comes back up is just as important as knowing it went down.
Step 5: Recommended alert thresholds
| Monitor | Warning threshold | Critical threshold | |---------|------------------|-------------------| | Server health | Response > 500ms | Status ≠ 200 | | Inertia health | Response > 400ms | Status ≠ 200 | | Root page load | Response > 1000ms | Response > 3000ms | | 7-day uptime | < 99.9% | < 99% |
Inertia apps are particularly sensitive to controller response time because there's no client-side caching layer for page data. A slow database query that adds 800ms to a page load is felt by every user on every navigation.
Step 6: Monitoring after deploys
Inertia detects asset version mismatches and forces a full page reload. If you deploy frequently, monitor the minutes immediately after each deploy:
Add your asset version to the Inertia middleware so Vigilmon can track it:
// app/Http/Middleware/HandleInertiaRequests.php
public function version(Request $request): string|null
{
return md5_file(public_path('build/manifest.json'));
}
When the asset version changes, Vigilmon's response body check on your /health/inertia endpoint will show the new version — giving you a correlatable event to check against any alert that fires post-deploy.
Step 7: Add a public status page
- In Vigilmon, go to Status Pages → New Status Page
- Add all three monitors
- Choose a custom subdomain:
status.yourdomain.com - Enable the incident history option
- Publish
Link your status page from your app's footer. Customers appreciate being able to check status themselves during incidents.
Conclusion
Inertia.js's monolith architecture is a strength — fewer moving parts means fewer things to go wrong. But when something does go wrong, it manifests as a silent frontend failure that's hard to debug without observability.
With Vigilmon you get:
- HTTP uptime monitoring for your backend server
- Session, database, and Inertia stack health checks
- Root page load time monitoring to catch asset and CDN issues
- Slack alerts within seconds of any failure
- Public status page for incident transparency
Sign up at vigilmon.online and have your Inertia.js app fully monitored in under 30 minutes.