DEV Community

Cover image for Build a food delivery app by only using open source tools
aldin for developuls

Posted on

Build a food delivery app by only using open source tools

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 🤣.

Hungry cat

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).

Happy doggo eating

What type of app would you like me to cover next?
I was thinking of a local trail maps app.

Top comments (3)

Collapse
 
kiselitza profile image
aldin

What else?!?!

Well, to further improve an app like this one, there are additional components that can be integrated to make it more robust, secure, etc.

Rate Limiting & Web Security:
Implementing rate limiting and security measures is crucial to ensure the app isn’t vulnerable to overloading or attacks. Tools like OpenResty can provide rate limiting and security features, while ModSecurity acts as a web application firewall (WAF) to safeguard the app from common web vulnerabilities.

Search and Recommendations:
For more complex use cases, you might want to add a search feature, especially when the list of restaurants or dishes grows. MeiliSearch is a fast, open-source search engine that can handle this efficiently. You could also use PredictionIO to build a recommendation engine for personalized user experiences.

User Analytics:
Tracking user interactions helps improve engagement and retention. Tools like PostHog provide actionable insights into user behavior, which can be key to optimizing your app.

A/B Testing:
Experimenting with different layouts, workflows, or features can help optimize the app’s user experience. GrowthBook is an open-source A/B testing framework that can assist in running such experiments.

Continuous Integration/Continuous Delivery (CI/CD):
Automating deployment is essential to ensure smooth, error-free releases. Jenkins can handle these pipelines effectively, making it easier to roll out updates without downtime.

Here’s the list of tools with their corresponding GitHub repository URLs:
OpenResty: github.com/openresty/openresty
ModSecurity: github.com/SpiderLabs/ModSecurity
MeiliSearch: github.com/meilisearch/MeiliSearch
PredictionIO: github.com/apache/predictionio
PostHog: github.com/PostHog/posthog
GrowthBook: github.com/growthbook/growthbook
Jenkins: github.com/jenkinsci/jenkins

Collapse
 
fastbuka profile image
FastBuka

Thank you very much. We at fast buka are currently working on a food delivery app with a blockchain payment gateway.

Collapse
 
kiselitza profile image
aldin

Happy to help, best of luck in getting your app out there. :)