Open-Access Production Interview Prep
Senior & Lead Engineer
Interview Mastery Hub
100 real-world, scenario-based architecture & concurrency questions designed for 5–10+ years experienced developers. Free & open for every student and engineer.
100
Real-world Q&As
100%
Scenario-Based
5-10 Yrs
Senior / Lead Depth
5 Stacks
Core Technologies
Showing 25 questions for senior interview preparation
•
Laravel Advanced & Architecture
5-8 Years (Senior)
Hard
Production Scenario
How do you manage Database Transactions with external 3rd-party webhook triggers safely in Laravel?
Incident Scenario:
A transaction was committed, but an unhandled exception in an external Stripe webhook inside the transaction closure rolled back the database after Stripe had already charged the credit card.
The Golden Rule: Never call external network APIs inside a database transaction
Use DB::afterCommit() callbacks:
DB::transaction(function () use ($order, $paymentData) {
$order->update(['status' => 'paid']);
PaymentTransaction::create([...]);
// Dispatch side-effects ONLY after database commit succeeds
DB::afterCommit(function () use ($order) {
SendInvoiceEmailJob::dispatch($order);
NotifyThirdPartyFulfillment::dispatch($order);
});
});
Tags:
#Database Transactions
#Webhooks
#Stripe
#Consistency
Laravel Advanced & Architecture
5-8 Years (Senior)
Medium
Production Scenario
How do you implement Custom Eloquent Casts with Value Objects in modern Laravel?
Incident Scenario:
A fintech app handles multi-currency amounts (USD, EUR, JPY) and needs to avoid floating point precision errors by casting database integers to immutable `Money` Value Objects.
Implementing CastsAttributes
class MoneyCast implements CastsAttributes
{
public function get(Model $model, string $key, mixed $value, array $attributes): ?Money
{
return $value !== null ? new Money((int) $value, $attributes['currency'] ?? 'USD') : null;
}
public function set(Model $model, string $key, mixed $value, array $attributes): array
{
if ($value instanceof Money) {
return [$key => $value->getAmountInCents(), 'currency' => $value->getCurrency()];
}
return [$key => (int) $value];
}
}
Tags:
#Eloquent
#Custom Casts
#Value Objects
#DDD
#Fintech
Laravel Advanced & Architecture
5-8 Years (Senior)
Medium
Production Scenario
How do you monitor and handle Slow Query alerts in real-time in Laravel production?
Incident Scenario:
You need an automated Slack/Sentry alert whenever any database query takes longer than 500ms in production.
Using DB::whenQueryingForLongerThan
In AppServiceProvider::boot():
DB::whenQueryingForLongerThan(500, function (Connection $connection) {
Log::warning("Database query exceeded 500ms on [{$connection->getName()}]");
// Send alert to Sentry or Slack webhook
});
Tags:
#Monitoring
#Database
#Performance
#DB Listeners
Laravel Advanced & Architecture
5-8 Years (Senior)
Medium
Production Scenario
How do you architect Rate Limiting tiers (e.g. Free, Pro, Enterprise) dynamically in Laravel Routing?
Incident Scenario:
An enterprise developer API needs tiered rate limits: Free (60 req/min), Pro (1,000 req/min), Enterprise (10,000 req/min) based on the user's active subscription plan.
Dynamic Rate Limiter in AppServiceProvider
RateLimiter::for('api', function (Request $request) {
$user = $request->user();
if (! $user) {
return Limit::perMinute(30)->by($request->ip());
}
return match ($user->subscription_tier) {
'enterprise' => Limit::perMinute(10000)->by($user->id),
'pro' => Limit::perMinute(1000)->by($user->id),
default => Limit::perMinute(60)->by($user->id),
};
});
Tags:
#Rate Limiting
#Routing
#Security
#SaaS
Laravel Advanced & Architecture
8-10 Years (Tech Lead)
Hard
Production Scenario
How do you handle graceful worker restarts in Kubernetes / Docker for Laravel Queues and Octane?
Incident Scenario:
During Kubernetes rolling deployments, pods received `SIGTERM` and immediately died, terminating active payment processing jobs mid-flight and corrupting order status.
Graceful Termination Workflow
- Catch
SIGTERMin worker: In Kubernetes, setterminationGracePeriodSeconds: 120. - Supervisor Configuration: Set
stopwaitsecs = 120so Supervisor gives workers up to 2 minutes to finish processing current job before force killing (SIGKILL). - Queue Worker Command:
php artisan queue:work --stop-when-empty --max-time=3600 --timeout=90
Tags:
#Kubernetes
#Docker
#Graceful Shutdown
#SIGTERM
#DevOps