Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Commit 2844dff

Browse files
authored
Merge pull request #2 from appwrite/feat-first-draft
First PR
2 parents bc69916 + 0634ed6 commit 2844dff

32 files changed

+3992
-2
lines changed

README.md

Lines changed: 105 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,105 @@
1-
# docs
2-
The official https://appwrite.io/docs documentation 📝
1+
# The Appwrite Docs 📝
2+
3+
The official https://appwrite.io/docs documentation source code.
4+
## 🚀 Contributing
5+
1. Clone the repository
6+
2. Updated, add, or fix current docs
7+
3. Once content is ready, raise a PR
8+
9+
### Content Guidelines
10+
- Use proper title hierarchy h1-h6 and valid HTML
11+
- External links to (not https://appwrite.io) should be opened in a new tab (`target="_blank"`)
12+
- External links should have an HTML attribute of `rel="noopener"`
13+
- All filenames should be dash-based and nested in a way that makes sense
14+
- All images should be in PNG format and 2600x1400px. Do not include any sensitive data in images. All screenshot of the Appwrite dashboard should support light and dark mode.
15+
- When creating new content or adjusting docs heirarchy please consult the Appwrite team by opening a Github Issue in this repository
16+
17+
#### Code Examples
18+
19+
Use the following HTML structure to present code examples:
20+
21+
```html
22+
<div class="ide margin-top-small" data-lang="ruby" data-lang-label="Ruby SDK">
23+
<pre class="line-numbers"><code class="prism language-ruby" data-prism>#ruby code here...</code></pre>
24+
</div>
25+
```
26+
27+
As of writing this are the supported langauges for code examples:
28+
29+
* markup
30+
* css
31+
* clike
32+
* javascript
33+
* bash
34+
* csharp
35+
* dart
36+
* go
37+
* graphql
38+
* http
39+
* java
40+
* json
41+
* kotlin
42+
* markup-templating
43+
* php
44+
* powershell
45+
* python
46+
* ruby
47+
* swift
48+
* typescript
49+
* yaml
50+
51+
For showing examples in multiple languages use the list structure:
52+
53+
```html
54+
<ul class="phases clear" data-ui-phases>
55+
<li>
56+
<h3>Node.js</h3>
57+
<div class="ide margin-top-small" data-lang="nodejs" data-lang-label="Node.js SDK">
58+
<pre class="line-numbers"><code class="prism language-javascript" data-prism>// node code here...</code></pre>
59+
</div>
60+
</li>
61+
<li>
62+
<h3>PHP</h3>
63+
64+
<div class="ide margin-top-small" data-lang="php" data-lang-label="PHP SDK">
65+
<pre class="line-numbers"><code class="prism language-php" data-prism>//php code here..</code></pre>
66+
</div>
67+
</li>
68+
</ul>
69+
```
70+
71+
> Don't forget to use proper indenting for all code examples. The indenting of the code examples should be independent from the indentation of the surrounding HTML tags.
72+
73+
#### Notes
74+
75+
Use the following HTML structure to add important notes inside your docs:
76+
77+
```html
78+
<div class="notice">
79+
<h2>Important Message</h2>
80+
<p>Message content here.</p>
81+
</div>
82+
```
83+
84+
#### Images
85+
86+
Use the following HTML structure to add images. You can also add support for dark and light mode versions (recommended!). If no dark mode is provided, light mode will be the fallback. Don't forget to provide alternative text for user accessibility and a description for each image.
87+
88+
```php
89+
<?php
90+
$image = new View(__DIR__.'/../general/image.phtml');
91+
echo $image
92+
->setParam('srcLight', '/images-ee/docs/functions-light.png')
93+
->setParam('srcDark', '/images-ee/docs/functions-dark.png')
94+
->setParam('alt', 'Function settings page.')
95+
->setParam('description', 'Function settings page.')
96+
->render();
97+
?>
98+
```
99+
100+
## 🤘 Support
101+
At any point, if you are stuck, feel free to hop on our [Discord server](https://appwrite.io/discord) to ask questions or seek mentorship!
102+
103+
## Follow Us
104+
Join our growing community around the world! See our official [Blog](https://medium.com/appwrite-io). Follow us on [Twitter](https://twitter.com/appwrite_io), [Facebook Page](https://www.facebook.com/appwrite.io), [Facebook Group](https://www.facebook.com/groups/appwrite.developers/) or join our live [Discord server](https://discord.gg/GSeTUeA) for more help, ideas, and discussions.
105+

app/views/docs/admin.phtml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<p>The Appwrite API has two different modes he can work with, the first mode is the client mode, which is the <b>default</b> mode, and the second one is the <b>admin</b> or server mode.</p>
2+
3+
<p>When using Appwrite from the client-side, you should go with the normal default mode. This mode allows every user of your project to access only resources he has granted access to. When running in admin mode, you remove Appwrite default access restriction and ultimately allow access to any of the resources available on your Appwrite project (files, documents, or collections).</p>
4+
5+
<p>For security reasons, the admin mode only works in combination with an API key. You can create an API key from the Appwrite console, and you can choose what scopes of access you are willing to grant your SDK.</p>
6+
7+
<p>Please note: passing an API key from a client SDK is a <strong>major</strong> security issue. Use your API key only from a server-side integration and make sure you store them securely and privately. There are many sources online that advise what the best practices regarding the storing of secrets and API keys on your server are.</p>

app/views/docs/architecture.phtml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
use Utopia\View;
4+
5+
?>
6+
7+
<p>Appwrite is built on top of a microservices architecture. This architecture allows us to provide a scalable & distributed system for max flexibility, observability, and performance. Most of the Appwrite stack is stateless and can be easily replicated. For persistency, Appwrite uses standard battle-proven tools like MariaDB, Redis, and InfluxDB.</p>
8+
9+
<?php
10+
$image = new View(__DIR__.'/../general/image.phtml');
11+
echo $image
12+
->setParam('srcLight', 'https://raw.githubusercontent.com/appwrite/appwrite/7a06b4e4bfa39c0dfaff45cd7bf978201b856e99/docs/specs/overview.drawio.svg')
13+
->setParam('srcDark', '')
14+
->setParam('alt', 'Appwrite\'s microservices architecture.')
15+
->setParam('description', 'Appwrite\'s microservices architecture')
16+
->render();
17+
?>
18+
19+
<h2>Observability</h2>
20+
21+
<p>The Appwrite architecture allows to monitor and detect how the different microservices perform efficiently. Each microservice has its own usage metrics and logs to allow you to debug or scale it quickly. Using Docker, you can also limit the resource usage (CPU, Memory, Swap) by specific services.</p>
22+
23+
<h2>Responsibilities</h2>
24+
<p>Each service in the stack has a specific type of workload he has to handle, like sending emails, executing cloud functions or logging user activity. All the heavy lifting workloads are delegated from the API service to the background workers consuming messages in an event-driven way from the Appwrite pub/sub mechanism (implemented using Redis). Using this design, we make sure the Appwrite API is fast, responsive and has to handle only critical sync operations as appropriate for a request->response based service that should respond as fast as possible for minimum latency.</p>
25+
26+
<h2>Traefik</h2>
27+
28+
<p>Traefik is a modern reverse proxy and load balancer written in Go that makes deploying microservices easy. Traefik integrates with your existing infrastructure components and configures itself automatically and dynamically. We use Traefik as the main entrypoint for the different Appwrite APIs. Traefik is also responsible for serving Appwrite auto-generated SSL certificates. This microservice is completely stateless.</p>
29+
30+
<h2>Appwrite</h2>
31+
32+
<p>The main Appwrite container implements the Appwrite API protocols, handles authentication, authorization, and rate-limiting. This microservice is completely stateless.</p>
33+
34+
<h2>Redis</h2>
35+
36+
<h2>MariaDB</h2>
37+
38+
<h2>InfluxDB</h2>
39+
40+
<h2>StatsD</h2>
41+
42+
<h2>ClamAV</h2>
43+
44+
<p>ClamAV is a TCP Anti-virus server responsible for scanning all user uploads to the Appwrite storage. The ClamAV micro service is optional and can be disabled using Appwrite environment variables.</p>
45+
46+
<h2>Maintenance</h2>
47+
48+
<p>The Maintenance microservice is responsible to delegate maintenance jobs for different workers at specific time intervals that can be customized using Appwrite environment variables. The different tasks include deletion of old logs, and cleaning of irrelevant abuse records.</p>
49+
50+
<h2>Schedule</h2>
51+
52+
<p>The Schedule microservice is responsible for delegating future tasks to the workers and set recurring tasks and cloud function executions.</p>
53+
54+
<h2>Workers</h2>
55+
56+
<p><b>Functions</b></p>
57+
58+
<p>The Functions worker is responsible for executing your Appwrite cloud functions in an isolated environment. The service leverages Docker for creating running environment in multiple supported coding languages.</p>
59+
60+
<p><b>Audits</b></p>
61+
62+
<p><b>Usage</b></p>
63+
64+
<p><b>Tasks</b></p>
65+
66+
<p><b>Deletes</b></p>
67+
68+
<p><b>Certificates</b></p>
69+
70+
<p><b>Mails</b></p>

app/views/docs/command-line.phtml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<p>The <a href="https://github.com/appwrite/sdk-for-cli" target="_blank" rel="noopener">Appwrite CLI</a> is a command-line application that allows you to interact with the <a href="/docs/getting-started-for-server">Appwrite server-side APIs</a> and perform server-side tasks quickly using your terminal. A few examples of these tasks including managing resources (documents, files, users), executing and packaging Cloud Functions, and any other operation available through the Appwrite API.</p>
2+
3+
<h2>Getting started</h2>
4+
5+
<p>The Appwrite CLI installation is extremely easy and fast. The CLI is packaged as a Docker container, which makes it secure by default, requires no dependencies but <a href="https://docs.docker.com/get-docker/">Docker</a>, and truly platform and language agnostic.</p>
6+
7+
<p>The next step is to have your Appwrite server running. You can grab our simple <a href="/docs/installation">installation command</a> and execute it.</p>
8+
9+
<p>Next, head over to <a href="http://localhost" rel="noopener" target="_blank">http://localhost</a> and create a project in the Appwrite Console, create an <a href="/docs/keys">API key</a>, and we're good to play around with the CLI.</p>
10+
11+
<h3>Installation</h3>
12+
13+
<p>To install the CLI, we recommend running the installation script for your operating system.</p>
14+
15+
<ul class="phases clear" data-ui-phases>
16+
<li>
17+
<h4>MacOS</h4>
18+
19+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="Bash">
20+
<pre class="line-numbers"><code class="prism language-bash" data-prism>curl -sL <?php echo $this->getParam('home'); ?>/cli/install.sh | bash</code></pre>
21+
</div>
22+
</li>
23+
<li>
24+
<h4>Windows</h4>
25+
26+
<div class="ide margin-bottom" data-lang="powershell" data-lang-label="PowerShell">
27+
<pre class="line-numbers"><code class="prism language-powershell" data-prism>iwr -useb <?php echo $this->getParam('home'); ?>/cli/install.ps1 | iex</code></pre>
28+
</div>
29+
</li>
30+
<li>
31+
<h4>Linux</h4>
32+
33+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="Bash">
34+
<pre class="line-numbers"><code class="prism language-bash" data-prism>curl -sL <?php echo $this->getParam('home'); ?>/cli/install.sh | bash</code></pre>
35+
</div>
36+
</li>
37+
</ul>
38+
39+
<p>Once the setup is complete, you can validate your installation using:</p>
40+
41+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="CLI">
42+
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite version</code></pre>
43+
</div>
44+
45+
<p>To start using the CLI with your project, you will first need to initialize the CLI with:</p>
46+
47+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="CLI">
48+
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite init</code></pre>
49+
</div>
50+
51+
<p>Great! Now you're all set to use the Appwrite CLI. You can access your CLI using the following general syntax:</p>
52+
53+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="CLI">
54+
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite [SERVICE] [COMMAND] --[OPTIONS]</code></pre>
55+
</div>
56+
57+
<h3>Examples</h3>
58+
59+
<p><b>Create User</b></p>
60+
61+
<p>To create a new user in your project, you can use the `create` command. To successfully create a user, make sure your API key is granted with the scope "users.write".</p>
62+
63+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="CLI">
64+
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite users create --email="[email protected]" --password="my-secret"</code></pre>
65+
</div>
66+
<!-- Attach image of output -->
67+
68+
<p><b>List Users</b></p>
69+
70+
<p>To get a list of all your project users, you can use the `list` command. To successfully view the list, make sure your API key is granted with the scope "users.read".</p>
71+
72+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="CLI">
73+
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite users list</code></pre>
74+
</div>
75+
<!-- Attach image of output -->
76+
77+
<p><b>List Collections</b></p>
78+
79+
<p>To get a list of all your collections, you can use the `listCollections` command. To successfully view the list, make sure your API key is granted with the scope "collections.read".</p>
80+
81+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="CLI">
82+
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite database listCollections</code></pre>
83+
</div>
84+
<!-- Attach image of output -->
85+
86+
<p><b>Read Collection</b></p>
87+
88+
<p>To get more information on a particular collection, you can make use of the `getCollection` command and pass in the `collectionId`. To successfully fetch the collection, make sure your API key is granted with the scope "collections.read".</p>
89+
90+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="CLI">
91+
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite database getCollection --collectionId=5ff468cfa32a0</code></pre>
92+
</div>
93+
<!-- Attach image of output -->
94+
95+
<h3>Configuration</h3>
96+
97+
<p>At any point, if you would like to change your project endpoint, project ID, project Key, or locale configuration you set during the CLI init, you can make use of the `client` service.</p>
98+
99+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="CLI">
100+
<pre class="line-numbers"><code class="prism language-bash" data-prism>appwrite client setEndpoint --endpoint="http://192.168.1.6/v1"
101+
appwrite client setProject --project="5ff450422d42f"
102+
appwrite client setKey --key="23f24gwrhSDgefaY"
103+
appwrite client setLocale --locale="en-US"</code></pre>
104+
</div>
105+
106+
<h3>Help</h3>
107+
108+
<p>If you get stuck anywhere, you can always use the `help` command to get the usage examples. All the examples are also available on the Appwrite API specs docs, and you can view them by switching the examples to the "Appwrite CLI" from the top dropdown.</p>

0 commit comments

Comments
 (0)