Skip to content
/ meli Public

Meli Android app built with p2panda for decentralised and offline-first collaboration

License

Notifications You must be signed in to change notification settings

p2panda/meli

Repository files navigation

meli 🐝

Meli Android app built on top of p2panda

This Android app is a collaborative database for sighting and categorisation of Meliponini bee species in the Brazilian Amazon. This project is a collaboration between p2panda and Meli. The app runs a full p2panda node and allows decentralised and offline-first collaboration among users, it is developed with Flutter and uses the p2panda SDK for its p2p functionalities.

Development

This is a Melos mono-repository managing both the Android application source-code and "external" Dart and Flutter libraries providing all p2panda functionality via FFI bindings.

Requirements

Listed versions are the ones we used successfully in our developer environments, other versions might work well too.

⚠️ The exact NDK version is required.

Setup

# Install all Dart dependencies, make sure you've installed melos globally
dart pub get

# Bootstrap your Melos environment
melos bs

Code-Checks

# Check code style and correctness
melos analyze

# Format code according to guidelines
melos format

Release

To configure the release to connect to a relay node you will need to set RELAY_ADDRESS, without it the app will only discover other peers via mDNS on a local network.

Optionally you can also set a Pre-Shared Secret via PSK to connect to a network protected by a shared secret.

Lastly you might want to distinct between normal and qa release flavors to distinct "staging" releases from "production" ones.

# Build and obfuscate releases for all architectures
PSK="<secret>" FLAVOR=normal RELAY_ADDRESS=203.0.113.0:2022 melos release

FFI packages

To bring p2panda-rs and aquadoggo into a native Android environment we're utilising flutter_rust_bridge which automatically generates Dart code with FFI bindings from Rust.

The code resides in:

Use the following commands for FFI package development:

# After changing the Rust code in `packages/p2panda/native` re-build the
# library. This automatically installs Android compilation targets and the
# cargo-ndk tool if missing.
#
# Additionally this script moves the native android libraries into the `app`
# folder, where they are needed.
melos build

# Bump the package versions for release (we're not releasing yet).
melos version

Flutter App

It is recommended to develop or run the project with Android Studio or with the flutter-cli command line tool.

Here are some examples on how to run the app using the Flutter command line tool:

⚠️ Setting a "Flavor" is required to build and run the .apk, either as a flutter command line argument or as a build configuration in Android Studio (Edit Configurations > Build Flavor).

# Manage emulators
flutter emulators

# Launch an emulator
flutter emulators --launch <id>

# List all device ids (emulated or physical)
flutter devices

# Run app on emulated or connected device
flutter run --flavor normal --device-id <id>

Relay Node

To configure your app to connect to a relay node you will need to set RELAY_ADDRESS with the correct ipv4 address and port number via an environment variable or the command line like so.

flutter run --dart-define=RELAY_ADDRESS=203.0.113.0:2022

Schema

The p2panda schemas and migrations are managed in the schemas folder with the fishy command line tool.

License

GNU Affero General Public License v3.0 AGPL-3.0-or-later

Supported by



This project has received funding from the European Union’s Horizon 2020 research and innovation programme within the framework of the NGI-POINTER Project funded under grant agreement No 871528

About

Meli Android app built with p2panda for decentralised and offline-first collaboration

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages