---
# System prepended metadata

title: Web5 in 5 minutes (not sure what version)

---

# Web5 in 5 minutes (not sure what version)

We’re going to build a decentralized application on the Web5 platform - in under 5 minutes.

We’ll show you how to read, write, and delete from your users' your personal data stores.

Let’s go! 🚀


## 3. Create a Decentralized Identifier (DID):

In the world of Web5, a user's unique identifier, like an email address, is called a DID.

Why?

Since we're now building decentralized apps we need an identifier that isn't tied to a centralized authority. It can be used to identify and associate a user's data across any platform.

-- 

## 4. Register your DID
Registering a user's DID gives other apps (or users) a way to find them, message them, and send them data provided they have permissions.

--

## 5. Write to Decentralized Web Node

```javascript=
const data = 'Hello Web5';

let writeResult = await web5.dwn.records.write(did.id, {
    author: did.id,
    data,
    message: {
        schema: 'test',
        dataFormat: 'image/png',
    },
});
```

Now you’re able to write / store your app's data in the user's Decentralized Web Node (DWN):

The user's DWN is their personal data store - a platform for messages, pictures, videos, medical records, and just about any content. Your app does not need to store the user's data - it should be stored in their DWN. This is how the user retains ownership over their content. 

Through permissions, users can decide which apps can read, write, and delete content from their DWN. In the near future, users will have the opportunity to replicate their DWN across their devices.

A user can host their DWN in mulitple locations. The Web5 JS library is both browser and Node.js compliant, meaning you can use the same APIs on both client side and serverside. 

## 6. Query messages in a DWN

Here’s how you’re able to query data in a DWN.

Querying a DWN allows you to search records depending on the filter params you pass to it. In the code snippet below, we're querying a DWN for messages that match the schema "test". Note that you don't have to query based on schema, there are many different attributes you can use to query, such as `dataFormat`, `protocol`, `contextId` 


```javascript=
let queryResult = await
    web5.dwn.records.query(did.id, {
        author: did.id,
        message: {
            filter: {
            schema: 'test',
        },
    },
});
```


## 7. Reading messages in a DWN

If the user has given your app read permissions to their DWN, you can read specific records using a `recordId`. In the code snippet below, we are using the `queryResult` from Step 6 to obtain the `recordId`. 


```javascript=
let readResult = await web5.dwn.records.read(did.id, {
    author: did.id,
    message: {
        recordId: queryResult.entries[0].recordId,
    },
});
```

Let's have a look at the data stored earlier:

## 8. Deleting messages from a DWN

Data can be deleted from DWNs if you have permission to do so. Similar to reading, we're using the `recordId` to remove the record.

```javascript=
let deleteResult = await web5.dwn.records.delete(did.id, {
    author: did.id,
    message: {
        recordId: queryResult.entries[0].recordId,
        },
    });
```

## Summary

Congrats! You've just created a local DWN to serve as your user's personal data store. Given a user's DID and appropriate permissions, your app can read, write, or delete data from the user's DWN, while leaving them full control of their content. Other apps can query local storage to determine if the user already has a DWN on their device, and can also read and write from this same data store - essentially, making the user's data portable across multiple applications.
