<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by seif mouihbi on Medium]]></title>
        <description><![CDATA[Stories by seif mouihbi on Medium]]></description>
        <link>https://medium.com/@mouihbiseif?source=rss-29e624a8d1cd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*k21ymK_1r9te9Puhfp23aA.jpeg</url>
            <title>Stories by seif mouihbi on Medium</title>
            <link>https://medium.com/@mouihbiseif?source=rss-29e624a8d1cd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 15:01:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mouihbiseif/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How Veloo Matches Riders with Drivers: The Engineering Behind a Tunisian Ride-Hailing App]]></title>
            <link>https://medium.com/@mouihbiseif/how-veloo-matches-riders-with-drivers-the-engineering-behind-a-tunisian-ride-hailing-app-67d847396e32?source=rss-29e624a8d1cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/67d847396e32</guid>
            <category><![CDATA[taxi-booking-software]]></category>
            <category><![CDATA[taxi-service]]></category>
            <category><![CDATA[taxi-apps]]></category>
            <category><![CDATA[taxi-app-development]]></category>
            <category><![CDATA[navigation]]></category>
            <dc:creator><![CDATA[seif mouihbi]]></dc:creator>
            <pubDate>Thu, 03 Dec 2026 16:55:10 GMT</pubDate>
            <atom:updated>2026-12-03T17:10:20.726Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIbpC7P6llmfRDOifqktbw.png" /></figure><p><strong>How Veloo Matches Riders with Drivers: The Engineering Behind a Tunisian Ride-Hailing App</strong></p><p><em>*How we built real-time driver dispatch with Postgres, PostGIS, and React Native — and what we learned building a startup-grade matching system without a dedicated backend team.*</em></p><p><strong>The problem in one sentence</strong></p><p>When a rider in Tunis taps “book”, we have a few seconds to find the best available driver nearby — not just <em>*any*</em> driver — and get them to accept before the rider loses patience.</p><p>This is the core problem of every ride-hailing product, and it’s deceptively hard. Naive implementations collapse under race conditions, drain batteries with GPS streams, or spam every driver in the city with every request. This post explains how Veloo solves it, what our stack looks like, and the specific trade-offs we chose as a small team.</p><p><strong>The stack, briefly</strong></p><p>Veloo is a monorepo with two mobile apps (rider and driver) sharing one backend:</p><p>- <strong>**Mobile**</strong>: Expo SDK 57 / React Native 0.86, TypeScript strict mode, expo-router, react-native-maps (Google Maps), Reanimated, Zustand + TanStack Query for state</p><p>- <strong>**Shared code**</strong>: a `packages/shared` workspace package holds business logic, types, i18n (Arabic/French/English, RTL included), and services used by both apps</p><p>- <strong>**Backend**</strong>: Supabase — Postgres with PostGIS, Row Level Security, Realtime, Edge Functions (Deno), and pg_cron</p><p>- <strong>**Push**</strong>: Firebase Cloud Messaging, triggered from database webhooks through edge functions</p><p>- <strong>**Anti-abuse &amp; monitoring**</strong>: Cloudflare Turnstile, Sentry</p><p>- <strong>**Admin**</strong>: a Next.js console for KYC document review, user management, and operations</p><p>The unconventional choice here is that <strong>**our business logic lives in the database**</strong> — as PL/pgSQL functions — rather than in a backend service layer. That decision shapes everything below, so let me defend it before diving into the algorithm.</p><p><strong>Why put the matching engine in Postgres?</strong></p><p>The honest answer: we don’t have the team size to operate a separate backend service, and we don’t need one. What we need is:</p><p>1. <strong>**Atomicity**</strong> — two drivers must never accept the same ride</p><p>2. <strong>**Geospatial queries** — </strong>“drivers within N km of the pickup” must be fast</p><p>3. <strong>**Realtime fan-out**</strong> — drivers must see offers in under a second</p><p>Postgres gives us all three natively. PostGIS is one of the best geospatial toolkits in existence. Row-level locking makes acceptance races trivially safe. And Supabase Realtime + FCM handle fan-out. Writing the dispatch logic as `SECURITY DEFINER` RPC functions means the database is the single source of truth — no cache invalidation, no service-to-database consistency gaps.</p><p><strong>The matching algorithm, step by step</strong></p><p><strong>1. The request</strong></p><p>When a rider confirms a booking, `create_ride()` inserts the ride with status `requested` — pickup and dropoff stored as PostGIS `geography` points, plus the distance, duration, and fare estimate we computed from the Google Directions API (proxied through an edge function so the API key never ships in the app).</p><p><strong>2. Candidate discovery — geography first</strong></p><p>`find_nearby_drivers()` uses `ST_DWithin` to find drivers inside a radius around the pickup point. The first search uses <strong>**5 km**</strong>. But geography is only the first filter — a candidate must also be:</p><p>- <strong>**Online, verified, and not paused**</strong> — verified means their KYC documents (license, vehicle, insurance) were reviewed and approved by our ops team</p><p>- <strong>**Not already on a ride**</strong> — anyone with an `accepted`, `arrived`, or `in_progress` ride is excluded</p><p>- <strong>**Solvent**</strong> — drivers pay commission through an in-app wallet; anyone significantly in debt is excluded until they settle</p><p>- <strong>**Not already heard**</strong> — drivers who declined or timed out on <em>*this*</em> ride are never re-asked</p><p>- <strong>**The right service class**</strong> — licensed taxis only receive `taxi` rides (verified by a taxi permit document), bikes only receive bike-eligible requests, and so on</p><p><strong>3. Scoring — distance isn’t everything</strong></p><p>Within the candidate pool, every driver gets a composite score built from four weighted factors:</p><p>- <strong>**Distance to pickup**</strong> — the dominant factor by a wide margin. Closer drivers mean faster pickups and less deadheading.</p><p>- <strong>**Driver rating**</strong> — good drivers should be rewarded with more demand.</p><p>- <strong>**Acceptance rate**</strong> — a driver who rarely accepts wastes everyone’s time; offering to them first delays the match.</p><p>- <strong>**Reliability**</strong> — consecutive declines decay your priority, so chronic declining is self-defeating.</p><p>(Exact weights are our business — the point is the shape of the design, not the decimals.)</p><p>Two details worth sharing:</p><p>- <strong>**New drivers start with a neutral acceptance score**</strong> rather than zero — otherwise newcomers would never receive offers and could never build a track record. This cold-start problem is universal in two-sided marketplaces, and “assume neutral until proven otherwise” is the simplest honest answer to it.</p><p>- The score feeds an <strong>**ETA estimate**</strong> for the rider based on typical urban driving speed plus a small fixed margin for lights and turns. Crude, but honest — and it sets expectations.</p><p><strong>4. Simultaneous offers, first acceptance wins</strong></p><p>The top <strong>**5 drivers**</strong> by score receive the offer <strong>**simultaneously**</strong> — not one at a time. This is a deliberate trade-off: sequential waterfall dispatch (offer to the best driver, wait, offer to the next) produces better matches but adds 15–30 seconds of latency per round. In a market where riders cancel if nothing happens for 20 seconds, speed of first acceptance matters more than optimal assignment.</p><p>Drivers get the offer two ways in parallel: a <strong>**Realtime**</strong> postgres_changes subscription (if they’re in the app) and an <strong>**FCM push notification**</strong> fired by a database trigger through an edge function (if they’re not).</p><p>Acceptance is race-safe by construction:</p><p>```sql</p><p>SELECT status, driver_id INTO v_status, v_existing_driver</p><p>FROM rides WHERE id = p_ride_id FOR UPDATE;</p><p>IF v_status != ‘requested’ THEN</p><p>RETURN false; — too late, someone else got it</p><p>END IF;</p><p>```</p><p>The `FOR UPDATE` row lock serializes concurrent acceptances. Whoever commits first wins; the loser gets a clean `false` and the UI shows the offer as taken. There is no version of this system where two drivers arrive at the same pickup.</p><p><strong>### 5. Timeout and escalation</strong></p><p>Every offer lives for <strong>**15 seconds**</strong>. A pg_cron job sweeps expired offers every minute, marks them `timeout`, and re-dispatches the ride — this time with the radius expanded. The escalation ladder:</p><p>```</p><p>5 km → 10 km → 15 km</p><p>```</p><p>Each round also excludes everyone who already declined or timed out, so the search genuinely widens rather than re-pinging the same drivers. If a rider’s first attempt fails, it’s almost always because density is low — expanding geography is the correct response, not retrying the same five phones.</p><p><strong>6. The rest of the lifecycle</strong></p><p>Once accepted, the ride moves through `accepted → arrived → in_progress → completed`, with every transition validated server-side (only the assigned driver can advance it, only valid transitions are allowed). Realtime subscriptions update both apps live — the rider watches their driver’s position approach on the map.</p><p>Around this core loop sit the systems that make it a product rather than a demo:</p><p>- <strong>**Surge zones**</strong>: geographic polygons with fare multipliers, applied at estimate time</p><p>- <strong>**Scheduled rides**</strong>: book for later; pg_cron dispatches them into the same pipeline about 5 minutes before pickup time — scheduled rides are not a separate system, just deferred entries into the same one</p><p>- <strong>**Fares in millimes**</strong>: Tunisian dinars divide into 1000 millimes, and all money is integer arithmetic end-to-end — no floating point anywhere near a wallet</p><p>- <strong>**In-ride chat, SOS, incident reports**</strong>: the safety and communication layer, all moderated through the admin console</p><p><strong>The mobile side deserves a mention</strong></p><p>Writing a ride-hailing client is mostly a lesson in <em>*restraint with expensive resources*</em>:</p><p>- <strong>**GPS is only streaming when it needs to be**</strong>. The rider’s high-accuracy location watch runs only while the booking screen is focused and the app is foregrounded — browsing ride history or the profile stops the stream. Continuous GPS is a battery death sentence and we’d rather be honest about when we need it.</p><p>- <strong>**The map never blocks first paint**</strong>. Native map mounting is deferred until after initial render, hidden behind a boot cover until the camera sits on a real GPS fix — the app appears fast even though maps are heavy.</p><p>- <strong>**Permissions are primed, not ambushed**</strong>. Location permission is a two-step flow: an in-app explanation first, the OS dialog second. Cold permission prompts get denied; primed ones don’t.</p><p>- <strong>**Obfuscation is now a store requirement, not paranoia**</strong>. Google Play’s DEX optimization policy pushed us to full R8 shrinking and obfuscation — which on React Native requires careful keep-rules, because R8 will happily optimize away annotation-driven glue that Expo Modules needs at runtime. That’s a whole separate blog post.</p><p><strong>What we learned</strong></p><p>1. <strong>**Postgres is an underrated application server**</strong>. With transactions, row locks, PostGIS, and cron in one place, entire categories of distributed-systems bugs simply never existed for us. The matching engine is ~200 lines of SQL.</p><p>2. <strong>**Score-based simultaneous dispatch is the right complexity budget**</strong> for a market our size. Uber-scale matching (batched matching, graph optimization) is a solution to a problem we don’t have yet.</p><p>3. <strong>**Timeouts are a product feature**</strong>. Fifteen seconds feels arbitrary until you watch riders’ cancel behavior — it’s tuned to patience, not to technology.</p><p>4. <strong>**Integer millimes or nothing**</strong>. Money as floats is how you lose the trust of people who drive for a living.</p><p>5. <strong>**Every query path in the hot loop is indexed and measured**</strong> — a `ST_DWithin` over an unindexed geography column is a full table scan happening every few seconds, forever.</p><p><em>*Veloo is live in Tunisia on Google Play. We’re a small team building transport infrastructure for a market that global platforms underserve — and we’re just getting started.*</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67d847396e32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Building the Ultimate Developer’s Haven: Transforming Your Room into a Coding Oasis”]]></title>
            <link>https://medium.com/@mouihbiseif/building-the-ultimate-developers-haven-transforming-your-room-into-a-coding-oasis-d70f68a8bd0?source=rss-29e624a8d1cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d70f68a8bd0</guid>
            <dc:creator><![CDATA[seif mouihbi]]></dc:creator>
            <pubDate>Fri, 02 Jun 2023 23:01:03 GMT</pubDate>
            <atom:updated>2023-06-02T23:04:50.303Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re looking to transform your room into a developer’s paradise, here are some key elements you might consider:</p><blockquote>Ergonomic Setup: Invest in a comfortable chair and an adjustable desk that allows you to maintain a proper posture while working. Consider the height of your monitor(s) to prevent neck strain.</blockquote><blockquote>Multiple Monitors: Having multiple monitors can significantly enhance your productivity by providing ample screen space for coding, reference materials, and testing.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Klza14stdP6jpFBN.jpg" /></figure><p><a href="https://kit.co/seif-mouihbi/tecnologia/6557543-gtplayer-gaming-chai"><em>CLICK HERE TO START BUILDING YOUR FUTURE ROOM NOW</em></a></p><p>Good Lighting: Ensure your room has adequate lighting that doesn’t strain your eyes. Natural light is preferable, but if that’s not possible, opt for adjustable LED lighting with warm and cool color options.</p><blockquote>Reliable Internet Connection: A stable and fast internet connection is crucial for seamless communication, code collaboration, and accessing online resources.</blockquote><blockquote>Whiteboard or Large Workspace: A whiteboard or a large workspace will allow you to jot down ideas, sketch diagrams, and brainstorm solutions visually.</blockquote><p>Noise-Canceling Headphones: A pair of noise-canceling headphones can help you focus on your work, block out distractions, and immerse yourself in your coding tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*UZkrxX5RlN3Q7eKW.jpg" /></figure><blockquote>Dev-friendly Gadgets: Consider integrating devices like a mechanical keyboard, programmable mouse, and a stylus tablet for efficient input and coding.</blockquote><blockquote>Cable Management: Keep your cables organized and out of the way to avoid unnecessary clutter and to make troubleshooting easier.</blockquote><p><a href="https://kit.co/seif-mouihbi/tecnologia/beats-solo3-wireless"><em>CLICK HERE TO START BUILDING YOUR FUTURE ROOM NOW</em></a></p><blockquote>Inspiring Decor: Surround yourself with motivational quotes, artwork, or items that inspire creativity and a sense of passion for your work.</blockquote><blockquote>Version Control and Backup Systems: Implement a reliable version control system like Git to track your code changes. Additionally, set up automated backups for your projects to prevent data loss.</blockquote><blockquote>Comfortable Environment: Maintain a temperature-controlled room with good ventilation to ensure you’re comfortable throughout your work sessions.</blockquote><p>Collaborative Tools: Install software tools for project management, code collaboration, and communication, such as project management platforms, code repositories, and chat applications.</p><p>Remember, these suggestions are a starting point, and you can customize your developer room according to your preferences and needs. The goal is to create a space that promotes focus, creativity, and productivity while keeping you comfortable during long coding sessions.</p><p><a href="https://kit.co/seif-mouihbi/tecnologia/beats-solo3-wireless">CLICK HERE TO START BUILDING YOUR FUTURE ROOM NOW</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d70f68a8bd0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Construyendo una sala especial para desarrolladores con los mejores materiales”]]></title>
            <link>https://medium.com/@mouihbiseif/construyendo-una-sala-especial-para-desarrolladores-con-los-mejores-materiales-99e62c367bc0?source=rss-29e624a8d1cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/99e62c367bc0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[room-decor]]></category>
            <category><![CDATA[developer-tools]]></category>
            <dc:creator><![CDATA[seif mouihbi]]></dc:creator>
            <pubDate>Tue, 09 May 2023 00:41:28 GMT</pubDate>
            <atom:updated>2023-05-09T00:42:18.828Z</atom:updated>
            <content:encoded><![CDATA[<p>Por supuesto, aquí tienes un artículo en español sobre cómo construir una sala especial para desarrolladores con los mejores materiales:</p><p>Desarrollar software es una tarea compleja que requiere mucha concentración y atención a los detalles. Es por eso que muchos desarrolladores prefieren tener una sala de trabajo dedicada para asegurarse de que su espacio de trabajo sea óptimo para su productividad y rendimiento. En este artículo, exploraremos cómo construir una sala especial para desarrolladores con los mejores materiales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jC8hyMpwGPO4WeLBZhSceA.jpeg" /></figure><p><a href="https://kit.co/seif-mouihbi/tecnologia">HAZ CLIC AQUÍ PARA EMPEZAR A CONSTRUIR AHORA TU FUTURA HABITACIÓN</a></p><ol><li>Aislar el ruido: Los desarrolladores necesitan un espacio tranquilo y libre de distracciones para poder trabajar eficientemente. Para lograr esto, es importante que la sala esté aislada del ruido externo. Se recomienda instalar paredes insonorizadas y una puerta sólida para minimizar el ruido del exterior.</li><li>Buena iluminación: Una buena iluminación es esencial para los desarrolladores, ya que necesitan ver claramente las pantallas de sus computadoras. Es importante tener una iluminación adecuada en la sala, preferiblemente una luz blanca y brillante que no cause fatiga ocular.</li><li>Escritorio amplio y ergonómico: Los desarrolladores suelen pasar largas horas sentados frente a sus computadoras, lo que puede ser perjudicial para su salud si no tienen un espacio ergonómico y cómodo. Se recomienda tener un escritorio amplio y ajustable en altura para que los desarrolladores puedan trabajar de manera cómoda y saludable.</li></ol><p><a href="https://kit.co/seif-mouihbi/tecnologia">HAZ CLIC AQUÍ PARA EMPEZAR A CONSTRUIR AHORA TU FUTURA HABITACIÓN</a></p><p>4. Sillas de alta calidad: Las sillas de oficina son uno de los elementos más importantes de una sala de trabajo para desarrolladores. Es esencial que las sillas sean cómodas y ergonómicas, y estén diseñadas para apoyar la columna vertebral y reducir la fatiga.</p><p>5. Computadoras de alta calidad: Por último, pero no menos importante, es fundamental contar con computadoras de alta calidad que puedan soportar las exigencias del trabajo de desarrollo de software. Se recomienda invertir en computadoras de alta gama con procesadores potentes, una cantidad adecuada de RAM y almacenamiento, y una tarjeta gráfica dedicada.</p><p><a href="https://kit.co/seif-mouihbi/tecnologia">HAZ CLIC AQUÍ PARA EMPEZAR A CONSTRUIR AHORA TU FUTURA HABITACIÓN</a></p><p>En resumen, para construir una sala especial para desarrolladores con los mejores materiales es importante considerar la insonorización de la sala, una buena iluminación, un escritorio ergonómico y amplio, sillas de alta calidad, y computadoras de alta calidad. Al invertir en estos elementos, los desarrolladores pueden trabajar de manera más eficiente y productiva, lo que se traducirá en un mejor rendimiento y resultados de alta calidad en sus proyectos de desarrollo de software.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99e62c367bc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>