AZT is a cutting-edge Flutter application designed to provide a seamless e-commerce experience across Web, Android, and iOS. Built with a robust modern tech stack, it features a feature-first architecture, role-based access control (Customer, Retailer, Wholesaler), and a fully integrated Firebase backend.
- Cross-Platform Support: Runs natively on Android, iOS, and the Web.
- Role-Based Access: Distinct dashboards and functionalities for Customers, Retailers, and Wholesalers.
- Secure Authentication: Email/Password and Google Sign-In via Firebase Auth.
- Real-Time Data: Instant updates using Firebase Cloud Firestore and Realtime Database.
- Progressive Web App (PWA): Installable web experience with offline capabilities.
- Automated CI/CD: Fully automated deployment pipeline to GitHub Pages.
- Flutter: SDK version
^3.9.2for building natively compiled applications. - Dart: The language powering the application.
- Flutter Bloc: The application utilizes the BLoC (Business Logic Component) pattern using the
flutter_blocpackage. - Cubits: Specifically,
AuthCubithandles the entire authentication flow, including state emissions forAuthenticated,Unauthenticated,RoleNotSelected, andEmailNotVerified.
- Firebase Auth: Manages user sessions and identity (Google & Email providers).
- Cloud Firestore: Stores user profiles, role data, and persistent application state.
- Realtime Database: utilized for high-frequency data updates.
The project follows a Feature-First Architecture combined with the Repository Pattern to ensure separation of concerns and scalability.
- Features Directory: Code is organized by feature (e.g.,
auth,home,retailer) rather than layer. - Repository Pattern:
- Data Layer:
FirebaseAuthRepohandles direct communication with Firebase. - Domain Layer: Cubits interact with Repositories to fetch data, keeping UI logic clean.
- Dependency Injection:
MultiRepositoryProviderandMultiBlocProviderinject dependencies at the root of the app.
- Data Layer:
The web build is configured as a Progressive Web App, providing an app-like experience in the browser.
- Manifest Configuration: The
manifest.jsonis configured with standalone display mode, theme colors, and maskable icons for optimal display on all devices. - Assets: Includes high-resolution icons for various viewports.
To handle email notifications securely and efficiently without incurring cloud function costs, the application employs a custom solution.
The application uses a Python-based email proxy server to send order status notifications. This proxy is necessary to bypass CORS restrictions and to avoid using paid cloud functions, when sending emails from the Flutter web client. This server can be run on cheap and minimal equipment such as Raspberry PI 3B/4 with a functioning internet connection, thus, making the project host for anyone.
The client-side implementation (MailService) intelligently switches localhost addresses based on the platform (Android Emulator vs. iOS Simulator vs. Web) to communicate with this proxy.
The project utilizes GitHub Actions for Continuous Integration and Deployment.
- Workflow: Defined in
.github/workflows/deploy-to-gh-pages.yml. - Automation:
- Triggers on push to the
mainbranch. - Sets up the Flutter environment and enables web support.
- Builds the Flutter web application in release mode (
flutter build web --release). - Handles SPA (Single Page Application) routing by copying
index.htmlto404.html. - Deploys the build artifacts directly to the
gh-pagesbranch.
- Triggers on push to the
-
Clone the repository:
git clone [https://github.com/yourusername/azt.git](https://github.com/yourusername/azt.git) cd azt -
Install Dependencies:
flutter pub get
-
Run the Python Proxy Server: Ensure your Python environment is set up and run the server script (not included in this snippet) to handle email requests.
-
Run the App:
- Web:
flutter run -d chrome - Mobile:
flutter run(ensure an emulator or device is connected)
- Web: