eliud_core 1.0.7+1 eliud_core: ^1.0.7+1 copied to clipboard
Eliud core
eliud #
Documentation for eliud is under construction. Please be patient.
- Eliud technology is open source technology.
- The technology allows to build apps and/or websites. Today, app content can include photo galleries, pages with videos and images (html), social media, chat with or between members, your shop / shopping cart, photo sliders, documents, and more. A complete list below.
- Eliud is a layer on top of Flutter. Flutter is an open-source UI software development kit created by Google. Flutter allows to develop cross platform applications for iOS, Android and web. Flutter supports Linux, macOS, Windows and Google Fuchsia. This hasn't been tested with eliud packages yet.
- For those who know Worpress: Eliud is to Flutter as Wordpress is to html:
- Html allows you to construct webpages. However, html requires some level of technical knowledge about building webpages.
- Wordpress and many other similar technologies allow people without knowledge of html to build webpages and websites.
- Flutter allows to build websites and apps, or even Windows, Linux, macOS and Google Fuchsia apps. However, Flutter requires programming skills and technical knowledge.
- Eliud allows people without programming skills and technical knowledge to build cross platform apps and websites.
- Html allows you to construct webpages. However, html requires some level of technical knowledge about building webpages.
- Eliud is pluggable technology, allowing developers
- to extend / add functionalities by means of plugins / packages.
- to change look and feel through using styles.
- A website / app built with Eliud consist of its core Eliud package + one or more Eliud plugins. The app is constructed by configuring it. Configuration, images and videos are stored in Firebase database and Firebase storage.
Example Eliud apps #
These are some example apps which demonstrate what eliud can give you. Everything used is open source, part of eliud project.
App | Ios | Android | Web | |
---|---|---|---|---|
Juuwle - An online store for jewels | Juuwle on the App Store | Juuwle on Google Play | https://juuwle.net | |
Minkey - Community making apps online | This type of app is not allowed on apple store | Minkey on Google Play | https://minkey.io | |
Thoma5 - Profile of Thomas. Under construction | In development | In development | https://thoma5.com |
I. Quick start #
This guide are all steps to create a minimum android, iOS or web app with Eliud.
Whenever this pops up, make note of this for what this is in your case, as you'll need it at some later stage. In the below text we provided this information whilst creating thoma5. Obviously for sensitive information, like passwords, we've provided fake info. |
Step 1: Create a new google account #
- Goto https://www.google.com/account/about/
- Select "Create an account"
- Follow on screen instructions (recommended to use default settings)
|
Step 2: Create a new firebase project #
- Goto https://console.firebase.google.com
- Select "Create a project"
- And follow on screen instructions (recommended to use default settings)
|
Step 3: Configure your project #
- Goto https://console.firebase.google.com
- Select your project
- Select Project Overview > Project settings
- Select support email. Use your google account
Step 4: Setup Firebase database #
-
Select your project
-
Select Build > Firebase database
-
Select "Create database"
-
And follow on screen instructions (recommended to use default settings, start in production mode)
-
With Cloud Firestore open, click on Rules and copy/paste the contents of firestore.rules and publish.
For convenience, and to familiarise yourself with firebase, at this point we copy/paste these rules. However, later we will upload the same rules more efficiently using firestore commands from command line
Step 5: Setup Firebase storage #
-
Select your project
-
Select Build > Storage
-
Select "Get started"
-
And follow on screen instructions (recommended to use default settings, start in production mode)
-
With Storage open, click on Rules and copy/paste the contents of storage.rules and publish.
For convenience, and to familiarise yourself with firebase, at this point we copy/paste these rules. However, later we will upload the same rules more efficiently using firestore commands from command line
-
With storage page open, retrieve your "bucket" from the url. You bucket is the bit in front of ".appspot" in the url. In our case the url is https://console.firebase.google.com/project/thoma5/storage/thoma5.appspot.com/files, hence the bucket is thoma5
|
Step 6: Setup Google Authentication #
- Goto https://console.firebase.google.com
- Select your project
- Select Authentication
- Select Sign-in method
- Select Google from Sign-in providers
- Enable the Google sign-in
Step 7: Generate key #
- Run the following command at command prompt:
keytool -genkey -v -keystore your_keystore_filename -storepass your_keystore_storepass -alias your_keystore_alias -keypass your_keystore_keypass -keyalg RSA -keysize 2048 -validity 36524
-
Then follow onscreen instructions. Then store the key-file in a safe place. You will have to use it multiple times in the future.
-
Now run:
keytool -list -v -alias your_keystore_alias -keystore your_keystore_filename -storepass your_keystore_storepass -keypass your_keystore_keypass
For example:
keytool -genkey -v -keystore %USERPROFILE%\\.android\\thoma5.keystore -storepass abc -alias thoma5key -keypass cde -keyalg RSA -keysize 2048 -validity 36524
keytool -list -v -alias thoma5key -keystore %USERPROFILE%\\.android\\thoma5b.keystore -storepass abc -keypass cde
|
MORE INFO
- https://developers.google.com/android/guides/client-auth
- https://coderwall.com/p/r09hoq/android-generate-release-debug-keystores
Step 8: Add Firebase Android App #
- Goto https://console.firebase.google.com
- Select your project
- Click 'Add app' and select platform 'Android'"
- Specify your android package name
- Specify your android app nickname
- Paste the SHA-1 key Your keystore SHA1
- Press "Register app"
- Then download the file google-services.json
|
Step 9: Create Android Studio project #
-
Start Android studio
-
Select File > New > New Flutter Project
-
Specify
- Flutter SDK path and press Next
-
Specify
- Project name: e.g. thoma5_app
- Project location: e.g. C:\src\apps\thoma5_app
- Description: e.g. Thoma5 app
- Project type: Should be "Application"
- Organization: e.g. com.thoma5
- Android language: Should be Java
- iOS language: Should be Swift
- Platforms: Should be Android, iOS and Web
❗ IMPORTANT ❗
The android package name specified as Your Android app package name - e.g. com.thoma5.thoma5_app - should be equal to the concatenation of organisation - e.g. com.thoma5 - a dot and the project_name - e.g. thoma5_app
-
Press finish
|
Step 10: Copy google_services.json #
- Switch to the Project view in Android Studio to see your project root directory.
- Move your downloaded google-services.json file into your module (app-level) root directory, e.g. thoma5_app/android/app
Step 11: Apply firebase SDK instructions #
- Goto https://console.firebase.google.com
- Select your project
- Find your app from "your apps" section, then press "See SDK instructions"
- You get to chance to re-download the google_services.json file, skip this by pressing next.
- Now apply the suggestions provided. Make sure to select Groovy (build.gradle) and Java.
🤔
At the time of writing this document, the changes to make were:
file | location | add |
---|---|---|
1️⃣ thoma5_app/android/build.gradle | buildscripts > dependencies | classpath 'com.google.gms:google-services:4.3.15' |
2️⃣ thoma5_app/android/app/build.gradle | plugins | id 'com.google.gms.google-services' |
:three: Finally the below at the bottom of thoma5_app/android/app/build.gradle had to be added
dependencies {
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
}
Step 12: Add key store file to your project #
-
Create key.properties file in your android directory, e.g thoma5/android/key.properties
-
Populate it with the below keys and values as below. Find your values specified before (follow the links)
- storeFile=Your keystore filename
- storePassword=Your keystore storepass
- keyPassword=Your keystore keypass
- keyAlias=Your keystore alias
e.g.
storePassword=abc keyPassword=cde keyAlias=thoma5key storeFile=c:/Users/thomas/.android/thoma5.keystore
-
Add the following lines to your android apps build.gradle file, e.g. thoma5/android/app/build.gradle
- Load the properties
plugins { ... } // add this after plugins def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } // the rest of the file ...
- Use the keystore for signinConfigs
android { defaultConfig { ... } // add this after defaultConfig and before buildTypes signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } buildTypes { ... } }
- Make sure your buildTypes is pointing to the releasing signingConfigs for both debug and release builds
buildTypes { release { signingConfig signingConfigs.release } debug { signingConfig signingConfigs.release debuggable true } }
Step 13: Update pubspec.yaml #
- Update you pubspec.yaml file to reflect the below
---
name: thoma5_app
description: Thoma5
homepage: https://thoma5.com
repository: https://github.com/eliudio/thoma5_app
version: 1.0.0
environment:
sdk: '>=3.1.0 <4.0.0'
flutter: '>=3.0.0'
dependencies:
flutter:
sdk: flutter
eliud_core: ^1.0.6+1
eliud_pkg_create: ^1.0.7+1
eliud_stl_mona: ^1.0.1+6
dev_dependencies:
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
and press Pub get
Step 14: Update main.dart #
- Replace your main.dart with these contents.
import 'package:eliud_core/eliud.dart';
import 'package:eliud_core/style/_default/default_style_family.dart';
import 'package:eliud_core/core_package.dart';
import 'package:eliud_pkg_create/creator_package.dart';
import 'package:eliud_pkg_create/tools/basic_app.dart';
import 'package:eliud_pkg_text/text_package.dart';
import 'package:eliud_stl_mona/mona_stl_package.dart';
import 'package:eliud_pkg_create/creator_decoration.dart';
import 'package:eliud_stl_mona/mona_style_family.dart';
import 'package:flutter/cupertino.dart';
import 'package:firebase_core/firebase_core.dart';
Future<void> main() async {
String APP_ID = "THOMA5_APP";
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
var eliud = Eliud();
try {
eliud.registerPackage(CorePackage.instance());
eliud.registerPackage(TextPackage.instance());
eliud.registerPackage(MonaStlPackage.instance());
eliud.registerPackage(CreatorPackage.instance());
// register decorations, these are only required if you want to be able to change your app through the interface
eliud.registerDecoration(CreatorDecoration());
// register style families
eliud.registerStyleFamily(MonaStyleFamily.instance());
eliud.registerStyleFamily(DefaultStyleFamily.instance());
// finish init
eliud.finalizeInitialisation();
} catch (exception) {
throw Exception("Exception whilst initialising the app");
}
// create the app if it doesn't exist
await BasicApp.checkApp(APP_ID);
// let's go !
eliud.run(APP_ID, false);
}
Step 15: Clean up #
- Delete the directory test, which contains widget_test.dart
Step 16: minSdkVersion #
-
Goto your Flutter SDK path, subdirectory packages\flutter_tools\gradle\src\main\groovy and edit the file flutter.groovy and open it
-
Update the value for minSdkVersion to be 21
class FlutterExtension { ... /** Sets the minSdkVersion used by default in Flutter app projects. */ static int minSdkVersion = 21 ... }
❗ REMARK ❗
We only need to make this change to the minSdkVersion for the SDK 1 time, i.e. do not repeat this step for future projects / apps.
Step 17: Run your app #
- Run the app. Because this is the first time your start the app, it will install a basic app.
- When the app asks to choose an account to login, select your google account
- Ones the basic app is created, it will open
Step 18: Add some basic functionality to your app #
- After you've started your app in the previous step, a "Hello world" screen should appear.
- Press the pen icon to toggle editing mode on
- When in edit mode, press the wizard icon to open the wizard dialog box
- We have only activated a few packages in the code (using eliud.registerPackage), so hence not many wizards are initially available.
- Select signinbutton and press Go!
- Then select signoutbutton and press Go!
Next steps #
In the previous steps we've done the foundation to build an app. The next steps introduces
- platforms: web deployment, apple app
- authentication
- a brief overview of the current base packages
- functions to support packages
- deployment: deploying to google play store and apple app store,
Step 19: Logo #
-
create a logo and store into a file in your project directory, e.g. assets/logo/thoma5-logo-1.png
-
add the below to pubspec.yaml
dev_dependencies:
flutter_launcher_icons: ^0.13.1
flutter_icons:
android: launcher_icon
ios: false
image_path: assets/logo/thoma5-logo-1.png
- Run the below from your
flutter pub run flutter_launcher_icons:main
Step 20: Add Firebase Web App #
- Goto https://console.firebase.google.com
- Select your project
- Click 'Add app' and select platform 'Web'"
- Provide an App nickname, e.g. Thoma5
- Select Firebase Hosting.
- Select your project from the drop down box.
- Click on Register app.
- From the Hosting dashboard, find the "Add custom domain" button and add
- thoma5.com
- www.thoma5.com, and configure to redirect to thoma5.com
DNS records
|
Step 21: Buy domain #
-
Buy a domain name, e.g. on squarespace.com.
-
Setup email forwarding
- from info@thoma5.com
- to: your google account
|
- Follow the guidelines of your domain registrar to configure your DNS in line with the DNS records specified in the firebase hosting dashboard.
Example 1: domains.google.com #
- Login into your account on https://domains.google.com
- Select "DNS"
- Select "Manage custom records"
- Create new records with the below information
Host name/td> | Type | TTL | Data |
_acme-challenge | TXT | N/A | aBcdE1FghIj23k4lmnoPqrstUvw5xyZabcdeF6GHiJk |
A | N/A | 123.123.123.123 | |
TXT | N/A | hosting-site=thoma5 | |
www | CNAME | N/A | thoma5.web.app |
Example 2: squarespace.com #
For squarespace, for thoma5.com, this would the be done following these steps:
- Login into your account on https://www.squarespace.com/
- Select your domain from your domains and select "Manage domain settings"
- Edit DNS
- Add the below records
Host | Type | Priority | Data |
_acme-challenge | TXT | N/A | aBcdE1FghIj23k4lmnoPqrstUvw5xyZabcdeF6GHiJk |
@ | A | N/A | 123.123.123.123 |
@ | TXT | N/A | hosting-site=thoma5 |
www | CNAME | N/A | thoma5.web.app |
MORE INFO
- Step 22: Subscribe to mailtrap #
- Subscribe
- Update dns
- Get token
- mailtrap token: a1bc234d5e6f7890123ghij45678k901
Step 23: Update firebase #
In this step we wil be updating / uploading:
- storage rules
- firestore indexes and rules
- functions
We have uploaded rules in previous steps during the quick start. That was to get up and running quickly. The proper way to update rules is by using the firebase command line tools, which we will do in this step.
Step 23.1: Install firebase command line tools #
- Open cmd
- Run npm install -g firebase-tools
Step 23.2: Enable APIs #
- Goto https://cloud.google.com/build/docs/deploying-builds/deploy-firebase
- Click "Enable the APIs"
- Follow on screen instructions
Step 23.3: Enable firebase functions #
- Goto https://console.firebase.google.com
- Select your project
- Select functions
- Press "Get started" and select next
Step 23.4 Update firebase #
- Run the below (change firebase project and storage bucket to yours)
mkdir c:\src\apps\thoma5_app_firebase cd c:\src\apps\thoma5_app_firebase git clone https://github.com/eliudio/firebase.git cd c:\src\apps\thoma5_app_firebase\firebase firebase logout firebase login firebase functions:config:set mailtrap.token=a1bc234d5e6f7890123ghij45678k901 mailtrap.sender.email=info@thoma5.com mailtrap.sender.name=Thoma5 app.appname="Thoma5" app.collectionname="order" app.bucket="thoma5" stripe.secret=lalalala --project "thoma5" firebase deploy --project thoma5
Where...
mailtrap.token mailtrap token mailtrap.sender.email info@thoma5.com mailtrap.sender.name Thoma5 app.collectionname order app.bucket storage bucket project firebase project ❗ NOTES ❗
-
You can use quotes to specify parameters. E.g. You could use sendgrid.apikey="NO KEY"
-
In the rules, indexes and functions we cover ALL packages that currently exist. If you only use some packages, then these obsolete rules, indexes and functions could be considered obsolete. However, they're harmless being there and it's the easiest way to get going.
-
When you require your own functions, we recommend to organise multiple functions as described here: https://firebase.google.com/docs/functions/organize-functions?gen=2nd
Step 24: Enable APIs #
- Enable People API: https://console.developers.google.com/apis/api/people.googleapis.com
Step 25: Configure oauth web client #
- Goto https://console.cloud.google.com/apis/credentials
- Find the OAuth 2.0 Client IDs with name "Web client". If you find more than one, select any, e.g. the first.
- Find the "ADD URI" and add these domains:
- Find "web client" and copy the client ID
- Press SAVE
- Web client ID: x-y.apps.googleusercontent.com
Step 26: Configure Android Studio project for web #
TODO: See currently changed uncommitted stuff (visual code)
- Change index.html, include the client ID in metadata! web client ID
- Change main.dart
- Create file firebase.json in your app root directory with these contents
{ "hosting": { "public": "build/web", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ] } }
- Build web:
flutter build web --web-renderer html --release --no-tree-shake-icons call firebase login call firebase deploy --project thoma5
Step 27: Create policies and membership page #
- Add the below dependency to pubspec.yaml
eliud_pkg_wizards: ^1.0.3+6
- Run pub get
- Add the following import to main.dart
import 'package:eliud_pkg_wizards/wizards_package.dart'; import 'package:eliud_pkg_etc/etc_package.dart'; import 'package:eliud_pkg_medium/medium_package.dart';
- Add the following line to register the wizards package
eliud.registerPackage(WizardsPackage.instance()); // needed for WizardsPackage: eliud.registerPackage(EtcPackage.instance()); eliud.registerPackage(MediumPackage.instance());
- Restart your app
- Run policy wizard Also see policies.txt, i.e. copy this here (or reference!)
-> update the pages, use the examples C:\src\apps\thoma5_app\assets\legal -> I've uploaded these to drive, so can be accessed from tablet
-> construct the url
ANCHOR : privacy_policy_url ANCHOR : terms_of_service_url ANCHOR : disclaimer_url
- Create memberdashboard page
- How to create a membership page to allow to open the membership dialog
- example: https://minkey.io/#MINKEY_APP/d33da4b8-7179-4fac-b8db-ddc997c2d61a?open-dialog=member_dashboard)
- create an empty page
- Description "Blank"
- Title "Welcome"
- copy the ID, here: b038a344-5762-4880-9767-d89f164811d7
- open member dashboard and copy the url, here: https://juuwle.net/#JUUWLE/member_dashboard
- now construct the URL: https://juuwle.net/#JUUWLE/b038a344-5762-4880-9767-d89f164811d7?open-dialog=member_dashboard
ANCHOR : member_dashboard_url
Step 28: Setup oauth consent #
TODO
https://console.cloud.google.com/apis/credentials/consent
select user type "External" select "create" fill in the details requested:
- provide a logo
- privacy policy will be available from https://[your domain name[/#[app name in code]/privacy_policy-1. In our example: https://juuwle.net/#JUUWLE_APP/privacy_policy-1
- We will make the terms of service available from https://[your domain name[/#[app name in code]/terms_of_service-1. In our example: https://juuwle.net/#JUUWLE_APP/terms_of_service-1
- Add your domain as Authorised domains, here juuwle.net
- Specify developers email address
- Add scopes:
- .../auth/userinfo.email
- .../auth/userinfo.profil Then press the "In production" button and go through the on screen instructions
NOTES: Your app will be available to any user with a Google Account.
You've configured your app in a way that requires verification . To complete verification, you will need to provide:
An official link to your app's Privacy Policy, use #privacy_policy_url A YouTube video showing how you plan to use the Google user data you get from scopes A written explanation telling Google why you need access to sensitive and/or restricted user data All your domains verified in Google Search Console
3.6 You will receive an email "OAuth Verification Request for Project" Follow instructions in the email
Step n: see create-new-app-removed-whats-put-in-README.txt #
overview packages / dependencies #
typical #
A typical app, here Minkey, uses the following dependencies:
links #
Package Description eliud_core This package eliud_generator Eliud generator eliud_pkg_apps Eliud package for creating apps through code, not gui eliud_pkg_chat Eliud chat package eliud_pkg_create Eliud create package eliud_pkg_etc Eliud etc package eliud_pkg_feed Eliud feed package eliud_pkg_follow Eliud follow package eliud_pkg_fundamentals Eliud fundamentals package eliud_pkg_medium Eliud medium package eliud_pkg_membership Eliud membership package eliud_pkg_notifications Eliud notifications package eliud_pkg_pay Eliud pay package eliud_pkg_shop Eliud shop package eliud_pkg_text Eliud text package eliud_pkg_wizards Eliud wizards package eliud_pkg_workflow Eliud workflow package eliud_stl_mona Eliud mona style