website logo
Legacy DocsPortal
⌘K
Welcome to Ditto
Onboarding
Ditto Basics
SDK Setup Guides
Platform Manual
HTTP API
Kafka Connector
Use Cases
FAQs
Troubleshooting Guide
Support
Docs powered by
Archbee
SDK Setup Guides
JavaScript

Node.js Task App Quickstart

4min

To get started right away without having to build an app from scratch, explore with the Ditto ready-to-use demo task app.

Prerequisites

Before you can install Ditto, you must have the following:

  • Ditto access credentials
  • Node.js long-term support (LTS) version 14.x (or later)
  • Linux, macOS version 11 (or later), or Windows version 10 (or later)
  • Git
  • Integrated developer environment (IDE)
  • To get your access credentials, complete the Onboarding.
  • You can use any IDE you prefer; however, to ensure optimatibility with the platform, Ditto recommends using Visual Studio Code.

Installing the Demo Task App

To install Ditto in your environment, install and set up Ditto, and authenticate your client identity with the Big Peer:

1

Clone the getditto > samples repository from GitHub:

Bash
|
git clone https://github.com/getditto/samples.git

2

From thesamples/tasks/nodejs folder, install the required dependencies:

Bash
|
cd samples/tasks/nodejs
npm install

3

Open the project in your IDE, and then open the index.ts file. For example, if using Visual Studio Code:

Bash
|
code .

4

In line 14 of the index.ts file, replace 'YOUR_APP_ID' and 'YOUR_TOKEN' with your app ID and playground token. (Ditto Basics > Getting Your Access Credentials)

TypeScript
|
// replace YOUR_APP_ID and YOUR_TOKEN with p
ditto = new Ditto({ type: 'onlinePlayground', appID: 'YOUR_APP_ID', token: 'YOUR_TOKEN' })

5

Build the demo task app:

Bash
|
npm run build

6

Interact with the demo task app and simulate real-time peer-to-peer replication by running the demo task app in two or more separate terminals (one for each virtual peer):

Bash
|
node index.js

7

Using the commands that automatically appear in each of your terminals, add, remove, and modify documents as desired.

8

If you want to observe your changes sync with the cloud-optional deployment, the Big Peer, open the data browser in the Ditto portal.



Updated 27 Sep 2023
Did this page help you?
PREVIOUS
Installing JavaScript SDK
NEXT
Tutorials in JavaScript
Docs powered by
Archbee
TABLE OF CONTENTS
Prerequisites
Installing the Demo Task App
Docs powered by
Archbee