https://github.com/ceramicstudio/orbisdb-express-server
https://github.com/ceramicstudio/orbisdb-express-server
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ceramicstudio/orbisdb-express-server
- Owner: ceramicstudio
- License: other
- Created: 2024-07-31T20:21:33.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-19T18:36:24.000Z (over 1 year ago)
- Last Synced: 2025-03-01T17:47:47.474Z (over 1 year ago)
- Language: Python
- Size: 593 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# OrbisDB Express Server Demo
This directory contains an example server (using Express) that displays how OrbisDB can be packaged in a simple server and made available to different environments to process http requests.
## OrbisDB Studio
You can use the [OrbisDB Hosted Studio](https://studio.useorbis.com/) to get up and running easily with this demo. You always have the option to move over to a standalone instance after.
## Getting started
To get up and running and start experimenting with this server:
1. Install the dependencies from the root of this directory:
```bash
npm install
```
2. Create a copy of the example environment file:
```bash
cp .env.example .env
```
We will fill in the corresponding values in the following steps
3. Create a private Ceramic seed you will use to perform write operations on Ceramic. This seed will be used by the OrbisDB SDK to instantiate a DID (Decentralized Identifier) that will appear as the sole controller of the content you write.
Invoke the following command to create one:
```bash
npm run generate
```
Copy the corresponding value from your server console log into your new `.env` file next to `CERAMIC_PRIVATE_KEY`.
4. After logging into the [Hosted OrbisDB Studio](https://studio.useorbis.com/) you will see relevant information on the right-hand side in a box called "Setup."
In your `.env` file, make the following assignments:
ENV_ID: (Value under "Environment ID" in the studio)
INSTANCE_URL: (Value under "OrbisDB Instance URL")
CERAMIC_URL: (Value under "Ceramic Node URL")
5. In the same page, set up a new context by clicking the blue `+ Add context` button. Copy the corresponding ID into your `.env` file and assign it to `CONTEXT_ID`.
6. Finally, go to the "Model builder" tab of your studio view and create a new model using the definition below:
```SQL
-- LIST accountRelation
table validation_assignments {
stream_id text -- The stream id of the post - auto-generated (do not define when creating table)
controller text -- The DID controller of the post - auto-generated (do not define when creating table)
data text
score number
status number
stake_id number
created_at DateTime
updated_at DateTime
assigned_at DateTime
validated_at DateTime
validation_phase text
task_submission_id number
}
```
7. You are now ready to run the server! Run the following command in your terminal:
```bash
npm run dev
```
Your server is now accessible and running on local port 8080.
## License
Dual licensed under MIT and Apache 2