-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bda670f
Showing
85 changed files
with
2,484 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# 0.1.0 | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO: Add your license here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# AWS Amplify Starter Project | ||
|
||
[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason) | ||
|
||
A highly opinionated AWS Amplify starter project. It will work as a Todo application. | ||
|
||
The project uses: | ||
- [Amplify Authenticator](https://pub.dev/packages/amplify_authenticator), for authentication | ||
- [Amplify Datastore](https://pub.dev/packages/amplify_datastore) for saving data and real time updates | ||
- [bloc](https://pub.dev/packages/bloc) for state management. | ||
|
||
## How to use 🚀 | ||
|
||
You can either fill in the variables on your CLI: | ||
|
||
```shell | ||
mason make amplify_starter --project_name "AWS TODO" --project_organization "com.amplify.aws" | ||
``` | ||
|
||
**OR** | ||
|
||
let CLI guide you through the process | ||
|
||
```shell | ||
mason make amplify_starter | ||
``` | ||
|
||
> This project creates the base project for you. You are still expected to configure AWS Amplify afterwards. | ||
> | ||
> Once the project is created go to the `README.md` file of the generated project and follow the steps described there. | ||
## Variables ✨ | ||
|
||
| Variable | Description | Default | Type | | ||
|------------------------|------------------------------|-----------------|----------| | ||
| `project_name` | Name of your project | Amplify Starter | `string` | | ||
| `project_organization` | Organization of your project | com.example | `string` | | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
**/ios/Flutter/.last_build_id | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
|
||
# Web related | ||
lib/generated_plugin_registrant.dart | ||
|
||
# Symbolication related | ||
app.*.symbols | ||
|
||
# Obfuscation related | ||
app.*.map.json | ||
|
||
# Android Studio will place build artifacts here | ||
/android/app/debug | ||
/android/app/profile | ||
/android/app/release | ||
|
||
#amplify-do-not-edit-begin | ||
amplify/\#current-cloud-backend | ||
amplify/.config/local-* | ||
amplify/logs | ||
amplify/mock-data | ||
amplify/backend/amplify-meta.json | ||
amplify/backend/.temp | ||
build/ | ||
dist/ | ||
node_modules/ | ||
aws-exports.js | ||
awsconfiguration.json | ||
amplifyconfiguration.json | ||
amplifyconfiguration.dart | ||
amplify-build-config.json | ||
amplify-gradle-config.json | ||
amplifytools.xcconfig | ||
.secret-* | ||
**.sample | ||
#amplify-do-not-edit-end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled. | ||
|
||
version: | ||
revision: 85684f9300908116a78138ea4c6036c35c9a1236 | ||
channel: stable | ||
|
||
project_type: app | ||
|
||
# Tracks metadata for the flutter migrate command | ||
migration: | ||
platforms: | ||
- platform: root | ||
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 | ||
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 | ||
- platform: android | ||
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 | ||
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 | ||
- platform: ios | ||
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 | ||
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 | ||
|
||
# User provided section | ||
|
||
# List of Local paths (relative to this file) that should be | ||
# ignored by the migrate tool. | ||
# | ||
# Files that are not part of the templates will be ignored by default. | ||
unmanaged_files: | ||
- 'lib/main.dart' | ||
- 'ios/Runner.xcodeproj/project.pbxproj' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# {{project_name.sentenceCase()}} | ||
|
||
[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason) | ||
|
||
An opinionated Flutter project for starting with AWS Amplify. | ||
|
||
The project uses: | ||
- [Amplify Authenticator](https://pub.dev/packages/amplify_authenticator), for authentication | ||
- [Amplify Datastore](https://pub.dev/packages/amplify_datastore) for saving data and real time updates | ||
- [bloc](https://pub.dev/packages/bloc) for state management. | ||
- | ||
## Getting Started | ||
|
||
> Before you move forward, be sure to have your AWS Account created and Amplify CLI is installed. | ||
> | ||
> If you do not know how to do it, you can check the [official documentation](https://docs.amplify.aws/start/getting-started/installation/q/integration/flutter/) or this [blog post](https://medium.com/p/ef748798fdbf) for detailed guide. | ||
Once the project is created, open your terminal on the generated project path. Afterwards write the following command: | ||
```shell | ||
amplify init | ||
``` | ||
|
||
This will initialize AWS Amplify for your application. | ||
|
||
```shell | ||
msalihg@ AWS TODO % amplify init | ||
Note: It is recommended to run this command from the root of your app directory | ||
? Enter a name for the project AWSTODO | ||
The following configuration will be applied: | ||
|
||
Project information | ||
| Name: AWSTODO | ||
| Environment: dev | ||
| Default editor: Visual Studio Code | ||
| App type: flutter | ||
| Configuration file location: ./lib/ | ||
|
||
? Initialize the project with the above configuration? Yes | ||
Using default provider awscloudformation | ||
? Select the authentication method you want to use: AWS profile | ||
|
||
For more information on AWS Profiles, see: | ||
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html | ||
|
||
? Please choose the profile you want to use default | ||
Adding backend environment dev to AWS Amplify app: | ||
⠼ Initializing project in the cloud... | ||
... | ||
✅ Initialized your environment successfully | ||
``` | ||
|
||
At above, you have chosen the default configuration for your project, it is more than enough to start with. But, you can always have your own version of the settings as well. | ||
|
||
Once you see the success message, you are ready to add libraries. First, add Amplify Authentication library: | ||
|
||
```shell | ||
amplify add auth | ||
``` | ||
|
||
This will take you to select couple of options: | ||
``` | ||
msalihg@ AWS TODO % amplify add auth | ||
Using service: Cognito, provided by: awscloudformation | ||
The current configured provider is Amazon Cognito. | ||
Do you want to use the default authentication and security configuration? Default configuration | ||
Warning: you will not be able to edit these selections. | ||
How do you want users to be able to sign in? Username | ||
Do you want to configure advanced settings? No, I am done. | ||
✅ Successfully added auth resource locally | ||
``` | ||
|
||
Just select the default ones and username as a sign in method. That is enough for Authentication. | ||
|
||
Next step is adding the Amplify DataStore. | ||
|
||
```shell | ||
amplify add api | ||
``` | ||
|
||
This is a tricky one. You need to select GraphQL if you would like to work with real time updates. | ||
|
||
```shell | ||
msalihg@ AWS TODO % amplify add api | ||
? Select from one of the below mentioned services: GraphQL | ||
? Here is the GraphQL API that we will create. Select a setting to edit or continue | ||
? Choose the default authorization type for the API Amazon Cognito User Pool | ||
Use a Cognito user pool configured as a part of this project. | ||
? Configure additional auth types? No | ||
? Here is the GraphQL API that we will create. Select a setting to edit or continue Conflict detection (required for DataStore): Disabled | ||
? Enable conflict detection? Yes | ||
? Select the default resolution strategy Auto Merge | ||
? Here is the GraphQL API that we will create. Select a setting to edit or continue Continue | ||
? Choose a schema template: Single object with fields (e.g., “Todo” with ID, name, description) | ||
``` | ||
|
||
You can pick any option from above **but for the sake of the starter project, do the selections as seen like above.** | ||
|
||
Now open the `schema.graphql` file from `amplify/backend/api/<{{project_name}}>/schema.graphql` path. Remove everything and paste the following there: | ||
|
||
```graphql | ||
type Todo @model @auth(rules: [{ allow: owner }]) { | ||
id: ID! | ||
name: String! | ||
description: String | ||
isComplete: Boolean! | ||
} | ||
``` | ||
|
||
This will create a Todo object that will be available only for the owner to read/create/update. | ||
|
||
Amplify has a tool to help you generate models out of the GraphQL reference. | ||
|
||
```shell | ||
amplify codegen models | ||
``` | ||
|
||
Once you create the models, now you are set to push your changes to cloud. But before write `amplify status` command. It should show you the state of your application and your setup for AWS Amplify. | ||
|
||
```shell | ||
msalihg@ {{project_name}} % amplify status | ||
|
||
Current Environment: dev | ||
|
||
┌──────────┬────────────────────────┬───────────┬───────────────────┐ | ||
│ Category │ Resource name │ Operation │ Provider plugin │ | ||
├──────────┼────────────────────────┼───────────┼───────────────────┤ | ||
│ Auth │ {{project_name}} │ Create │ awscloudformation │ | ||
├──────────┼────────────────────────┼───────────┼───────────────────┤ | ||
│ Api │ {{project_name}} │ Create │ awscloudformation │ | ||
└──────────┴────────────────────────┴───────────┴───────────────────┘ | ||
|
||
GraphQL transformer version: 2 | ||
``` | ||
|
||
You can see that, two categories have been created for your project and now ready to be pushed. | ||
|
||
```shell | ||
amplify push | ||
``` | ||
|
||
With this command, you are pushing your changes to the cloud. These changes will take a couple of minutes so in the meantime enjoy your coffee. | ||
|
||
Once it is done, get the Flutter packages as follows: | ||
|
||
```shell | ||
flutter pub get | ||
``` | ||
|
||
and run your application! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This file configures the analyzer, which statically analyzes Dart code to | ||
# check for errors, warnings, and lints. | ||
# | ||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled | ||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be | ||
# invoked from the command line by running `flutter analyze`. | ||
|
||
# The following line activates a set of recommended lints for Flutter apps, | ||
# packages, and plugins designed to encourage good coding practices. | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
analyzer: | ||
exclude: | ||
- lib/models | ||
|
||
linter: | ||
# The lint rules applied to this project can be customized in the | ||
# section below to disable rules from the `package:flutter_lints/flutter.yaml` | ||
# included above or to enable additional rules. A list of all available lints | ||
# and their documentation is published at | ||
# https://dart-lang.github.io/linter/lints/index.html. | ||
# | ||
# Instead of disabling a lint rule for the entire project in the | ||
# section below, it can also be suppressed for a single line of code | ||
# or a specific dart file by using the `// ignore: name_of_lint` and | ||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file | ||
# producing the lint. | ||
rules: | ||
# avoid_print: false # Uncomment to disable the `avoid_print` rule | ||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
gradle-wrapper.jar | ||
/.gradle | ||
/captures/ | ||
/gradlew | ||
/gradlew.bat | ||
/local.properties | ||
GeneratedPluginRegistrant.java | ||
|
||
# Remember to never publicly share your keystore. | ||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app | ||
key.properties | ||
**/*.keystore | ||
**/*.jks |
Oops, something went wrong.