This project demonstrates how to extend Codex data on Ceramic, using a remote OrbisDB instance at https://studio.useorbis.com.
- functional code editor
- NodeJS >20
- git
- Metamask browser extension
Clone this repo with git clone https://github.com/desci-labs/codex-interop-demo.git,
then follow the instructions below.
- Make sure you have the Metamask extension in your browser.
- Visit https://studio.useorbis.com, authenticate, and wait for it to create your indexer.
- Under
Plugins, install the CODEX one. - Check
Data, you should see the productionresearch_objecttable. - Under
Model builder, define a model for something you want to associate with a research object (attestation, review, metadata, etc).
First, you need to set two local configuration values by running npm run createEnv. It will prompt your for two things:
- The environment ID from the
Contextspage in Orbis Studio. - The private key from your wallet.
- Used to sign the data published to Ceramic.
- It never leaves your computer.
Note: if the script isn't playing nice, you can copy .env.example to .env and fill it manually 💡
Then, perform these steps to create streams for your new model:
- Install deps:
npm ci. - Edit
src/create.tscarefully, according to the instructions therein. - Run
npm startto publish data instances of your newly created model.
- You should be able to see the data indexed by your new model under the Data tab in the studio.
- If you click
Open Editor, you can query it together withresearch_objectusing SQL- If you click
Manage relationson your table and fill in the values, you can use GraphQL too!
- If you click
- This demonstrates how new models can extend the functionality of Codex.
Example query:
select * from kjzl6hvfrbw6c89rybe6ua17b3qxbqlmon84k2kcqvc7z2a6u81jci25mcj1azy md
left join kjzl6hvfrbw6cbe01it6hlcwopsv4cqrqysho4f1xd7rtqxew9yag3x2wxczhz0 ro
on md."researchObjectId" = ro.stream_id;