elta AI - Emergency Planning App
This document provides an overview of the Eltaai application design and architecture, intended to help new developers get started with the project.
Introduction
Eltaai is a mobile application designed to assist users in creating and managing emergency preparedness plans. It allows users to plan trips, track activities, perform check-ins, manage emergency contacts, and maintain user profiles, enhancing their safety and preparedness.
Project Overview
Eltaai is a Flutter-based mobile application designed for emergency planning. It allows users to plan trips, track activities, perform check-ins, manage emergency contacts, and maintain user profiles. The goal is to provide users with a comprehensive tool to enhance their safety and preparedness during various activities and travels.
Main Features
- Trip Planning: Users can plan and manage their trips.
- Activity Tracking: Track activities during trips.
- Check-ins: Allow users to check in at various points, sharing their status.
- Emergency Contacts: Manage a list of emergency contacts who can be notified if needed.
- User Profiles: Users can create and manage their profiles with relevant information.
Architecture Overview
The Eltaai application follows a client-server architecture:
- Frontend: A mobile application built using the Flutter framework. This allows for a cross-platform codebase (iOS and Android) with a native look and feel.
- Backend: Powered by AWS Amplify, which provides a suite of tools and services for building scalable and secure cloud-based applications.
- Communication: The Flutter application interacts with the AWS Amplify backend via the Amplify SDK for Flutter. This SDK provides convenient methods for authentication, API calls (GraphQL), data storage, and more.
Backend Details (AWS Amplify)
The backend is built and managed using AWS Amplify, leveraging several AWS services:
- Authentication: User authentication is handled by Amazon Cognito. It supports email-based sign-up and sign-in, along with social providers (Facebook, Google, Apple). A Lambda function (
eltaaibe1483d2PostConfirmation
) is configured to run after user confirmation, potentially for custom logic like populating initial user data. - API: The application uses AWS AppSync to provide a managed GraphQL API. This allows the frontend to efficiently query and mutate data. The API is secured using Amazon Cognito User Pools and API Keys.
- Storage: Amazon S3 (Simple Storage Service) is used for storing user-generated content, such as profile pictures or other media files.
- Data Models: The application defines several data models (e.g.,
Activity
,CheckInLog
,EmergencyContact
,Profile
,Trip
) which are managed by Amplify DataStore. These models correspond to the GraphQL schema and enable offline data access and synchronization. You can find these model definitions inlib/models/
. - Lambda Functions:
eltaaibe1483d2PostConfirmation
: As mentioned, this function is triggered after a user confirms their sign-up.
Frontend Details (Flutter)
The frontend is a Flutter application with the following key characteristics:
- State Management: The application uses Riverpod for state management. Riverpod provides a flexible and scalable way to manage application state, making it easier to separate business logic from UI.
- Navigation: Navigation within the app is handled by the
go_router
package. This provides a declarative routing solution that integrates well with Flutter's widget tree. - Directory Structure: The
lib
directory is organized as follows:common/
: Contains shared widgets, services (likeAuthService
,StorageService
), navigation utilities, and constants.features/
: This directory houses the code for each specific feature of the application (e.g.,activity/
,checkin/
,profile/
,trip/
). Each feature typically has its own controllers, services (if specific to the feature), and UI components.models/
: Contains the data model classes generated by Amplify DataStore, representing the application's data structures.main.dart
: The main entry point of the application, responsible for initializing Flutter, Amplify, and setting up global listeners.trips_planner_app.dart
: Defines the root widget of the application, including theAuthenticator
andMaterialApp.router
.
- Key Dependencies: (Refer to
pubspec.yaml
for a full list)amplify_flutter
and related Amplify plugins: For interacting with the AWS Amplify backend.flutter_riverpod
: For state management.go_router
: For navigation.image_picker
,file_picker
: For handling file and image selection.intl
: For internationalization and date/time formatting.cached_network_image
: For efficiently loading and caching network images.timelines_plus
: For displaying timeline-based UIs.
Getting Started
Follow these steps to set up and run the Eltaai project locally:
Prerequisites
- Flutter SDK: Ensure you have the Flutter SDK installed. Refer to the official Flutter documentation for installation instructions.
- Amplify CLI: Install and configure the Amplify CLI. Follow the official Amplify CLI installation guide. You will need an AWS account.
- IDE: An IDE like VS Code with the Flutter and Dart plugins, or Android Studio.
Setup Steps
- Clone the Repository:git clone <repository_url>
cd eltaai(Replace<repository_url>
with the actual URL of your Git repository) - Install Flutter Dependencies:flutter pub get
- Configure Amplify Backend:
- Initialize Amplify in the project (if it's a fresh clone and the
amplify/
directory isn't fully set up or you need to connect to your own AWS account):amplify initFollow the prompts to connect to your AWS account and configure the backend environment. - If the project has an existing Amplify backend environment you want to connect to, pull the backend configuration:amplify pullThis will fetch the backend definition and generate the necessary
amplifyconfiguration.dart
file. You might need the Amplify App ID, which can be found in the AWS Amplify console.
- Initialize Amplify in the project (if it's a fresh clone and the
- Run the Application:This command will build and install the application on your target device/emulator.
- Ensure you have an emulator running or a device connected.
- Run the app using:flutter run
Contributing
We welcome contributions to Eltaai! If you'd like to contribute, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and ensure that the code lints and tests pass.
- Submit a pull request with a clear description of your changes.
License
Eltaai is licensed under the MIT License. See the LICENSE
file for more information.
Building and Testing
Building for Release
To build the application for release, refer to the official Flutter documentation:
Remember to increment the version number in pubspec.yaml
and follow platform-specific guidelines for code signing and app store submission.
Testing
- Unit Tests: Place your unit tests in the
test/
directory. You can run them using:flutter testThe project includes some example widget tests intest/widget_test.dart
and a specific test intest/profile_fallback_test.dart
. - Integration Tests: For integration tests, refer to the Flutter integration testing guide.
- Amplify Mocking: For testing backend interactions, the Amplify CLI provides mocking capabilities. See Amplify Mocking for more details.