Skip to content

Salmandabbakuti/wave

Repository files navigation

👋 Wave - Decentralized, Portable, and Ownable link hub

Wave is a decentralized, portable and ownable link hub that allows you to manage and share all your important links from one central location. With Wave, you have full control over your online identity and content, Effortlessly share your creations across Instagram, Facebook, X(Formerly Twitter), YouTube, and more—all with one simple link.

Screen1

Screen2

Getting Started

Database Setup

Setup Database schema and ACL

{
  "type": "object",
  "required": ["name", "username"],
  "properties": {
    "name": {
      "type": "string"
    },
    "bio": {
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "avatar": {
      "type": "string"
    },
    "links": {
      "type": "object",
      "required": [],
      "properties": {
        "facebook": {
          "type": "string"
        },
        "youtube": {
          "type": "string"
        },
        "github": {
          "type": "string"
        },
        "snapchat": {
          "type": "string"
        },
        "telegram": {
          "type": "string"
        },
        "discord": {
          "type": "string"
        },
        "farcaster": {
          "type": "string"
        },
        "blockchain": {
          "type": "string"
        },
        "linkedin": {
          "type": "string"
        },
        "x": {
          "type": "string"
        },
        "instagram": {
          "type": "string"
        },
        "other": {
          "type": "string"
        }
      }
    },
    "owner": {
      "type": "string"
    }
  }
}

Copy the above schema and create a new schema in the collection by following the instructions in the WeaveDB Schema SetupDocs.

Setup ACL

{
  "let create": {
    "resource.newData.createdAt": {
      "var": "request.block.timestamp"
    },
    "resource.newData.owner": {
      "var": "request.auth.signer"
    }
  },
  "let update": {
    "resource.newData.updatedAt": {
      "var": "request.block.timestamp"
    }
  },
  "allow create": {
    "and": [
      {
        "==": [
          { "var": "request.auth.signer" },
          { "var": "resource.newData.owner" }
        ]
      },
      {
        "==": [
          { "var": "request.block.timestamp" },
          { "var": "resource.newData.createdAt" }
        ]
      },
      {
        "==": [
          { "var": "request.block.timestamp" },
          { "var": "resource.newData.updatedAt" }
        ]
      }
    ]
  },
  "allow update": {
    "and": [
      {
        "==": [{ "var": "request.auth.signer" }, { "var": "resource.setter" }]
      },
      {
        "==": [
          { "var": "resource.data.username" },
          { "var": "resource.newData.username" }
        ]
      },
      {
        "==": [
          { "var": "request.block.timestamp" },
          { "var": "resource.newData.updatedAt" }
        ]
      }
    ]
  },
  "allow delete": {
    "==": [{ "var": "request.auth.signer" }, { "var": "resource.setter" }]
  }
}
  • Here, we are allowing createdAt and updatedAt fields to be set automatically when a new record is created or updated. We are also assigning the owner field to the signer of the transaction.
  • The create operation is allowed only if the signer is the owner of the record and the createdAt and updatedAt fields are equal to the current block timestamp.
  • The update operation is allowed only if the signer is the setter of the record and the username field is not changed.
  • The delete operation is allowed only if the signer is the setter of the record.

Copy the above ACL and create a new ACL in the collection by following the instructions in the WeaveDB ACL Setup Docs using web console.

Start the Next.js app

Copy the .env.example file to .env and fill in the required fields.

npm install
npm run dev

Open http://localhost:3000 with your browser to see the result.

Demo

Screen1 Screen2 Screen3

Built With

  • Weave DB - A decentralized NoSQL database system that uses the Arweave network as its underlying storage layer. It is designed to offer a scalable, secure, and fast solution for data storage.
  • Next.js - Next.js is a flexible React framework that gives you building blocks to create fast, full-stack web applications.
  • Ant Design - An enterprise-class UI design language and React UI library with a set of high-quality React components, one of best React UI library for enterprises.

Credits & Resources

Safety

This is experimental software and subject to change over time.

This is a proof of concept and is not ready for production use. It is not audited and has not been tested for security. Use at your own risk. I do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.