# Farah Jokhio – Principal Software Engineer > Principal Software Engineer and Technical Lead with 13+ years building SaaS platforms, APIs, payment systems, integrations, and AI-enabled products. This is the personal website of Farah Jokhio. It contains project case studies, engineering notes (short practical tips grouped by technology), longer articles, and starter kits. All content is written by Farah Jokhio. - Website: https://farahjokhio.com - Profile: https://www.linkedin.com/in/farahjokhio/ - Profile: https://github.com/frahjokhio - Focus areas: Laravel, PHP, Software Architecture, REST APIs, Payment Systems, SaaS, System Integrations, AI-enabled Products, Technical Leadership ## Main pages - [Home](https://farahjokhio.com): Overview of strengths, engineering approach and latest work - [Experience](https://farahjokhio.com/profile): Career history, engineering focus and education - [Selected work](https://farahjokhio.com/projects): Project case studies - [Engineering notes](https://farahjokhio.com/tips): Practical tips grouped by technology - [Articles](https://farahjokhio.com/blogs): Longer guides and reflections - [On my desk](https://farahjokhio.com/latest-on-my-desk): Current experiments and working log ## Projects - [AI-Powered Database Intelligence Agent](https://farahjokhio.com/projects/ai-powered-database-intelligence-agent): An MCP-based agent that connects AI tools to MySQL, enabling secure schema discovery, natural-language queries, and validated SQL execution. - [One API. Five Platforms. Automated Publishing](https://farahjokhio.com/projects/one-api-five-platforms-automated-publishing): A lightweight Python service for publishing messages across multiple platforms through a single REST API. ## Articles - [Boost React App Performance with React.memo](https://farahjokhio.com/post/boost-react-app-performance-with-reactmemo): React applications can sometimes suffer from unnecessary re-renders, impacting performance. React.memo can help optimize your app by preventing these unwanted re-renders. We'll walk through simple exa… - [JSX: Writing Markup in React JS](https://farahjokhio.com/post/jsx-writing-markup-in-react-js): JSX (JavaScript XML) is a syntax extension for JavaScript that looks similar to HTML. It's used in React to describe what the UI should look like. This blog will guide you through the basics of writin… - [Automate: Scheduling Artisan Commands in Laravel](https://farahjokhio.com/post/automate-scheduling-artisan-commands-in-laravel): Laravel Task Scheduling lets you automate recurring tasks without needing a separate cron job for each one. This is especially useful for tasks like sending daily emails or clearing out old data. - [How to Structure and Simplify API Responses with Laravel API Resources](https://farahjokhio.com/post/how-to-structure-and-simplify-api-responses-with-laravel-api-resources): Laravel API Resources give a simple way to structure and format the data. This makes it easy to control exactly what information is returned, which can save time and make responses cleaner. - [Monolith vs. Serverless Architecture](https://farahjokhio.com/post/monolith-vs-serverless-architecture): In the ever-evolving world of software development, choosing the right architecture for your project is crucial. Two prominent approaches are monolith and serverless architectures. Both have their str… - [Identifiers in Node.js](https://farahjokhio.com/post/identifiers-in-nodejs): Identifiers in Node.js are names used to refer to various entities, including variables, functions, classes, and modules. They help in accessing and manipulating data and functionality within applicat… - [Query Strings in Node.js](https://farahjokhio.com/post/query-strings-in-nodejs): The querystring module in Node.js provides utilities for parsing and formatting query strings. It allows to convert query strings to objects and vice versa, as well as to escape and unescape special c… - [Dynamically Injecting and Executing Inline Scripts with window.onload in JavaScript](https://farahjokhio.com/post/dynamically-injecting-and-executing-inline-scripts-with-windowonload-in-javascript) - [Reverting a Reverted Commit and Restoring Previous Changes in Git](https://farahjokhio.com/post/reverting-a-reverted-commit-and-restoring-previous-changes-in-git): On one of my live projects, I needed to work with JavaScript scripts related to Facebook Pixel, so I created a branch add-fb-scripts. After deploying to production, I discovered that the event ID was… - [Global Search Using Laravel and Livewire](https://farahjokhio.com/post/global-search-using-laravel-and-livewire): I have implemented a global search feature on this portfolio website. For a quick practical demonstration, click on the search icon in the navigation bar and type anything. If you want to know how I d… ## Engineering notes: Node.js - [Scope](https://farahjokhio.com/tip/nodejs/scope): Scope in Node.js defines where variables and functions can be accessed in your code. It includes global scope, block scope, and module scope. Lexical scope. - [Arrow Functions](https://farahjokhio.com/tip/nodejs/arrow-functions): Arrow functions in Node.js are a concise way to write functions. They are great for short, single-expression functions and have unique behaviors like lexical th… - [Functions : Declaration, Expression, IIFE, Callback and More](https://farahjokhio.com/tip/nodejs/functions-declaration-expression-iife-callback-and-more): Functions are fundamental building blocks in Node.js, used to organize code and handle logic. - [Toggle Classes Based on Conditions](https://farahjokhio.com/tip/nodejs/toggle-classes-based-on-conditions): Use classList.toggle to add or remove classes based on a condition. If the text content of element includes 'Activate', the class 'active' is added. If the text… ## Engineering notes: React Js - [Simplify Context Usage with a Custom Hook](https://farahjokhio.com/tip/react-js/simplify-context-usage-with-a-custom-hook): When using the Context API in multiple components, you can streamline access by creating a custom hook for your context. This tiny hack reduces boilerplate and… - [Custom Hook : Simplify Code with Reusable Logic](https://farahjokhio.com/tip/react-js/custom-hook-simplify-code-with-reusable-logic): The custom hook in React allows to write data-fetching logic once and reuse it across multiple components. - [Optimizing Performance with React.memo](https://farahjokhio.com/tip/react-js/optimizing-performance-with-reactmemo): Wrap components in React.memo to avoid unnecessary re-renders. - [How to Use Error Boundaries to Handle Errors](https://farahjokhio.com/tip/react-js/how-to-use-error-boundaries-to-handle-errors): Error Boundaries are essential for building stable React applications by catching and managing unexpected errors. - [Labels: Names used to label loops and control flow](https://farahjokhio.com/tip/react-js/labels-names-used-to-label-loops-and-control-flow): Labels in Node.js (and JavaScript) are used to name a statement, typically for controlling the flow of loops or conditional statements. Labels can be particular… - [Using useMemo for Caching and Optimizing Performance](https://farahjokhio.com/tip/react-js/using-usememo-for-caching-and-optimizing-performance): useMemo is a React Hook that helps optimize performance by memoizing (caching) the result of a function so that it doesn't need to be recalculated on every rend… - [Destructuring Props in Functional Components](https://farahjokhio.com/tip/react-js/destructuring-props-in-functional-components): When you pass any props to any componenet, as in this example passing name and age as props to Profile component then you can use destructuring to directly extr… - [Default Props for Components](https://farahjokhio.com/tip/react-js/default-props-for-components): This code sets a default value for the text prop in the Button component. If no text prop is provided when using the component, it will default to "Click me". T… - [Conditional Rendering with Short Circuit](https://farahjokhio.com/tip/react-js/conditional-rendering-with-short-circuit): if you don’t need the else block while rendering components in React Js, you can do like this This snippet conditionally renders the AdminPanel component. The &… ## Engineering notes: DSA - [Your payment service is getting hammered. Your product catalog is barely breaking a sweat](https://farahjokhio.com/tip/dsa/your-payment-service-is-getting-hammered-your-product-catalog-is-barely-breaking-a-sweat): The knee-jerk reaction I see too often is: "Let’s extract payments into a microservice so we can scale it independently." ## Engineering notes: Laravel - [Files with Temporary URLs in Laravel Storage](https://farahjokhio.com/tip/laravel/files-with-temporary-urls-in-laravel-storage): Generating temporary URLs for files in Laravel's storage allows you to share files securely without exposing them indefinitely. This is especially useful for pr… - [Handling Dates with Carbon Date Helpers](https://farahjokhio.com/tip/laravel/handling-dates-with-carbon-date-helpers): Carbon Helper simplifies working with dates, making it easier to perform common tasks like formatting, comparing, and manipulating dates. - [Custom Blade Directives in Laravel](https://farahjokhio.com/tip/laravel/custom-blade-directives-in-laravel): Laravel allows you to create custom Blade directives, making it easier to reuse and organize common code in your views. - [Keep Data Without Deleting It: Using Laravel Soft Delete](https://farahjokhio.com/tip/laravel/keep-data-without-deleting-it-using-laravel-soft-delete): Laravel Soft Delete lets "delete" records without actually removing them from the database. This can be useful when you want to keep data for future recovery. - [How to Automatically Add User Info to Logs](https://farahjokhio.com/tip/laravel/how-to-automatically-add-user-info-to-logs): Log::withContext adds a global context to all logs within the current request. - [Handle Unmatched Routes with Fallback Routes](https://farahjokhio.com/tip/laravel/handle-unmatched-routes-with-fallback-routes): When no route is matched, Route Fallback can be used to handle it. Regular Routes: Define your typical routes as usual, handling the main application routes. Fa… - [Implicit and Explicit Route Model Binding](https://farahjokhio.com/tip/laravel/implicit-and-explicit-route-model-binding): 1. Implicit Route Model Binding Route Definition: Route::get('user/{user}', [UserController::class, 'show']) automatically resolves the User model for the {user… - [Route Resource Controllers for CRUD Operations](https://farahjokhio.com/tip/laravel/route-resource-controllers-for-crud-operations): Resource controllers simplifies CRUD operations and keeps codebase organized and maintainable by following RESTful practices. Route Definition: Route::resource(… - [Route Model Binding with Custom Query Constraints](https://farahjokhio.com/tip/laravel/route-model-binding-with-custom-query-constraints): Route model binding with query constraints is used to ensure that only specific models are bound, this will optimize both performance and security. Route::get('… - [Route Model Binding](https://farahjokhio.com/tip/laravel/route-model-binding): Route model binding is used to automatically inject model instances into controllers, this will help to look code cleaner and more efficient. Route::get('post/{… - [Named Routes: Parameter Substitution and URL Generation](https://farahjokhio.com/tip/laravel/named-routes-parameter-substitution-and-url-generation): Parameter substitution in named routes and generate URLs dynamically, including handling optional parameters and generating URLs in views and redirects. Route::… - [Handle Dynamic Routes with Parameters and Constraints](https://farahjokhio.com/tip/laravel/handle-dynamic-routes-with-parameters-and-constraints): To handle dynamic routes with parameters and add constraints to ensure they meet specific requirements. Route::get('user/{id}', [UserController::class, 'show'])… - [Simplify Routing with Route Groups, Prefixes, and Middleware](https://farahjokhio.com/tip/laravel/simplify-routing-with-route-groups-prefixes-and-middleware): To organize routes efficiently using route groups with prefixes and middleware, making code cleaner and easier to manage. Route::prefix('admin'): Adds the 'admi… - [Route Caching to Enhance Laravel Application's Performance](https://farahjokhio.com/tip/laravel/route-caching-to-enhance-laravel-applications-performance): Enhance route caching to improve your application's performance by speeding up route loading. php artisan route:cache: This command caches your routes, which sp… - [Composer Packages with Version Constraints](https://farahjokhio.com/tip/laravel/composer-packages-with-version-constraints): Control which versions of Composer packages should be installed in your project using version constraints. When specifying "livewire/livewire": "^2.0" like this… - [Autoload Composer Dependencies for Faster Performance](https://farahjokhio.com/tip/laravel/autoload-composer-dependencies-for-faster-performance): This command generates an optimized file that maps all the class names to their corresponding file locations, which is stored in the vendor/autoload.php This by… - [Using --ignore-platform-req and --ignore-platform-reqs with Composer](https://farahjokhio.com/tip/laravel/using-ignore-platform-reqs-with-composer): Using --ignore-platform-req and --ignore-platform-reqs flags to bypass specific or all platform requirements during Composer install or update. It's useful when… - [Remove Composer Package](https://farahjokhio.com/tip/laravel/remove-composer-package): Removing an installed Composer package from your PHP or Laravel project. Let's consider you want to remove Livewire from your Laravel appliation This command un… - [Authenticate Users with auth Middleware](https://farahjokhio.com/tip/laravel/authenticate-users-with-auth-middleware): Use the auth middleware to enforce authentication for routes, ensuring only authenticated users can access protected resources. - [Log Requests with Custom Middleware](https://farahjokhio.com/tip/laravel/log-requests-with-custom-middleware): Implement custom middleware to log incoming requests, helping in tracking and analyzing application traffic and performance. Use Artisan command to create a new… - [Modify Response with Middleware](https://farahjokhio.com/tip/laravel/modify-response-with-middleware): Modify or enhance responses using middleware, such as adding headers, manipulating content, or handling exceptions. - [Optimize Performance with Middleware](https://farahjokhio.com/tip/laravel/optimize-performance-with-middleware): Use middleware to perform optimizations like caching responses, compressing output, or handling session management efficiently. - [Use Blade Layouts for Consistency](https://farahjokhio.com/tip/laravel/use-blade-layouts-for-consistency): Utilize Blade layouts to maintain consistent structure and reduce redundancy across your application's views. Layouts help in organizing common elements like he… - [Minimize Direct Queries in Blade Views](https://farahjokhio.com/tip/laravel/minimize-direct-queries-in-blade-views): Avoid executing database queries directly within Blade templates. Instead, fetch data in the controller or service layer and pass it to the view. This reduces q… - [Cache Blade Views for Faster Rendering](https://farahjokhio.com/tip/laravel/cache-blade-views-for-faster-rendering): Cache rendered Blade views to store compiled templates and reduce server processing time. Laravel's caching mechanisms like cache() helper or Blade directives (… - [Optimize Database Query Usage with Eager Loading](https://farahjokhio.com/tip/laravel/optimize-database-query-usage-with-eager-loading): Use eager loading (with() method) in your controller to load related models with fewer database queries. This reduces the overhead of multiple queries executed… - [Leverage Blade Control Structures Efficiently](https://farahjokhio.com/tip/laravel/leverage-blade-control-structures-efficiently): Utilize Blade's control structures (@if, @foreach, @empty, etc.) effectively to minimize unnecessary PHP logic in your templates. This improves readability and… - [Reduce Template Size with Blade Includes](https://farahjokhio.com/tip/laravel/reduce-template-size-with-blade-includes): Description: Break down large Blade templates into smaller reusable components using @include directives. This approach enhances maintainability and speeds up r… - [Monitor Command Execution with Output Control](https://farahjokhio.com/tip/laravel/monitor-command-execution-with-output-control): Control and monitor the output of Artisan commands using Laravel's built-in methods. This allows you to manage verbosity levels, redirect output to logs or file… - [Use Artisan Commands for Testing](https://farahjokhio.com/tip/laravel/use-artisan-commands-for-testing): Integrate Artisan commands into your testing workflow to automate testing tasks and streamline the testing process. Run commands to seed databases, clear caches… - [Extend Existing Artisan Commands](https://farahjokhio.com/tip/laravel/extend-existing-artisan-commands): Extend and customize built-in Laravel Artisan commands to suit specific requirements. This technique allows you to modify default behavior, add new functionalit… - [Pass Arguments and Options to Artisan Commands](https://farahjokhio.com/tip/laravel/pass-arguments-and-options-to-artisan-commands): Enhance command flexibility by passing arguments and options to Artisan commands. This allows dynamic execution based on user input and parameters, making comma… - [Schedule Tasks with Artisan Scheduler](https://farahjokhio.com/tip/laravel/schedule-tasks-with-artisan-scheduler): Automate recurring tasks such as sending emails, generating reports, or cleaning up the database using Laravel's Artisan Scheduler. Schedule commands to run at… - [Create Custom Artisan Commands](https://farahjokhio.com/tip/laravel/create-custom-artisan-commands): Extend Laravel's functionality by creating custom Artisan commands tailored to your application's specific needs. Custom commands automate tasks, improve workfl… - [Protect Routes with Middleware](https://farahjokhio.com/tip/laravel/protect-routes-with-middleware): Use middleware to control access to your routes. Middleware can help you enforce authentication, roles, and permissions, ensuring only authorized users can acce… - [Sanitize Input to Prevent SQL Injection](https://farahjokhio.com/tip/laravel/sanitize-input-to-prevent-sql-injection): Always use Eloquent ORM or Laravel's query builder to interact with the database, which automatically prevents SQL injection by binding parameters. - [Enable CSRF Protection](https://farahjokhio.com/tip/laravel/enable-csrf-protection): Laravel automatically includes CSRF protection in its forms. Ensure all your forms include the CSRF token to protect against cross-site request forgery attacks. - [Hash Passwords Securely](https://farahjokhio.com/tip/laravel/hash-passwords-securely): Always hash passwords using Laravel's built-in Hash facade. Never store plain-text passwords in your database. - [Use HTTPS for Secure Communication](https://farahjokhio.com/tip/laravel/use-https-for-secure-communication): Ensure your application uses HTTPS to encrypt data transmitted between the client and server. Update your APP_URL in the .env file to use HTTPS. - [Utilize Caching for Repeated Queries](https://farahjokhio.com/tip/laravel/utilize-caching-for-repeated-queries): Cache frequently executed queries to reduce database load and improve response times. Caching helps in retrieving data quickly without hitting the database ever… - [Apply Select Statements for Efficient Data Retrieval](https://farahjokhio.com/tip/laravel/apply-select-statements-for-efficient-data-retrieval): Retrieve only the necessary columns from the database to reduce memory usage and speed up queries. This is particularly useful when working with large tables. - [Use Lazy Eager Loading for Conditional Relationships](https://farahjokhio.com/tip/laravel/use-lazy-eager-loading-for-conditional-relationships): Load related models only when needed using lazy eager loading. This technique helps in optimizing queries by loading relationships conditionally. - [Leverage Chunking for Large Datasets](https://farahjokhio.com/tip/laravel/leverage-chunking-for-large-datasets): Process large datasets efficiently by using the chunk method. Chunking retrieves records in smaller chunks, reducing memory usage and improving performance. - [Use Query Scopes for Reusable Queries](https://farahjokhio.com/tip/laravel/use-query-scopes-for-reusable-queries): Encapsulate common query logic within model scopes to keep your code DRY (Don't Repeat Yourself). Scopes make your queries reusable and your code more readable.… - [Optimize Queries with Eager Loading](https://farahjokhio.com/tip/laravel/optimize-queries-with-eager-loading): Reduce the number of database queries by using Eager Loading. Eager Loading helps you load related models in a single query, avoiding the N+1 query problem, thu… ## Engineering notes: Livewire - [Dynamically Updating Data in Blade Templates](https://farahjokhio.com/tip/livewire/dynamically-updating-data-in-blade-templates): Update data in Blade templates using Livewire components without refreshing the page. This can be beneficial for real-time updates. In your Component Class put… - [Handling Form Submissions](https://farahjokhio.com/tip/livewire/handling-form-submissions): Update the Livewire Component Class: In Livewire view file - [Merging Collections of Eloquent Models](https://farahjokhio.com/tip/livewire/merging-collections-of-eloquent-models): This code snippet is useful when you need to merge results from multiple model queries into a single collection. Here is an example: toBase(): Converts the init… ## Engineering notes: Javascript - [Dynamically Update Attribute Values](https://farahjokhio.com/tip/javascript/dynamically-update-attribute-values): To change the attributes of multiple elements based on user input or other dynamic conditions. Use setAttribute to update attributes for multiple elements. Let… - [Remove Multiple DOM Elements](https://farahjokhio.com/tip/javascript/remove-multiple-dom-elements): Use a loop to detach elements and then remove them all at once. parentNode is a property that refers to the parent element of a given DOM node. It allows you to… - [Apply Styles to Multiple Elements](https://farahjokhio.com/tip/javascript/apply-styles-to-multiple-elements): Apply a style to multiple elements at once by adding a class. Here highlighting selected list items with a single class addition: Html : Javascript: - [Efficiently Append Multiple Elements](https://farahjokhio.com/tip/javascript/efficiently-append-multiple-elements): Appending multiple elements to the DOM can be inefficient if done individually. Use a document fragment to batch append operations. A Document Fragment is a lig… - [Inject a Script into Document Head or Body Tags](https://farahjokhio.com/tip/javascript/inject-a-script-into-document-head-or-body-tags): You can inject js script into the document head dynamically like this : I followed this approach to dynamically inject JavaScript scripts into the and tags via… ## Engineering notes: Hosting - [Connecting to a Hosting Server with PowerShell](https://farahjokhio.com/tip/hosting/connecting-to-a-hosting-server-with-powershell): If you have been connecting to your server like this : This can be done using Powershell Profiles. PowerShell profiles can save time, especially if you frequent… ## Optional - [Global Search on database with Laravel Livewire, Scout, and Tailwind CSS](https://farahjokhio.com/boilerplates/global-search-on-database-with-laravel-livewire-scout-and-tailwind-css): Quickly implement Global search feature in Laravel project using Livewire, Scout, and Tailwind CSS. This boilerplate provides a straightforward setup for creating a search interface that queries multi… - [Laravel Mailchimp OAuth Integration Boilerplate](https://farahjokhio.com/boilerplates/laravel-mailchimp-oauth-integration-boilerplate): The Global Search Boilerplate integrates Laravel Livewire, Scout, and Tailwind CSS to create a powerful global search feature in Laravel applications. This setup provides a straightforward implementat… - [Continuous Integration (CI) Boilerplate for Laravel with GitHub Actions](https://farahjokhio.com/boilerplates/continuous-integration-boilerplate-for-laravel-with-github-actions): A boilerplate for setting up Continuous Integration (CI) for Laravel applications using GitHub Actions. This setup includes automated steps for code linting, quality checks, dependency installation, d… - [Payment Integration with Stripe Elements, Laravel, and Tailwind CSS](https://farahjokhio.com/boilerplates/payment-integration-with-stripe-elements-laravel-and-tailwind-css): The Laravel Stripe Payment Boilerplate is a starter template designed to simplify the integration of Stripe payment processing into Laravel applications. - [Node.js, Socket.IO, PostgreSQL, TypeScript Boilerplate](https://farahjokhio.com/boilerplates/nodejs-socketio-postgresql-typescript-boilerplate): A boilerplate for creating a real-time notification system using Node.js, Socket.IO, PostgreSQL, and TypeScript. This template demonstrates how to implement a real-time notification service, enabling…