https://github.com/orbitdb/examples
Implementing OrbitDB on various Javascript platforms.
https://github.com/orbitdb/examples
Last synced: 10 months ago
JSON representation
Implementing OrbitDB on various Javascript platforms.
- Host: GitHub
- URL: https://github.com/orbitdb/examples
- Owner: orbitdb
- License: mit
- Created: 2023-08-18T11:59:00.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-05T19:00:56.000Z (over 2 years ago)
- Last Synced: 2024-11-08T09:38:48.765Z (over 1 year ago)
- Language: JavaScript
- Size: 1.52 MB
- Stars: 3
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# OrbitDB Examples
This repository contains some basic examples on how to implement OrbitDB in Javascript using various methods and frameworks.
## Usage
Different frameworks and implementations are provided. Below are installation and usage details for each example.
To start, check out this repository:
```bash
git clone https://github.com/orbitdb/orbitdb-examples.git
```
### Nodejs
Bundle OrbitDB in a node application.
The Node.js demo provides an example of how OrbitDB uses IPFS to replicate records across peers.
Install the 3rd party NPM packages and run the example:
```bash
cd ./nodejs
npm i
```
Run two terminal windows, terminal 1 and terminal 2.
In terminal 1, run the following:
```bash
node index.js
```
Once running, an OrbitDB address will be printed in the form /orbitdb/. Copy this before moving on to the next step.
In terminal 2, run index.js, passing the OrbitDB address you copied from the other window:
```bash
node index.js /orbitdb/
```
You should see the second peer add a record which the first peer should also print to the screen.
To close the peers and exit the two instances of the daemon, press ctrl+c in each of the terminal windows.
### Browser
Run OrbitDB as a simple web app.
Launch a local web server. For example, you can use the [Python's HTTP server](https://docs.python.org/3/library/http.server.html):
```
cd ./browser
python3 -m http.server 8081
```
Browse to http://localhost:8081/
### Browser ES
Run OrbitDB as a simple web app for ES compatible browsers (e.g. ).
Launch a local web server. For example, you can use the [Python's HTTP server](https://docs.python.org/3/library/http.server.html):
```
cd ./browser-es
python3 -m http.server 8081
```
Browse to http://localhost:8081/
### Webpack
Integrate OrbitDB with a webpacked app.
Install the 3rd party NPM packages:
```
cd ./webpack
npm i
```
Launch a local web server. For example, you can use the [Python's HTTP server](https://docs.python.org/3/library/http.server.html):
```
python3 -m http.server 8081
```
Browse to http://localhost:8081/
### React
Integrate OrbitDB in a ReactJS app.
Install the 3rd party NPM packages and run:
```
cd ./react
npm i
npm run start
```
Browse to the specified localhost URL in your web browser.
### Vue + Vite
Integrate OrbitDB in a VueJS app.
Install the 3rd party NPM packages and run:
```
cd ./vue-vite
npm i
npm run dev
```
Browse to the specified localhost URL in your web browser.
## License
[MIT](LICENSE) © 2023 OrbitDB Community