arbase
Arbase is a tool to create object-based APIs on top of arweave in mere minutes
What does it do?
It allows you to generate APIs from a simple JSON format
Example
{
"post": {
"attributes": {
"title": {
"type": "string",
"maxSize": 1000,
"notNull": true,
"modify": [
"$.creator",
"$~moderators"
]
},
"content": {
"type": "string",
"maxSize": 10000,
"notNull": true,
"modify": [
"$.creator",
"$~moderators"
]
},
"replies": {
"type": "post[]",
"append": [
"$.creator",
"*",
"!#~blacklisted",
],
"delete": [
"$$.creator",
"#"
]
},
"acl": {
"moderators": {
"fixed": [
"#~moderators"
]
}
}
}
},
"topic": {
"attributes": {
"title": {
"type": "string",
"maxSize": 1000,
"notNull": true,
"modify": [
"$~moderators"
]
},
"description": {
"type": "string",
"maxSize": 1000,
"notNull": true,
"modify": [
"$~moderators"
]
},
"posts": {
"type": "post[]",
"append": [
"*",
"#~blacklisted"
]
},
"topics": {
"type": "topic[]",
"append": [
"$~moderators"
],
"delete": [
"$~moderators"
]
}
},
"acl": {
"moderators": {
"initial": [
"$creator"
],
"fixed": [
"#~moderators"
],
"append": [
"$~moderators"
],
"delete": [
"$~moderators"
]
},
"blacklisted": {
"fixed": [
"#~blacklisted"
]
}
}
},
"board": {
"attributes": {
"name": {
"type": "string",
"maxSize": 1000,
"notNull": true,
"modify": [
"$~moderators"
]
},
"description": {
"type": "string",
"maxSize": 1000,
"notNull": true,
"modify": [
"$~moderators"
]
},
"topics": {
"type": "topic[]",
"append": [
"$~moderators"
],
"delete": [
"$~moderators"
]
}
}
"acl": {
"moderators": {
"fixed": [
"$creator"
],
"append": [
"$~moderators"
]
},
"blacklisted": {
"fixed": [
"!$creator"
],
"append": [
"$~moderators"
]
}
}
},
"@main": "board"
}
Good to know
- The
$.creator
permission might be dangerous
- It is valid even when a blacklist entry applies in specific conditions. Therefore it's better to not add it when using anyone (
*
), or make it the initial content of an acl, so it can be revoked later when needed.
Todo
Now
Future
- ACLs
- Rate-limiting
- Native "file" field that links to an arweave file-block
Backwards compatibility
- The removal of an attribute causes it to simply be ignored on verification, so attributes can be safely deleted
- Note that all elements that do not contain at least one valid attribute are ignored. But this shouldn't be an issue since they are obsoleted in that case, except if the creation is followed by edits that do introduce valid elements)
- The change of an ACL initial/fixed set could invalidate entries if not done carefully
- Same goes for the removal of a complete ACL
- The addition of an ACL usually doesn't change anything