Just a quick TL;DR behind this one;
Imagine this: Like myself, you’re hungry. You grab your phone and open a food delivery app, ready to order your favorite dish.
It's quite common, we've all been there.
But how easy would it be to build one, using primarily open-source software for its logic? Let's see!
P.S. Do NOT build your own app while hungry.
P.P.S. There are plenty of OSS alternatives to some of the solutions I will mention here. For simplicity, I will use different ones across different articles.
P.P.P.S. Unless some of them put me on a retainer or something. Then I really can't 🤣.
Let's quickly dissect this kind of app, and extrapolate the basic building blocks and features. Excluding the core business logic, here’s a breakdown of the logical components of most food delivery apps.
Identity: Logging In
The first thing you see is a login screen. You don’t want to remember another password, so you opt for a quick passwordless login. Behind the scenes, SuperTokens can handle the authentication process, allowing you to log in securely without the hassle of passwords. It also manages sessions, ensuring your login remains active while protecting your data.
Access Control
Once logged in, your user role is verified. Whether you're a customer, driver, or restaurant owner, Permify can ensure you have access to the right features based on your role.
Browsing Restaurants
Now you’re scrolling through restaurants. All of this data — restaurant details, menus, ratings — can be stored in PostgreSQL, a powerful relational database. PostgreSQL handles complex queries, such as finding restaurants near your location or showing only those that are currently open. It ensures that your search results load quickly and are accurate.
Making a Payment
You select your meal, customize it, and proceed to payment. Here, Lago can step in, and handle billing and payments. Lago makes it easy to manage one-off payments and subscriptions (think meal plans) while integrating seamlessly with various payment gateways. You can save your payment details securely, and Lago ensures smooth payment processing.
Real-Time Notifications
As your order is confirmed, notifications start rolling in — your order is being prepared, your driver is on their way. This real-time magic could be powered by Apache Kafka for message queuing and AirNotifier for delivering push notifications to your phone. Kafka ensures that these notifications are sent reliably, and AirNotifier takes care of sending them via push notifications, SMS, or email.
Chatting with the Driver
Need to message the driver about a specific delivery note? The app’s built-in chat system, which could be powered by Rocket.Chat, allows you to communicate in real time. Rocket.Chat facilitates this interaction, making sure your messages are delivered quickly and reliably.
Tracking Your Delivery
If you're impatient like me, and every hungry person ever, you’ll be eager to see where the driver is. The app shows a live map of your driver’s location, which can be powered by OpenStreetMap and Mapbox. OpenStreetMap provides free, detailed map data, while Mapbox handles the real-time display and interaction. Together, they offer an open-source alternative to Google Maps, giving you a clear view of your delivery’s progress.
Speeding Things Up with Caching
To make sure the app runs fast, and not frustrate the hungry bunch, frequently accessed data like the list of restaurants or order histories can be stored in Redis. Redis acts as an in-memory cache, drastically reducing database load and improving the app’s response time.
Messaging in the Background
When you place an order, multiple tasks are triggered in the background — sending notifications, processing payments, and updating restaurant inventories. RabbitMQ can handle this asynchronous communication, ensuring that all these tasks happen reliably without blocking your main app experience.
Delivering Content Fast
Finally, within this setup, to make sure images, menus, and other static content load quickly, the app can utilize Caddy and MinIO. Caddy acts as a web server with automatic HTTPS, and MinIO handles object storage, serving images and other assets from locations close to the user to reduce load times.
This could be your architecture for an end-to-end food delivery app in your local area. The rest is:
1) picking the stack for your business logic,
2) integrating it all together,
3) polishing the visuals,
#) adding additional complexities (check the comment section).
What type of app would you like me to cover next?
I was thinking of a local trail maps app.