Top Laravel + Vue.js Full-Stack Interview Questions (Basic to Advanced)
This is a practical interview prep guide for Laravel + Vue.js full-stack developer roles. It is structured from basic to advanced so you can revise quickly before interviews, technical rounds, and system design discussions.
Use this as a revision sheet, then practice explaining each answer with your own real project examples for stronger interview performance.
1. Laravel Core (Must Be Strong)
What is Laravel Service Container?
It is Laravel's dependency injection container that resolves class dependencies and manages object creation.
Difference between bind(), singleton(), and instance()?
bind() creates a new instance each resolve, singleton() reuses one instance, and instance() registers an already-created object.
What are Service Providers? When are they loaded?
Service providers bootstrap application services; they are loaded during app startup, before request handling logic runs.
Explain Middleware lifecycle.
Request enters global middleware, then route middleware, reaches controller, and response passes back through middleware stack.
What is CSRF protection and how Laravel handles it?
CSRF prevents forged state-changing requests; Laravel validates CSRF tokens for web routes via middleware.
Difference between web.php and api.php routes?
web.php uses session/cookies/CSRF and stateful middleware; api.php is stateless and typically token-authenticated.
What are Events and Listeners?
Events represent actions in the app; listeners handle side effects like sending emails or logging activity.
Explain Laravel Queues and when to use them.
Queues defer heavy tasks like emails, exports, and notifications to background workers for faster response times.
What is Job chaining?
It runs multiple queued jobs sequentially, where each job starts only if the previous one succeeds.
Difference between dispatch() and dispatchSync()?
dispatch() pushes job to queue (async), while dispatchSync() executes immediately in the current request.
What is Eloquent ORM? Query Builder vs Eloquent?
Eloquent maps DB tables to models with relationships; Query Builder is lower-level and often better for complex/raw performance cases.
What are Accessors and Mutators?
Accessors transform values when reading model attributes; mutators transform values before saving.
What is Mass Assignment? $fillable vs $guarded?
Mass assignment protects model fields from unwanted input; $fillable is allow-list, $guarded is block-list.
Explain Soft Deletes.
Soft deletes mark records with deleted_at instead of permanent deletion, enabling restore and audit-friendly behavior.
Relationship difference: hasOne, hasMany, belongsTo, belongsToMany?
hasOne/hasMany define child ownership, belongsTo defines parent reference, belongsToMany handles many-to-many via pivot table.
2. Laravel Intermediate
What is N+1 Query problem? How to fix?
N+1 happens when related data triggers one extra query per row; fix it using eager loading with with().
Eager Loading vs Lazy Loading?
Eager loading fetches relationships upfront in fewer queries; lazy loading fetches on access, often causing N+1.
What is Repository Pattern? Have you used it?
It abstracts data access behind interfaces, improving testability and separation of concerns in larger projects.
What are API Resources?
API Resources transform models into consistent JSON responses and control output shape/versioning.
Laravel Authentication: Sanctum vs Passport vs JWT?
Sanctum is simple and great for SPAs/mobile; Passport is OAuth2 for complex third-party auth; JWT packages are stateless token alternatives.
What are Policies and Gates?
Gates are closure-based authorization checks; policies organize model-specific authorization methods.
What is Form Request Validation?
A dedicated request class containing validation rules and authorization logic, keeping controllers clean.
How Laravel handles file upload securely?
Validate mime/size, store outside public root when needed, generate unique names, and serve with controlled access.
What is caching in Laravel? Types?
Caching stores computed data for faster access; common types are config, route, view, query/data, and full response caching.
Cache::remember() vs rememberForever()?
remember() caches for a TTL, while rememberForever() keeps data until explicitly forgotten.
What is Laravel Scheduler?
It defines cron jobs in code via app/Console/Kernel.php and runs through a single server cron entry.
Explain Database Transactions.
Transactions ensure atomicity: either all queries commit together or all rollback on failure.
What is Observer in Laravel?
Observers group model event handlers like created, updated, and deleted to centralize model side effects.
3. Laravel Advanced (Senior Focus)
Explain Laravel lifecycle from request to response.
Entry point boots app, service providers register/boot, middleware pipeline runs, route resolves, controller executes, response returns through middleware.
How Service Container resolves dependencies automatically?
It uses reflection to inspect constructor type hints and recursively instantiate required classes.
What is Dependency Injection?
Passing dependencies into classes instead of creating them inside, improving testability and flexibility.
boot() vs register() in Service Provider?
register() binds services to container; boot() runs after all providers are registered for post-binding setup.
Queue worker scaling and retry strategy?
Scale workers horizontally, set timeout and backoff, use retries carefully, and move failed jobs to dead-letter handling.
How to optimize slow Laravel application?
Profile first, fix slow queries, add caching, move heavy tasks to queues, optimize autoload/config, and tune infrastructure.
Explain Redis usage in Laravel.
Redis is used for cache, session, queue backend, rate limiting, and pub/sub patterns due to low-latency in-memory access.
What is Horizon?
Horizon is Laravel's queue dashboard and supervisor for Redis queues with monitoring, metrics, and balancing.
Explain Rate Limiting in API.
Rate limiting controls request frequency per user/IP/token to prevent abuse and protect backend resources.
How to handle large dataset (millions of rows)?
Use chunked processing, cursor streaming, proper indexing, async jobs, and avoid loading full datasets into memory.
Chunk vs Cursor vs Lazy collections?
Chunk loads fixed-size batches, cursor streams one record at a time, and lazy collections provide memory-friendly pipelines.
How to implement multi-tenancy?
Use tenant identification, scoped queries, isolated data strategy (single DB or per-tenant DB), and tenant-aware caching/queues.
How to secure REST API?
Use strong auth, authorization policies, validation, HTTPS, rate limiting, logging, and least-privilege access.
Explain WebSockets and real-time in Laravel.
WebSockets keep persistent connections for instant updates like chat, notifications, and live dashboards.
What is Event Broadcasting?
Broadcasting pushes server-side events to frontend clients over channels using drivers like Pusher or Laravel WebSockets.
How to avoid memory leaks in queues?
Keep jobs small, release large references, restart workers periodically, and monitor memory usage in Horizon.
Explain database indexing and performance tuning.
Add indexes on frequent filters/joins/sorts, analyze query plans, and avoid over-indexing write-heavy tables.
How to handle concurrent updates (race condition)?
Use DB transactions, row locking, idempotency keys, and atomic update statements.
Optimistic vs pessimistic locking?
Optimistic locking checks version/timestamp before update; pessimistic locking locks rows during transaction to prevent conflicts.
How to build scalable architecture in Laravel?
Design stateless services, separate read/write concerns where needed, cache aggressively, queue background work, and scale horizontally.
4. Vue.js Core
What is Vue?
Vue is a progressive JavaScript framework for building reactive user interfaces and single-page applications.
Difference between Vue 2 and Vue 3?
Vue 3 introduces Composition API, better TypeScript support, Proxy-based reactivity, and improved performance/tree-shaking.
What is reactive system?
It tracks data dependencies and automatically updates the DOM when state changes.
What are Components?
Reusable UI units with encapsulated template, logic, and styles.
Props vs Emits?
Props pass data from parent to child; emits send events from child to parent.
What are v-bind, v-model, v-if, v-for?
v-bind binds attributes, v-model handles two-way binding, v-if conditionally renders, and v-for renders lists.
Computed vs Watch?
Computed is cached derived state; watch runs side effects when observed data changes.
Methods vs Computed?
Methods run every call; computed caches until dependencies change, making it better for derived values.
Lifecycle hooks?
Hooks like onMounted and onUnmounted run at specific component lifecycle stages.
What is Vue Router?
Official routing library for SPA navigation, route guards, and lazy-loaded routes.
What is Pinia / Vuex?
Both are state management libraries; Pinia is the modern official option with simpler API and better TypeScript experience.
5. Vue Intermediate
Composition API vs Options API?
Composition API groups logic by feature and scales better; Options API is simpler for smaller components.
What are composables?
Reusable functions that encapsulate reactive logic and can be shared across components.
How reactivity works internally?
Vue 3 uses JavaScript Proxy to track get/set operations and trigger dependency updates.
ref() vs reactive()?
ref() wraps primitives/objects with .value; reactive() creates reactive objects directly.
What is watchEffect()?
It immediately runs a reactive effect and reruns automatically when any used reactive dependency changes.
Lazy loading components?
Load components asynchronously using dynamic imports to reduce initial bundle size.
How to handle API calls in Vue?
Use service layers/composables with axios or fetch, track loading/error states, and cancel stale requests.
Axios interceptors?
Interceptors centralize request auth headers and response error handling such as token refresh.
Global error handling?
Use app-level error handlers, route guards, and centralized API error normalization.
Form validation (VeeValidate or custom)?
VeeValidate speeds up robust schema-based validation; custom validation is lighter for simple forms.
6. Vue Advanced (Very Important)
Explain Virtual DOM in Vue.
Vue builds a virtual tree, diffs changes, and patches only necessary real DOM nodes for efficiency.
How Vue reactivity works internally (Proxy)?
Proxies intercept access and mutations, register dependencies in effects, and trigger only subscribed updates.
Performance optimization in Vue app?
Use lazy routes/components, memoize computed logic, avoid large reactive trees, and virtualize long lists.
Code splitting and lazy routes?
Split bundles by route with dynamic imports so users download only what they need initially.
How to manage large state in Vue?
Use Pinia modules, normalized state, API caching strategy, and strict boundaries between domain stores.
How to avoid unnecessary re-renders?
Keep props stable, use computed wisely, avoid deep reactive objects, and split heavy components.
SSR vs SPA vs SSG?
SSR improves first-load SEO/performance, SPA offers app-like UX, and SSG pre-renders static pages for speed.
How hydration works?
Client Vue attaches event listeners to server-rendered HTML and continues app interactivity without full re-render.
Security in Vue (XSS, CSRF)?
Avoid unsafe HTML rendering, sanitize user input, and rely on backend CSRF/token strategies for state-changing requests.
How to build scalable Vue architecture?
Organize by domain modules, reusable composables, clear API layer, typed contracts, and consistent UI system.
Micro-frontend concept?
Multiple independently deployed frontend modules compose one product, useful for large teams and domain isolation.
Testing Vue components?
Use unit tests with Vitest/Jest + Vue Test Utils, and e2e flows with Playwright or Cypress.
7. Full-Stack (Laravel + Vue)
SPA vs Monolith vs API + Frontend?
Monolith is faster to start, SPA + API offers stronger separation and scale, and choice depends on team/product complexity.
How Laravel connects with Vue?
Laravel serves APIs/auth/business logic while Vue consumes endpoints and handles frontend state/routing.
REST API design best practices?
Use resource-based endpoints, proper HTTP verbs/status codes, validation, pagination, filtering, and consistent error format.
How to secure API authentication?
Prefer secure token/session strategy, enforce HTTPS, rotate tokens, and combine with authorization checks.
JWT vs Sanctum?
Sanctum is simpler for first-party SPA/mobile, while JWT works for stateless token workflows with custom control.
Handling file uploads in SPA?
Use multipart forms, progress UI, backend validation/scanning, and store with signed/private access where needed.
Pagination server vs client?
Server pagination is required for large datasets; client pagination is only fine for small preloaded data.
Handling large data tables?
Use server-side filtering/sorting, pagination, caching, and row virtualization on frontend.
Real-time notifications and WebSockets implementation?
Broadcast Laravel events to Vue via Echo and channels for instant in-app updates.
Role and permission system design?
Implement RBAC with roles, permissions, policy checks, and route/action-level authorization.
How to deploy full-stack app?
Automate build, migrate safely, cache config/routes, run queue workers, and monitor health/alerts.
CI/CD process?
Pipeline usually includes linting, tests, build artifacts, staging deploy, approvals, then production rollout.
Docker usage?
Docker standardizes environments for app, web server, queue, cache, and database services.
How to handle CORS?
Allow only trusted origins/methods/headers and avoid wildcard policies in production.
API versioning?
Version through URI or headers to ship breaking changes without disrupting existing clients.
8. Performance and Optimization (Advanced)
How to reduce API response time?
Optimize queries, reduce payload size, cache expensive results, and move heavy work to queues.
DB query optimization techniques?
Use indexes, avoid SELECT *, inspect execution plans, eager load correctly, and denormalize carefully when needed.
Explain indexing strategy.
Index high-cardinality columns used in where/join/order, and review slow query logs regularly.
Caching layers (Browser, App, DB, Redis)?
Combine browser cache headers, app-level cached responses, DB query tuning, and Redis for low-latency shared cache.
Queue vs Sync jobs?
Queue for non-blocking heavy tasks; sync only when immediate result is mandatory.
Lazy loading vs eager loading?
Lazy loading is convenient but risky for N+1; eager loading is preferred for predictable related data access.
CDN usage?
CDNs reduce latency by serving static assets from edge locations closer to users.
How to debug memory leak?
Track memory growth over time, isolate long-running workers, profile code paths, and restart leaking processes.
Laravel Telescope vs Debugbar?
Debugbar is great for local request profiling, while Telescope provides broader app observability and queue/request insight.
How to handle high traffic?
Scale horizontally, cache aggressively, offload async work, use load balancers, and protect with rate limits.
9. System Design and Scenario Questions
For senior rounds, interviewers test your architecture thinking more than syntax. Be ready to explain trade-offs, bottlenecks, and failure handling.
Design prompts you should practice:
- Design a scalable REST API with versioning and rate limits.
- Design a role-based access control system with audit trails.
- Design notification flow for email + in-app real-time updates.
- Design chat system with WebSockets and message persistence.
- Design large-file upload pipeline with chunking and retries.
- Design multi-tenant SaaS architecture and tenant isolation.
- Design approach for one million users and horizontal scaling.
- Design idempotent order/payment flow to avoid duplicates.
- Design reliable background job system with retries and dead-letter queue.
10. Practical Coding Questions
These tasks commonly appear in live coding and take-home rounds:
- Build CRUD API with validation and API resources.
- Implement search, sort, and pagination with filters.
- Optimize a slow query and explain index decisions.
- Find and fix N+1 query issue in Eloquent.
- Implement queued job with retry and failure handling.
- Build Vue form integrated with Laravel API.
- Handle secure file upload with progress and validation.
- Implement authentication and role-based authorization.
- Debug a production issue from logs and traces.
- Write complex SQL with joins, aggregations, and window functions.
11. HR and Experience-Based Questions
For leadership-level roles, your communication and decision-making matter as much as code quality.
- Explain your last project architecture and why you chose it.
- Describe major technical challenges and how you solved them.
- Share your biggest performance bottleneck and optimization result.
- Discuss scaling experience and key lessons.
- Compare your API-first vs monolith project experience.
- Explain your production debugging process.
- Explain collaboration style in team vs solo environments.
- Describe your code quality standards: tests, reviews, CI/CD, and observability.
Final Interview Preparation Tips
- Prepare concise definitions first, then real project examples.
- Practice explaining trade-offs, not only "right answers".
- Keep one architecture story ready for senior rounds.
- Revise performance, caching, queues, and database indexing deeply.
- For Vue, focus on Composition API, reactivity internals, and optimization patterns.
If you want to prepare for Laravel + Vue technical interviews with project-focused guidance, feel free to contact me.