Skip to content

An example project utilizing @redwood.dev/react to communicate with a Redwood node

Notifications You must be signed in to change notification settings

redwood/redwood-example-react

Repository files navigation

Getting started with Redwood React

@redwood.dev/react documentation
@redwood.dev/client documentation

Table of contents

  1. Obtain the Redwood binary
  2. Run Redwood
  3. Create a state tree
  4. Start the frontend dev server
  5. Going to production
  6. Chat with friends over the P2P network

Obtain the Redwood binary

Download binary from Github

Binaries are available for all platforms (Mac, Linux, Windows) at https://github.com/redwood/redwood/releases

Build from source

Requires Go 1.18. See the following resources to install Go:

$ git clone https://github.com/redwood/redwood
$ cd redwood/embed
$ yarn && yarn build
$ cd ../cmd/redwood
$ go build .

Run Redwood

$ redwood -p password.txt -c .redwoodrc

Create a state tree

$ node setup.js

As you develop your application, you can modify this script just as you would modify a traditional database migration.

Start the frontend dev server

$ yarn && yarn start

Going to production

Once you have a stable build of your application, you can upload your assets directly to the Redwood node, which will serve them like any other web server.

Build the application:

$ yarn build

Run the provided upload-assets.js script:

$ node upload-assets.js

And navigate to http://localhost:8080.

Chat with friends over the P2P network

After uploading your assets to your node, you and your friends can chat with one another over the peer-to-peer network managed by the node.

Your friends will simply need to:

  1. Download (or build) Redwood
  2. Run it (they can use the .redwoodrc config file from this repository, although the default Redwood config should work equally well)
  3. Once Redwood is started, ask your friends to run the following command in the Redwood console:
    tree subscribe example.project/foo
  4. All of the nodes will begin syncing. After a few moments, your friends will be able to navigate to http://localhost:8080 to chat with you.

About

An example project utilizing @redwood.dev/react to communicate with a Redwood node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published