Appwrite Database Tutorial #1 - Intro & Setup

Net Ninja · Beginner ·🔧 Backend Engineering ·1y ago

Key Takeaways

This video tutorial introduces Appwrite, a backend-as-a-service platform, and guides viewers through setting up and using an Appwrite database, covering database creation, collection setup, and permission configuration. The tutorial utilizes tools like Appwrite, npm, and TypeScript to demonstrate a practical example of building a Notes app.

Full Transcript

all right my friends so in this course we're going to take a look at aight which is a backend as a service platform that provides a whole bunch of different services that we can use in our own applications like a nosql database authentication file storage Cloud functions and realtime capabilities plus some other things as well and I found that all of these services are really intuitive and very easy to work with now for those familiar with Firebase which is another backend as a service platform aight is an alternative to that but unlike Firebase app pright is open source and it can also be self-hosted so you can avoid that vendor lock in that you would typically get with Firebase now we're not going to be self-hosting in this series but we will be using a free hosted plan which comes with plenty of room to play around with and some generous limits and then you can always upgrade as and when your applications scale up and need more resources so then in this series we're going to be focusing on the database service and we'll also be looking at real-time capabilities of aght as well when it comes to working with the database now to demonstrate this we'll be fleshing out a Notes app like this using nextjs which is then able to interact with the ight database to retrieve data to save new data to it and also delete data from it and notice when we add a new note we see that appear in the browser in real time and that's because we've set up a real-time subscription to the database so that whenever the data changes in the database our app gets notified of that change and we can update the UI to reflect it now although I said we'll be building this with with nextjs I'm going to be keeping the focus squarely on ight since this is an ight course and for that reason I've already prepped a nextjs St project for us which we can then just add the app right logic to so you can find that stter project on this GitHub repo right here which I will leave the link to down below the video so to download it just make sure you select the starter project Branch then you can hit the code button over here to download a zip folder of all of that code incidentally I've also uploaded the code for every single lesson in this course which you can download in the same way by selecting the lesson Branch from the dropdown and then downloading a zip folder of that Branch so then once that folder is downloaded extract it and open up the contents in VSS code or some other text editor all right so I've done that now and the first thing I want to do is quickly install any project dependencies we can do that by opening up the terminal making sure you're in the root directory of the project and then just typing npm install and press enter now while that's going on I just want to give you a quick rundown of this data project so you've got a basic understanding of how this application is going to work and then we'll get right into setting up a new app right database so first of all then we have the source folder which is where all the source files are kept and in there we've got the app folder and then in here we've got a layout file and inside that layout all we do is add a link to material icons so we can use icons in this project and then we have a body tag right here which outputs the children so all the page content is going to go in inside here okay so after that we also have a page. CSX file and inside that we just have this single component and we have a header at the top of that component and two components within it the note list and also a new note form now both of those components are inside this components folder right here so the note list is to Output all of the notes that we create and the new note form is to create new notes so let's have a look at the note list uh component first of all and you can see right here we basically just take these notes in as a prop initial notes and we cycle through those in the template using the map method and we output An Li tag for each note so all we're doing is just putting out a list of the different notes that we have okay so I said we receed that as a prop and back in the page component we can see we have the initial notes defined right here which is just an empty array to begin with but later on we'll be fetching those notes from the database and passing those in as a prop okay so the other component is the new Note Form and inside here we have some State content and set content and that is hooked up to a text area inside a form so that whenever we change the value in this text area when we type then it's going to update the state to match that so we're tracking what user types in the content State now we attach a submit um Handler to this form which findes this function and inside this function is where where we're going to be adding new notes to the database later on all right so I think that's pretty much it we do also have some Global Styles right here which I've prepped just to make it look a bit better in the browser and we have also down here this types. d. TS file this is where we create a custom interface which is called notes and this is kind of the data we'll be working with which has three properties an ID Crea that and content so we're going to be working with that custom data type later on in the course as well all right so now let's run this application so we can see what it looks like in a browser to begin with to do that open up a terminal make sure you're in the correct directory and just type npm run Dev and hit enter that's going to spin up a local Dev server on Port 3000 for us and we can view the application now at this address in the browser so this is what it looks like in a browser just a title then this text area and the button at the bottom we can add a note if we want to but it's not going to do anything because it's not hooked up yet all right then so the next thing we need to do is set up a new aight database and to do that you need to go to app.io and sign up for a free account you should see a sign up link somewhere up here instead of this button once you've done that you can go to the console to create a new app right project but before we do that very quickly you can see the pricing over here so we're signing up for a free plan which is completely free and it comes with some very generous limits right here so for this tutorial and for small personal projects it's going to be absolutely fine to play around with if you do want to upgrade grade then it's going to be $15 a month to go to Pro which is quite nice all right then so if you click on this button once you've signed up to go to your console this is where you're going to manage all of your different projects that you create with aight I've already created one but I'm going to create a new one right now for this tutorial Series so let's give this a name I'm going to call it Notes app ninja all right so then we get a project ID automatically assigned to you can if you want to edit this by clicking it and giving it a different ID I'm not going to do that I'm going to click on next you can choose your region I'm going to click on create that's just going to take a second and then now we can see we've got this new Notes app ninja uh project up and running so we have access to these different services or databases functions messaging and storage what I'm going to do is go to databases because we want to set up a new database so click on this create database thing right here give the database a name I'm going to call it Notes app and also a database ID I'm going to say Notes app like so and I'm going to create this all right so we have a database and we're now inside that database you can see right here Notes app if we click on the back button this lists all of the databases so this one right here is the one we just created I'm going to click on it to go into it again and now within the database we can create a new collection so this is a no SQL database and nosql databases typically work with collections of documents where documents are very much like objects in JavaScript where they have key and value pairs so what I'm going to do is create a new collection and this collection is going to be called notes because we're going to be storing note documents inside this collection now I'm going to click on that edit button to edit the collection ID and I'm going to call this notes it can autogenerate one for you if you prefer however I'm going to keep this nice and short so that later on it's EAS easy to remember in the code all right so I'm going to create this and now we'll automatically put inside that collection what I'm going to do is go to settings oh first of all by the way you can see right here it says documents and we currently have no documents in here so what we can do is create the attributes for document object or document um rather note documents so for example every document is going to have a property called content right so the key is going to be called content the size can be how many characters we'll just say 255 and then you can add a default value for this it's going to be null in our case it's going to be required as well and then we'll create this all right so that is the attributes that documents in this collection must have we can create documents right here if we want to we're not going to do that we're going to create them programmatically from our application later on but lastly I'm going to go to settings and I'm going to scroll down right here to permissions and I'm going to add a role and go to all guests to say that any guest can create read and delete documents in this database we're not going to be working with updates in this series but if you want to you can click this as well all right so I'm going to press update you can manage your permissions differently once you get a hang of at right databases and probably authentication as well but for the sake of this series we're just going to allow any guest to create read and delete new documents all right so that is pretty much it I think L for creating this database let's go back over here to where the database is listed all right my friends so now we have a start a project up and running and also an app right database ready to work with in the next lesson we'll be installing the app right SDK into the application and using that to connect to this new database

Original Description

Appwrite is a backend-as-a-service platform, that provides database, authentication, storage, cloud functions and other services. In this Appwrite tutorial, we'll be exploring how to set up and use an Appwrite database. 🔥🥷🏼Sign up to Appwrite for free here - https://apwr.dev/netninja50 🧠🥷🏼Appwrite docs - https://appwrite.io/docs 📂🥷🏼 Access the course files on GitHub: https://github.com/iamshaunjp/appwrite-tutorial 📂🥷🏼 Starter project on GitHub: https://github.com/iamshaunjp/appwrite-tutorial/tree/starter-project
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Net Ninja · Net Ninja · 0 of 60

← Previous Next →
1 Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
2 Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
3 Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
4 GraphQL Tutorial #1 - Introduction to GraphQL
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
5 GraphQL Tutorial #2 - A Birdseye View of GraphQL
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
6 GraphQL Tutorial #3 - Project (stack) Overview
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
7 GraphQL Tutorial #4 - Making Queries (front-end preview)
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
8 GraphQL Tutorial #5 - Express App Setup
GraphQL Tutorial #5 - Express App Setup
Net Ninja
9 GraphQL Tutorial #6 - Setting up GraphQL
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
10 GraphQL Tutorial #7 - GraphQL Schema
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
11 GraphQL Tutorial #8 - Root Query
GraphQL Tutorial #8 - Root Query
Net Ninja
12 GraphQL Tutorial #9 - The Resolve Function
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
13 GraphQL Tutorial #10 - Testing Queries in Graphiql
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
14 GraphQL Tutorial #11 - GraphQL ID Type
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
15 GraphQL Tutorial #12 - Author Type
GraphQL Tutorial #12 - Author Type
Net Ninja
16 GraphQL Tutorial #13 - Type Relations
GraphQL Tutorial #13 - Type Relations
Net Ninja
17 GraphQL Tutorial #14 - GraphQL Lists
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
18 GraphQL Tutorial #15 - More on Root Queries
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
19 GraphQL Tutorial #16 - Connecting to mLab
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
20 GraphQL Tutorial #17 - Mongoose Models
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
21 GraphQL Tutorial #18 - Mutations
GraphQL Tutorial #18 - Mutations
Net Ninja
22 GraphQL Tutorial #19 - More on Mutations
GraphQL Tutorial #19 - More on Mutations
Net Ninja
23 GraphQL Tutorial #20 - Updating the Resolve Functions
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
24 GraphQL Tutorial #21 - GraphQL NonNull
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
25 GraphQL Tutorial #22 - Adding a Front-end
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
26 GraphQL Tutorial #23 - Create React App
GraphQL Tutorial #23 - Create React App
Net Ninja
27 GraphQL Tutorial #24 - Book List Component
GraphQL Tutorial #24 - Book List Component
Net Ninja
28 GraphQL Tutorial #25 - Apollo Client Setup
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
29 GraphQL Tutorial #26 - Making Queries from React
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
30 GraphQL Tutorial #27 - Rendering Data in a Component
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
31 GraphQL Tutorial #28 - Add Book Component
GraphQL Tutorial #28 - Add Book Component
Net Ninja
32 GraphQL Tutorial #29 - External Query File
GraphQL Tutorial #29 - External Query File
Net Ninja
33 GraphQL Tutorial #30 - Updating Component State
GraphQL Tutorial #30 - Updating Component State
Net Ninja
34 GraphQL Tutorial #31 - Composing Queries
GraphQL Tutorial #31 - Composing Queries
Net Ninja
35 GraphQL Tutorial #32 - query variables
GraphQL Tutorial #32 - query variables
Net Ninja
36 GraphQL Tutorial #33 - Re-fetching Queries
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
37 GraphQL Tutorial #34 - Book Details Component
GraphQL Tutorial #34 - Book Details Component
Net Ninja
38 GraphQL Tutorial #36 - Styling the App
GraphQL Tutorial #36 - Styling the App
Net Ninja
39 GraphQL Tutorial #35 - Making a Single Query
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
40 Build Apps with Vue & Firebase - Udemy Course
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
41 Updated Vue & Firebase Course (Udemy)
Updated Vue & Firebase Course (Udemy)
Net Ninja
42 Vue & Firebase Real-time Chat (Preview) #1 - Intro
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
43 Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
44 Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
45 Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
46 Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
47 Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
48 Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
49 Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
50 Object Oriented JavaScript Tutorial #1 - Introduction
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
51 Object Oriented JavaScript Tutorial #2 - Object Literals
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
52 Object Oriented JavaScript Tutorial #3 - Updating Properties
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
53 Object Oriented JavaScript Tutorial #4 - Classes
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
54 Object Oriented JavaScript Tutorial #5  - Class Constructors
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
55 Object Oriented JavaScript Tutorial #6 - Class Methods
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
56 Object Oriented JavaScript Tutorial #7 - Method Chaining
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
57 Object Oriented JavaScript Tutorial #8 - Class Inheritance
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
58 Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
59 Object Oriented JavaScript Tutorial #10 - Prototype
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
60 Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja

This tutorial covers the basics of Appwrite and guides viewers through setting up a database, creating a new project, and configuring permissions. It provides a practical example of building a Notes app using Appwrite, npm, and TypeScript. By following this tutorial, viewers can gain hands-on experience with Appwrite and improve their skills in database setup and configuration.

Key Takeaways
  1. Run the application using npm run dev
  2. Set up a new Appwrite database and create a new project
  3. Create a new database in the Appwrite console
  4. Give the database a name and ID
  5. Create a new collection within the database
  6. Set up attributes for document objects
  7. Grant permissions to guests to create, read, and delete documents
💡 Appwrite provides a simple and efficient way to set up and manage databases, making it an ideal choice for building backend applications.

Related Reads

📰
10th Anniversary of the Excelize Open Source, New ersion 2.11.0 Released
Celebrate the 10th anniversary of Excelize, an open-source library for working with XLSX files, and learn how to use its new version 2.11.0 for improved productivity
Dev.to AI
📰
TCP vs UDP, Explained — Part 1: Building a TCP Server in C++
Learn the fundamentals of TCP and build a TCP server in C++ to understand the differences between TCP and UDP
Medium · Programming
📰
The Session ID That Wouldn't Stop Changing
Learn how to troubleshoot a session ID issue in a web application and understand the importance of debugging in software development
Dev.to · Michał Iżewski
📰
Stop Data Leaks: Tenant Scopes in Laravel 🛡️
Learn how to prevent data leaks in multi-tenant Laravel applications using tenant scopes
Dev.to · Prajapati Paresh
Up next
Orchestrate Copilot: Build and Test Orchestrations with AI | Deep Dive
Workday
Watch →