Command-line-tool to easily create update and share your p2panda
schemas.
fishy
parses your current version of your schemas and matches it with
previous ones to calculate the difference and apply changes automatically.
Your schema changes are committed to a schema.lock
file which you can share
with other developers. With fishy
they will be able to deploy the same schema
on their nodes.
Create, manage and deploy p2panda schemas
Usage: fishy <COMMAND>
Commands:
init Initialises all files for a new fishy project in a given folder
build Automatically creates and signs p2panda data from a key pair and the defined schemas
deploy Deploy created schemas on a node
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
# Initialise a new schema, this creates a `schema.toml` file you can edit
fishy init
# Same as above, but in a different folder and with the name already defined
fishy init -n icecream ~/dev/schemas
# Commit any changes to the schema, this updates your `schema.lock` file
fishy build
# Only inspect the current status of your schemas, do not commit anything
fishy build --inspect
# Deploy commits to external node
fishy deploy --endpoint http://localhost:2020/graphql
Check out our Releases section.
For the following steps you need a Rust development environment on your machine.
# Download source code
git clone https://github.com/p2panda/fishy.git
cd fishy
# Compile binary
cargo build --release
# Copy binary into your path (for example)
cp ./target/release/fishy ~/.local/bin
fishy init
. A dialogue will ask you for
the name of your first schema. Enter a name, for example cafe
and press
enter. You will now find a schema.toml
and secret.txt
file in
your folder.Edit schema.toml
with any text editor. Follow the format to specify
multiple schemas, their fields, types and relations to each other. For
example:
[cafe]
description = "A list of cafes"
[cafe.fields]
name = { type = "str" }
address = { type = "str" }
opening_year = { type = "int" }
[icecream]
description = "Icecream sorts you can get in cafes"
[icecream.fields]
name = { type = "str" }
sweetness = { type = "str" }
cafes = { type = "relation_list", schema = { name = "cafe" } }
schema.lock
by running fishy build
.
The tool will automatically show you the changes which will be committed and
ask for your confirmation. Hit y
to confirm. This step will generate,
encode and sign the commits with your private key stored in secret.txt
.schema.lock
. You can go back to
the schema.toml
file and do any changes to the schema, run fishy build
again to apply them. The tool will again only show you exactly what you've
changed and generate the commits for only exactly these changes. Try it out!fishy deploy
.
Make sure you have a node running
somewhere.schema.lock
file with others, with it they will be able to
deploy the schemas on their nodes!GNU Affero General Public License v3.0 AGPL-3.0-or-later
This project has received funding from the European Union’s Horizon 2020 research and innovation programme within the framework of the NGI-POINTER Project funded under grant agreement No 871528