-{"page_content": "[{\"level\": 1, \"title\": \" Getting Started for Web \", \"body\": [\"Appwrite is a development platform that provides a powerful API and management console to get your next project up and running quickly.\", \"Create your first project now and start building on Appwrite Cloud.\"]}, {\"level\": 2, \"title\": \"Add Your Web Platform\", \"body\": [\"To init your SDK and interact with Appwrite services, you need to add a web platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before and click the 'Add Platform' button.\", \"From the options, choose to add a web platform and add your client app hostname. By adding your hostname to your project platform, you are allowing cross-domain communication between your project and the Appwrite API. Only web apps hosted on domains specified in a web platform will be able to make requests to your Appwrite instance, preventing unwanted access from malicious actors.\", \"Web platforms allow wildcard hostnames through a * character. The wildcard character can be applied anywhere in a hostname, both *.example.com and prod.*.example.com are valid examples. Avoid using wildcards unless necessary to keep your Appwrite project secure.\"]}, {\"level\": 2, \"title\": \"Get Appwrite Web SDK\", \"body\": []}, {\"level\": 3, \"title\": \"NPM\", \"body\": [\"Use NPM (node package manager) from your command line to add Appwrite SDK to your project.\", \" npm install appwrite\", \"When you're using a bundler (like Browserify or Webpack), import the Appwrite module when you need it:\", \" import { Client, Account, ID } from 'appwrite';\"]}, {\"level\": 3, \"title\": \"CDN\", \"body\": [\"To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services:\", \" <script src=\\\"https://cdn.jsdelivr.net/npm/appwrite@11.0.0\\\"></script>\\n<script>\\n const { Client, Account, ID } = Appwrite;\\n // Your code below...\\n</script>\"]}, {\"level\": 2, \"title\": \"Init your SDK\", \"body\": [\"Initialize your SDK code with your project ID which can be found in your project settings page.\", \" const client = new Client()\\n .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint\\n .setProject('[PROJECT_ID]'); // Your project ID\\n\"]}, {\"level\": 2, \"title\": \"Make Your First Request\", \"body\": [\"After your SDK configuration is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would use is found in the SDK documentation or in the API References section.\", \" const account = new Account(client);\\n\\n// Register User\\naccount.create(\\n ID.unique(),\\n 'me@example.com',\\n 'password',\\n 'Jane Doe'\\n).then(response => {\\n console.log(response);\\n}, error => {\\n console.log(error);\\n});\"]}, {\"level\": 2, \"title\": \"Listen to Changes\", \"body\": [\"To listen to changes in realtime from Appwrite, subscribe to a variety of channels and receive updates within milliseconds. Full documentation for Realtime is found here.\", \" // Subscribe to files channel\\nclient.subscribe('files', response => {\\n if(response.events.includes('buckets.*.files.*.create')) {\\n // Log when a new file is uploaded\\n console.log(response.payload);\\n }\\n});\"]}, {\"level\": 2, \"title\": \"Full Example\", \"body\": [\" import { Client, Account, ID } from \\\"appwrite\\\";\\n\\nconst client = new Client()\\n .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint\\n .setProject('[PROJECT_ID]'); // Your project ID\\n\\nconst account = new Account(client);\\n\\n// Register User\\naccount.create(\\n ID.unique(),\\n 'me@example.com',\\n 'password',\\n 'Jane Doe'\\n).then(response => {\\n console.log(response);\\n}, error => {\\n console.log(error);\\n});\\n\\n// Subscribe to files channel\\nclient.subscribe('files', response => {\\n if(response.events.includes('buckets.*.files.*.create')) {\\n // Log when a new file is uploaded\\n console.log(response.payload);\\n }\\n});\"]}, {\"level\": 2, \"title\": \"Demos\", \"body\": [\"Below is a list of some demos to help you get started with Appwrite for Web using your favorite tools and framework of choice.\", \" Demo GitHub Repository Todo App with React JS appwrite/todo-with-react Live Example Todo App with Vue JS appwrite/todo-with-vue Live Example Todo App with Angular appwrite/todo-with-angular Live Example Todo App with Svelte appwrite/todo-with-svelte Live Example \"]}]", "metadata": {"source": "https://appwrite.io/docs/getting-started-for-web"}}
0 commit comments