Skip to content

This application, provides a showcase of using NASA's APOD (Astronomic Picture of The Day) API for for show awesome pictures of the universe, made with Dart/Flutter πŸ’™

Notifications You must be signed in to change notification settings

WillACosta/flutter_nasa_apod_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

@flutter_nasa_apod_app

This application provides a showcase of using NASA's APOD (Astronomic Picture of The Day) API to show awesome pictures of the universe, made with Dart/Flutter πŸ’™. Here you'll find concepts such as Clean Architecture, Clean Code, SOLID, and other things related to the best coding practices.


Screenshot showing app pages



Features and Architecture

The project has only one main feature called: :feature_media, which holds the business rule for retrieving media items from NASA's Open API and handling the results accordingly. You can find out more details in the next section.

An image of app feature flow

App Modularization Guide

This project uses a modularization approach with mono-repo, to organize and breaking the concept of monolithic into loosely coupled, self-contained modules.

A module graph of project

Here we have the following types of modules:

  • The app module - is the main entry point for the app and contains some app-level configuration.

  • feature modules - contains specific modules which have a single responsibility and it follows Clean Architecture's approach.

  • core modules - common library modules and specific dependencies that need to be shared between other modules in the app. These modules can be dependent on another core modules, but they shouldn’t depend on feature or app modules.

All these modules are managed by Melos CLI, with this tool, we have more control over the dependencies in the entire project and we able to execute common tasks in all modules at the same time -- know more about Melos here. You can find, some scripts that are used by the project on melos.yaml file in the root directory.

As mentioned above, the project uses a mono-repo approach to organize all the modules, this means that all the necessary modules exist inside this repository. As you can see below:

.
β”œβ”€β”€ apps
β”‚Β Β  └── apod
β”‚
β”œβ”€β”€ packages
β”‚Β  β”œβ”€β”€ core
β”‚Β  β”œβ”€β”€ feature
β”‚Β  └── ui
β”‚
└── melos.yaml

Technical Resources

  • Usage of a simple state management with Value Notifier
  • Clean architecture, SOLID, and mono-repo concepts
  • Usage of package Result for handling errors and success cases
  • Lazy Loading for Infinity Scroll
  • Offline storage with Shared Preferences (caching)
  • Usage of Google Fonts (Poppins) for custom UIs
  • CI workflow with GitHub Actions
  • Melos CLI for management of mono-repo packages

Getting Started

  1. First you need to set up Flutter SDK. The project uses FVM CLI to manage flutter versions.
  • Install FVM globally (macOS)
brew tap leoafarias/fvm
brew install fvm
  • Install the compatible version for this project, which you can find in this directory .fvm/fvm_config.json
fvm install 3.19.3
  • Set the installed version as global
fvm global 3.19.3
  • Add the Flutter SDK path in your terminal config file .zshrc or .bashrc
export PATH=$PATH:~/fvm/default/bin
  1. Clone this repository
git clone https://github.com/WillACosta/cloudwalk-mobile-test
  1. Install Melos CLI as a global package with:
dart pub global activate melos
  1. Use the following command to setup the application
melos bootstrap
  1. Go to the directory apps/apod and run the following command, to get a copy for .env file, and fill it with your credentials.
cd apps/apod
cp .env.example .env
## open the file and add your API KEY (Get on https://api.nasa.gov/)
  1. Now, you have to install Android and iOS SDK
  1. Open any available emulators and run the application with
flutter run

Running unit tests

  1. Run all tests
melos test

You can find more scripts to execute in melos.yaml file.

Usage of JSON Server

In the case of NASA's Open API is not available, you can use the Json Server for testing purposes.

  • First of all, you need to setup the NodeJS environment -- see here: https://nodejs.org/en/download

  • After that, navigate to the json-api directory: /api and run:

npx json-server database.json
  • Then you will need to change the APOD_BASE_URL from .env file, for using the local server address, for example:
http://localhost:3000

About

This application, provides a showcase of using NASA's APOD (Astronomic Picture of The Day) API for for show awesome pictures of the universe, made with Dart/Flutter πŸ’™

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published