1
0
Fork 0
mirror of synced 2024-05-21 05:02:37 +12:00
appwrite/CONTRIBUTING.md

181 lines
10 KiB
Markdown
Raw Normal View History

2019-08-17 20:01:45 +12:00
# Contributing
2019-11-01 20:55:58 +13:00
We would ❤️ for you to contribute to Appwrite and help make it better! We want contributing to Appwrite to be fun, enjoyable, and educational for anyone and everyone. All contributions are welcome, including issues, new docs as well as updates and tweaks, blog posts, workshops, and more.
## How to Start?
2019-11-02 17:45:47 +13:00
If you are worried or dont know where to start, check out our next section explaining what kind of help we could use and where can you get involved. You can reach out with questions to [Eldad Fux (@eldadfux)](https://twitter.com/eldadfux) or [@appwrite_io](https://twitter.com/appwrite_io) on Twitter, and anyone from the [Appwrite team on Discord](https://discord.gg/GSeTUeA). You can also submit an issue, and a maintainer can guide you!
2019-11-01 20:55:58 +13:00
## Where to Start?
2019-11-02 18:05:09 +13:00
Pull requests are great, but there are many other areas where you can help Appwrite.
2019-11-01 20:55:58 +13:00
### Blogging & Speaking
2019-11-02 18:05:09 +13:00
Blogging, speaking about, or creating tutorials about one of Appwrites many features. Mention [@appwrite_io](https://twitter.com/appwrite_io) on Twitter and/or email team [at] appwrite [dot] io so we can give pointers and tips and help you spread the word by promoting your content on the different Appwrite communication channels. Please add your blog posts and videos of talks to our [Awesome Appwrite]() repo on GitHub.
2019-11-01 20:55:58 +13:00
### Presenting at Meetups
Presenting at meetups and conferences about your Appwrite projects. Your unique challenges and successes in building things with Appwrite can provide great speaking material. Wed love to review your talk abstract/CFP, so get in touch with us if youd like some help!
### Sending Feedbacks & Reporting Bugs
2019-11-02 17:45:47 +13:00
Sending feedback is a great way for us to understand your different use cases of Appwrite better. If you had any issues, bugs, or want to share about your experience, feel free to do so on our GitHub issues page or at our [Discord channel](https://discord.gg/GSeTUeA).
2019-11-01 20:55:58 +13:00
### Submitting New Ideas
2019-11-02 17:45:47 +13:00
If you think Appwrite could use a new feature, please open an issue on our GitHub repository, stating as much information as you can think about your new idea and it's implications. We would also use this issue to gather more information, get more feedback from the community, and have a proper discussion about the new feature.
2019-11-01 20:55:58 +13:00
### Improving Documentation
2019-11-07 18:09:57 +13:00
Submitting documentation updates, enhancements, designs, or bug fixes. Spelling or grammar fixes will be very much appreciated.
2019-11-01 20:55:58 +13:00
### Helping Someone
Searching for Appwrite on Discord, GitHub or StackOverflow and helping someone else who needs help. You can also help by reaching others how to contribute to Appwrite's repo!
2019-08-17 20:11:56 +12:00
## Code of Conduct
2019-09-04 19:15:06 +12:00
Help us keep Appwrite open and inclusive. Please read and follow our [Code of Conduct](/CODE_OF_CONDUCT.md).
2019-08-17 20:11:56 +12:00
2019-08-17 20:01:45 +12:00
## Technology Stack
2019-11-02 18:05:09 +13:00
To start helping us to improve the Appwrite server by submitting code, prior knowledge of Appwrite's technology stack can help you with getting started.
2019-08-17 20:01:45 +12:00
2019-11-02 18:05:09 +13:00
Appwrite stack is combined from a variety of open-source technologies and tools. Appwrite backend API is written primarily with PHP version 7 and above on top of the [Utopia PHP framework](https://github.com/utopia-php/framework). The Appwrite frontend is built with tools like gulp, less, and [litespeed.js](https://github.com/litespeed-js). We use Docker as the container technology to package the Appwrite server for easy integration on-cloud, on-premise, or on-localhosts.
2019-08-17 20:01:45 +12:00
### Other Technologies
* Redis - for managing cache and in-memory data (currently, we do not use Redis for persistent data)
* MariaDB - for database storage and queries
* InfluxDB - for managing stats and time-series based data
2019-11-02 17:45:47 +13:00
* Statsd - for sending data over UDP protocol (using Telegraf)
2019-08-17 20:01:45 +12:00
* ClamAV - for validating and scanning storage files
* Imagemagick - for manipulating and managing image media files.
* Webp - for better compression of images on supporting clients
* SMTP - for sending email messages and alerts
* Resque - for managing data queues and scheduled tasks over a Redis server
## Package Managers
2019-11-02 17:45:47 +13:00
Appwrite uses a package manager for managing code dependencies for both backend and frontend development. We try our best to avoid creating any unnecessary, and any new dependency to the project is subjected to a lead developer review and approval.
2019-08-17 20:01:45 +12:00
Many of Appwrite's internal modules are also used as dependencies to allow other Appwrite's projects to reuse them and as a way to contribute them back to the community.
2019-08-17 20:01:45 +12:00
2019-11-02 18:05:09 +13:00
Appwrite uses [PHP's Composer](https://getcomposer.org/) for managing dependencies on the server-side and [JS NPM](https://www.npmjs.com/) for managing dependencies on the frontend side.
2019-08-17 20:01:45 +12:00
2019-08-18 21:29:57 +12:00
## Coding Standards
2019-11-02 18:05:09 +13:00
Appwrite is following the [PHP-FIG standards](https://www.php-fig.org/). Currently, we are using both PSR-0 and PSR-4 for coding standards and autoloading standards. Soon we will also review the project for support with PSR-12 (Extended Coding Style).
2019-09-04 19:05:20 +12:00
We use prettier for our JS coding standards and for auto-formatting our code.
2019-09-13 22:49:48 +12:00
2019-09-04 19:05:20 +12:00
## Scalability, Speed and Performance
Appwrite is built to scale. Please keep in mind that the Appwrite stack can run in different environments and different scales.
2019-11-02 17:45:47 +13:00
We wish Appwrite will be as easy to set up and in a single, localhost, and easy to grow to a large environment with thousands and even hundreds of instances.
2019-09-04 19:05:20 +12:00
When contributing code, please take into account the following considerations:
2019-09-04 19:05:20 +12:00
* Response Time
* Throughput
* Requests per Seconds
* Network Usage
* Memory Usage
* Browser Rendering
* Background Jobs
* Task Execution Time
2019-08-17 20:01:45 +12:00
## Architecture
2019-11-02 18:05:09 +13:00
Appwrite's current structure is a combination of both [Monolithic](https://en.wikipedia.org/wiki/Monolithic_application) and [Microservice](https://en.wikipedia.org/wiki/Microservices) architectures, but our final goal, as we grow, is to be using only microservices.
2019-09-04 19:05:20 +12:00
### The Monolithic Part
Appwrite's main API container is designed as a monolithic app. This is a decision we made to allow us to develop the project faster while still being a very small team.
2019-09-04 19:05:20 +12:00
2019-11-02 17:45:47 +13:00
Although the Appwrite API is a monolithic app, it has a very clear separation of concern as each internal service or worker is separated by its container, which will allow us as we grow to start breaking services for better maintenance and scalability.
2019-09-04 19:05:20 +12:00
### The Microservice Part
2019-10-02 22:45:34 +13:00
Each container in Appwrite is a microservice on its own. Each service is an independent process that can scale without regard to any of the other services.
2019-09-04 19:05:20 +12:00
2019-11-02 18:05:09 +13:00
Currently, all of the Appwrite microservices are intended to communicate using the TCP protocol over a private network. You should be aware to not expose any of the services to the public-facing network, besides the public port 80 and 443, who, by default, are used to expose the Appwrite HTTP API.
2019-09-04 19:05:20 +12:00
2019-08-18 18:19:15 +12:00
## Security & Privacy
2019-11-02 18:05:09 +13:00
Security and privacy are extremely important to Appwrite, developers, and users alike. Make sure to follow the best industry standards and practices.
<!-- To help you make sure you are doing as best as possible, we have set up our security checklist for pull requests and contributors. Please make sure to follow the list before sending a pull request. -->
2019-09-04 09:47:33 +12:00
## Dependencies
2019-11-02 17:45:47 +13:00
Please avoid introducing new dependencies to Appwrite without consulting the team. New dependencies can be very helpful but also introduce new security and privacy issues, complexity, and impact total docker image size.
2019-09-04 19:05:20 +12:00
Adding a new dependency should have vital value on the product with minimum possible risk.
## Introducing New Features
2019-10-01 09:34:07 +13:00
We would 💖 you to contribute to Appwrite, but we would also like to make sure Appwrite is as great as possible and loyal to its vision and mission statement 🙏.
2019-09-04 09:47:33 +12:00
2019-10-02 01:54:39 +13:00
For us to find the right balance, please open an issue explaining your ideas before introducing a new pull request.
2019-09-04 19:05:20 +12:00
This will allow the Appwrite community to have sufficient discussion about the new feature value and how it fits in the product roadmap and vision.
2019-11-02 17:45:47 +13:00
This is also important for the Appwrite lead developers to be able to give technical input and different emphasize regarding the feature design and architecture.
2019-09-04 09:47:33 +12:00
2020-04-17 15:59:14 +12:00
## Setup From Source
2019-08-18 18:19:15 +12:00
2019-11-29 00:17:23 +13:00
To set up a working **development environment**, just fork the project git repository and install the backend and frontend dependencies using the proper package manager and create run the docker-compose stack.
> If you just want to install Appwrite for day-to-day usage and not as a code maintainer use this [installation guide](https://github.com/appwrite/appwrite#installation).
2019-11-02 18:10:17 +13:00
Please note that these instructions are for setting a functional dev environment. If you want to set up an Appwrite instance to integrate into your app, you should probably try and install Appwrite by using the instructions in the [getting started guide](https://appwrite.io/docs/getting-started-for-web) or in the main [README](README.md) file.
2019-08-18 18:19:15 +12:00
```bash
2019-10-03 16:51:55 +13:00
git clone git@github.com:[YOUR_FORK_HERE]/appwrite.git
2019-08-18 18:19:15 +12:00
cd appwrite
docker-compose up -d
```
After finishing the installation process, you can start writing and editing code. To compile new CSS and JS distribution files, use 'less' and 'build' tasks using gulp as a task manager.
2019-08-17 20:01:45 +12:00
## Build
2019-08-18 18:19:15 +12:00
2019-11-02 17:45:47 +13:00
To build a new version of the Appwrite server, all you need to do is run the build.sh file like this:
2019-08-18 18:19:15 +12:00
```bash
bash ./build.sh 1.0.0
```
2019-11-02 17:45:47 +13:00
Before running the command, make sure you have proper write permissions to the Appwrite docker hub team.
2019-09-04 19:05:20 +12:00
2019-11-16 10:52:25 +13:00
## Tests
To run tests manually, run phpunit from your command line:
```bash
2020-05-16 02:54:37 +12:00
docker exec appwrite test
2019-11-16 10:52:25 +13:00
```
## Code Maintenance
We use some automation tools to help us keep a healthy code base.
Improve PHP exeution time by using [fully-qualified function calls](https://veewee.github.io/blog/optimizing-php-performance-by-fq-function-calls/):
```bash
2020-06-20 23:30:49 +12:00
php-cs-fixer fix src/ --rules=native_function_invocation --allow-risky=yes
```
2019-09-04 19:05:20 +12:00
## Tutorials
2019-11-02 17:45:47 +13:00
From time to time, our team will add tutorials that will help contributors find their way in the Appwrite source code. Below is a list of currently available tutorials:
2019-09-04 19:05:20 +12:00
2020-02-17 00:41:03 +13:00
* [Adding Support for a New OAuth2 Provider](./docs/tutorials/add-oauth2-provider.md)
* [Appwrite Environment Variables](./docs/tutorials/environment-variables.md)
* [Running in Production](./docs/tutorials/running-in-production.md)