# Contributing Guidelines
Thank you for your interest in contributing to our project! ð
Whether it's a bug report, new feature, correction, or additional documentation, we greatly value feedback and contributions from our community. Please read through these guidelines carefully before submitting a PR or issue and let us know if it's not up-to-date (or even better, submit a PR with your corrections ð).
- [Our History and Ethos](#our-history-and-ethos)
- [Our Design](#our-design)
- [Development Process](#development-process)
- [Setting up for local development](#setting-up-for-local-development)
- [Architecture of the codebase](#architecture-of-the-codebase)
- [Steps towards contributions](#steps-towards-contributions)
- [Bug Reports](#bug-reports)
- [Pull Requests](#pull-requests)
- [Debugging](#debugging)
- [Release](#release)
- [Finding contributions to work on](#finding-contributions-to-work-on)
- [Related Repositories](#related-repositories)
- [Code of Conduct](#code-of-conduct)
- [Security issue notifications](#security-issue-notifications)
- [Licensing](#licensing)
# Our History and Ethos
AWS Amplify aims to enhance the development experience using JavaScript with AWS. Amplify codifies best practices through programmatic interfaces to help you effortlessly interact with cloud resources.
First and foremost Amplify exposes to you WHAT things do and then HOW best to do them. The WHAT is at a functional use case with HOW being an opinionated implementation that you can override with âescape hatches.â This will allow you to have higher velocity and build better applications by focusing less on implementation choices. Secondly, Amplify should be a manifestation of The Rule of Least Power when developing against AWS. This means it encourages architectural and programmatic best practices and the ability to start quickly. This shows by encouraging certain services (API Gateway usage vs. direct DynamoDB interaction) or certain connection patterns (Circuit breaker, retry counts and throttle up/down).
Opinionated implementations: There are many ways to interface with AWS Services. Certain service interactions are favored over others. For instance, if sending and receiving JSON, we would prefer an API Gateway endpoint to other mechanisms. Amplify will programmatically help optimize for cost and performance through library decisions.
Declarative actions: Amplify will provide you a reference to a generic client object and the ability to perform common actions. âRegisterUserâ, âLoginâ, âSendObjectâ, âUpdateObjectâ, âStreamDataâ. By default you should not need to worry about AWS Service specific API operations like putItem() with a unique hash or even HTTP verbs.
Cascading service interactions: Certain actions in a declarative style can have overlapping or ambiguous AWS Service implementations. With an opinionated implementation, we can decide which Services are "primary" and which are "secondary" depending on what is configured. For instance, sending an image will prefer S3 over API Gateway.
Simple, standard data objects: Sending & receiving data to AWS Services can have many parameters, which tend to show up in the SDKs. These are abstracted and inferred, where possible, with simple JSON that the implementation can reason about. Standard parameters (bucket names, stream names, partition keys, etc.) that are part of the implementation are extracted from a simplified configuration file and dynamically generated/updated in order to further allow focus on state and data types only.
# Our Design
As more and more modules were introduced to AWS Amplify, it became necessary to modularize the library into smaller pieces so that users could avoid importing unnecessary parts into their app. The goal of this design is to make AWS Amplify modularized and also keep it backward-compatible to avoid breaking changes.
Modular import prevents unnecessary code dependencies from being included with the app, and thus decreases the bundle size while enabling added new functionality without the risk of introducing errors related to unused code.
Amplify has established the concepts of categories and plugins. A category is a collection of api calls that are exposed to the client to do things inside that category. For example, in the storage category, generally one wants to upload and download objects from storage so the apis exposed to the client will represent that functionality. Because Amplify is pluggable, a plugin of your choosing will provide the actual implementation behind that api interface. Using the same example of Storage, the plugin we choose might be AWSStoragePlugin which would then implement each api call from the category with a service call or set of service calls to S3, the underlying storage provider of the AWS plugin.
# Development Process
Our work is done directly on Github and PR's are sent to the GitHub repo by core team members and contributors. Everyone undergoes the same review process to get their changes into the repo.
## Setting up for local development
This section should get you running with **Amplify JS** and get you familiar with the basics of the codebase. You will need the latest version of [Node.js](https://nodejs.org/en/) on your system and developing locally also requires `yarn` workspaces. You can install it [here](https://classic.yarnpkg.com/en/docs/install#mac-stable).
Start by [forking](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) the main branch of [amplify-js](https://github.com/aws-amplify/amplify-js).
```
git clone [email protected]:[username]/amplify-js.git
cd amplify-js
yarn
yarn bootstrap
yarn build
```
> Note: Make sure to always [sync your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork) with main branch of `amplify-js`
## Architecture of the codebase
Amplify JS is a monorepo built with `Yarn` and `Lerna`. All the categories of Amplify live within the `packages` directory in the root. Each category inside packages has its own `src/` and `package.json`.
[**Packages inside Amplify JS Monorepo**](https://github.com/aws-amplify/amplify-js/tree/main/packages)
## Steps towards contributions
- To make changes with respect to a specific category, go into `packages/[category]`.
- Make changes to required file.
- Write unit tests
- Yarn build
- Run test suite
- Test in sample app using yarn linking
- Submit a PR
#### Build step:
```
yarn build --scope @aws-amplify/auth
```
#### Testing:
```
yarn run test --scope @aws-amplify/auth
yarn run test --scope @aws-amplify/ui-components
```
> Note: There is a commit hook that will run the tests prior to committing. Please make sure if you are going to provide a pull request to be sure you include unit tests with your functionality and that all tests pass.
#### Test in a local sample app
**Yarn Linking**
The best way to develop locally and test is to link the individual package youâre working on and run lerna in watch mode.
Run watch mode while editing (auth for example):
```
npx lerna exec --scope @aws-amplify/auth yarn link
npx lerna exec --scope @aws-amplify/auth yarn build:esm:watch
```
Or run the whole library in watch mode if you are working on multiple packages
```
yarn build # Build the whole library
yarn link-all # Make all the packages available to link
yarn build:esm:watch # All packages are building ES6 modules in watch mode
```
In your sample project, you can now link specific packages
```
yarn link @aws-amplify/auth
```
These tests are only necessary if youâre looking to contribute a Pull Request. If youâre just playing locally you donât need them. However if youâre contributing a Pull Request for anything other than bug fixes it would be best to validate that first because depending on the scope of the change.
#### Verdaccio
Verdaccio is a lightweight private npm proxy registry built in Node.js. Install [Verdaccio](https://verdaccio.org/docs/en/installation). You can setup Verdaccio to publish packages locally to test the changes.
To publish in Verdaccio, start a Verdaccio instance and then,
```
yarn config set registry http://localhost:4873/
yarn lerna publish --no-git-tag-version --no-push --force-publish
```
To publish a local version of a specific package,
```
cd packages/