Building a marketplace app requires balancing user experience with robust backend architecture. For MetaAgro, an agricultural marketplace targeting farmers in India, the goal was to create a platform that allowed farmers to easily list their products and manage orders alongside a dedicated access mode for company employees.
I chose Flutter for the mobile frontend to ensure a consistent experience across Android and iOS platforms from a single codebase. For the backend, Firebase was the natural choice, providing authentication, data storage, and file hosting out of the box.
Gathering Requirements
The core requirements for the app included:
- Phone number authentication to simplify onboarding for farmers.
- A comprehensive first-time setup flow to capture profile details, farm locations, and product offerings.
- A dashboard featuring My Farm, Orders, and the Marketplace.
- Offline capabilities and local preferences for low-connectivity environments.
- An Employee Hub for staff to access current device locations and upload geo-tagged images directly to Firebase Storage.
Architecture & Tech Stack
The app is built entirely with Flutter. It utilizes firebase_auth for secure phone-based authentication, cloud_firestore for scalable NoSQL data storage, and firebase_storage for managing images and multimedia assets.
Localization is managed directly through Flutter's gen-l10n tools, crucial for an app serving a diverse regional demographic. Adding support for local languages ensures the app feels native and accessible to every farmer.
Employee Mode and Firebase Integration
One interesting challenge was handling two distinct user personas within the same app: Farmers (Buyers/Sellers) and Employees. During the sign-in phase, the app offers an Employee mode.
When an employee signs in, they are directed to an exclusive Employee Hub. This hub integrates platform-specific location permissions (like ACCESS_FINE_LOCATION for Android and NSLocationWhenInUseUsageDescription for iOS) to capture precise farm locations and tag uploaded images accurately.
Iterating on the Product Schema
As the business evolved, the product schema had to adapt. Initially, generic structures sufficed, but eventually, specific product requirements—like pricing mangoes per 3.5 kg packs—had to be mirrored directly from the organization's existing web platforms into the app's Firestore schema.
Testing and Quality Assurance
Maintaining quality in a fast-paced environment meant relying on Flutter's built-in testing tools. Running flutter analyze and flutter test frequently helped catch UI regression and state management bugs early. By keeping the codebase clean, upgrading Flutter SDK versions (like a major migration in June 2026) became a much smoother process.
Lessons Learned
- Platform Permissions: Handling location and gallery permissions requires careful attention to platform-specific guidelines.
- Schema Flexibility: Design your Firestore schemas to be flexible early on. Business rules, like pricing models, change frequently.
- Localization First: Implementing
l10nfrom the beginning is vastly easier than retrofitting it into an app later.