Rust implementation of NextGraph, a Decentralized and local-first web 3.0 ecosystem https://nextgraph.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Niko PLP 947e5f5de4 error handling and sanitizing of string input for mnemonic and TextCode 4 months ago
.github Rust API for local_broker + refactor ng-wallet and apps for login + reorganize git repo 8 months ago
nextgraph error handling and sanitizing of string input for mnemonic and TextCode 4 months ago
ng-app error handling and sanitizing of string input for mnemonic and TextCode 4 months ago
ng-broker wallet import/export API and QRcode scanning from Tauri plugin 5 months ago
ng-client-ws bump version 6 months ago
ng-net fixes and improvements of QR scanning 4 months ago
ng-oxigraph wallet_recovery_pdf 4 months ago
ng-repo wallet_recovery_pdf 4 months ago
ng-sdk-js wallet_recovery_pdf 4 months ago
ng-storage-lmdb user_storage keeps repos and stores. events sent to broker on first connection 7 months ago
ng-storage-rocksdb wallet_recovery_pdf 4 months ago
ng-verifier wallet_recovery_pdf 4 months ago
ng-wallet finish recovery PDF and few fixes 4 months ago
ngaccount wallet_recovery_pdf 4 months ago
ngcli preview.3 trying to fix the docsrs issue 6 months ago
ngd move docker folder inside ngd folder 5 months ago
ngone fix translation 5 months ago
.gitignore fix: change hard-coded server ip and create note in readme 5 months ago
.prettierrc.json add prettier config 5 months ago
Cargo.lock wallet_recovery_pdf 4 months ago
Cargo.toml several fixes on Login and CreateWallet screens 5 months ago
LICENSE-APACHE2 full apache2 license 2 years ago
LICENSE-MIT copyright 2024 10 months ago
README.md wallet import/export API and QRcode scanning from Tauri plugin 5 months ago
package.json add prettier config 5 months ago
pnpm-lock.yaml merge feat/ng-app/sync-wallets with master 4 months ago
pnpm-workspace.yaml dev env is ready 1 year ago

README.md

nextgraph-header

nextgraph-rs

MSRV Apache 2.0 Licensed MIT Licensed project chat Crates.io Version docs.rs NPM Version

Rust implementation of NextGraph

This repository is in active development at https://git.nextgraph.org/NextGraph/nextgraph-rs, a Gitea instance. For bug reports, issues, merge requests, and in order to join the dev team, please visit the link above and create an account (you can do so with a github account). The github repo is just a read-only mirror that does not accept issues.

NextGraph

NextGraph brings about the convergence of P2P and Semantic Web technologies, towards a decentralized, secure and privacy-preserving cloud, based on CRDTs.

This open source ecosystem provides solutions for end-users (a platform) and software developers (a framework), wishing to use or create decentralized apps featuring: live collaboration on rich-text documents, peer to peer communication with end-to-end encryption, offline-first, local-first, portable and interoperable data, total ownership of data and software, security and privacy. Centered on repositories containing semantic data (RDF), rich text, and structured data formats like JSON, synced between peers belonging to permissioned groups of users, it offers strong eventual consistency, thanks to the use of CRDTs. Documents can be linked together, signed, shared securely, queried using the SPARQL language and organized into sites and containers.

More info here https://nextgraph.org

Support

Documentation can be found here https://docs.nextgraph.org

And our community forum where you can ask questions is here https://forum.nextgraph.org

Mastodon Twitter URL

How to use NextGraph

NextGraph is not ready yet. You can subscribe to our newsletter to get updates, and support us with a donation.

For developers

Read our getting started guide.

For contributors

On openbsd, for LLVM you need to choose llvm-17.

until this PR is accepted, will have to install wasm-pack this way:

cargo install wasm-pack --git https://github.com/rustwasm/wasm-pack.git --rev c2b663f25abe50631a236d57a8c6d7fd806413b2

then :

create a file called nextgraph/src/local_broker_dev_env.rs with the content :

pub const PEER_ID: &str = "FtdzuDYGewfXWdoPuXIPb0wnd0SAg1WoA2B14S7jW3MA";

once your ngd server will run in your dev env, replace the above string with the actual PEER ID of your ngd server.

cargo install cargo-watch
// optionally, if you want a Rust REPL: cargo install evcxr_repl
git clone git@git.nextgraph.org:NextGraph/nextgraph-rs.git
// or if you don't have a git account: git clone https://git.nextgraph.org/NextGraph/nextgraph-rs.git
cd nextgraph-rs
cargo build

Packages

The crates are organized as follow :

  • nextgraph : Client library. Use this crate to embed NextGraph client in your Rust application
  • ngcli : CLI tool to manipulate the local documents and repos and administrate the server
  • ngd : binary executable of the daemon (that can run a broker, verifier and/or Rust services)
  • ng-app : all the native apps, based on Tauri, and the official web app.
  • ng-sdk-js : contains the JS SDK, with example for: web app, react app, or node service.
  • ng-repo : Repositories common library
  • ng-net : Network common library
  • ng-verifier : Verifier library, that exposes the document API to the app
  • ng-wallet : keeps the secret keys of all identities of the user in a safe wallet
  • ng-broker : Core and Server Broker library
  • ng-client-ws : Websocket client library
  • ng-storage-rocksdb : RocksDB backed stores. see also dependency repo here
  • ngone : server for nextgraph.one. helps user bootstrap into the right app. Not useful to you. Published here for transparency
  • ngaccount : server for nextgraph's Broker Service Provider account manager. Not useful to you. Published here for transparency

Run

Build & run debug executables:

// runs the daemon
cargo run --bin ngd

// runs the client
cargo run --bin ngcli

For the apps, see the README

Test

Please test by following this order (as we need to generate some files locally)

cargo test --package nextgraph -r --lib -- local_broker::test::gen_wallet_for_test --show-output --nocapture
cargo test -r
cargo test --package nextgraph -r --lib -- local_broker::test::import_session_for_test_to_disk --show-output --nocapture --ignored

Test a single crate:

cargo test --package ng-repo --lib --  --show-output --nocapture
cargo test --package ng-wallet --lib --  --show-output --nocapture
cargo test --package ng-verifier --lib --  --show-output --nocapture
cargo test --package ng-sdk-js --lib --  --show-output --nocapture
cargo test --package ng-broker --lib --  --show-output --nocapture
cargo test --package ng-client-ws --lib --  --show-output --nocapture

Test WASM websocket

First you need to install the chromedriver that matches your version of Chrome

https://googlechromelabs.github.io/chrome-for-testing/

then:

cd ng-sdk-js
wasm-pack test --chrome --headless

Test Rust websocket

cargo test --package ng-client-ws --lib -- remote_ws::test::test_ws --show-output --nocapture

Build release binaries

First you will need to have the production build of the frontend. If you do not want to setup a whole development environment for the frontend, you can use the precompiled release of the frontend available in dist-file.tar.gz that you can download from the release page.

cd ng-app
tar -xzf dist-file.tar.gz
cd ..

Otherwise, build from source the single-file release of ng-app

npm install -g pnpm
cd ng-sdk-js
wasm-pack build --target bundler
cd ../ng-app
pnpm install
pnpm webfilebuild
cd ..

then build the ngd daemon

cargo build -r -p ngd

you can then find the binary ngd in target/release

The CLI tool can be obtained with :

cargo build -r -p ngcli

you can then use the binary target/release/ngcli

For usage, see the documentation here.

For building the apps, see this documentation.

OpenBSD

On OpenBSD, a conflict between the installed LibreSSL library and the reqwest crate, needs a bit of attention. Before compiling the daemon for OpenBSD, please comment out lines 41-42 of ng-net/Cargo.toml. This will be solved soon by using resolver = "2".

#[target.'cfg(target_arch = "wasm32")'.dependencies]
#reqwest = { version = "0.11.18", features = ["json","native-tls-vendored"] }

to use the app on OpenBSD, you need to run the daemon locally.

ngd -l 14400 --save-key

then open chrome (previously installed with doas pkg_add chrome)

env ENABLE_WASM=1 chrome --enable-wasm --process-per-site --new-window --app=http://localhost:14400

Generate documentation

Generate documentation for all packages without their dependencies:

cargo doc --no-deps

The generated documentation can be found in target/doc/nextgraph.

Contributions license

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as below, without any additional terms or conditions.

License

Licensed under either of

SPDX-License-Identifier: Apache-2.0 OR MIT


NextGraph received funding through the NGI Assure Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 957073.