-
Notifications
You must be signed in to change notification settings - Fork 2
WIP: Node.js Client SDK Tutorial #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
## Introduction | ||
In this tutorial, we’ll explore how to create a new Node.js applicaiton with TypeScript and PowerSync for offline-first capabilities. In the following sections, we’ll walk through the process of integrating PowerSync into a Node.js application, setting up local-first storage, and handling synchronization efficiently. | ||
|
||
## Prerequisits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a Warning
note to make it stand out
|
||
## Setup | ||
|
||
### Creating a new project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This section could be merged into Project Setup
... | ||
``` | ||
|
||
<Note>The PowerSync Node.js SDK requires `@powersync/better-sqlite3` to be installed</Note> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A link to thee PowerSync Node.js SDK would be helpful. Not sure if this is the right place for it though.
|
||
### Adding PowerSync | ||
|
||
Create a `src` directory and add three files: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a `src` directory and add three files: | |
Create a `src` directory and add the following three files: |
``` | ||
|
||
#### Connector.ts | ||
This file will be the connector which will fetch a JWT used by PowerSync for authentication and another function which will handle uploads to the backend source database. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file will be the connector which will fetch a JWT used by PowerSync for authentication and another function which will handle uploads to the backend source database. | |
This file will serve as the connector, responsible for retrieving a JWT for PowerSync authentication and providing a function to handle uploads to the backend source database. |
``` | ||
|
||
#### index.ts | ||
The main application file used in this guide to show you how to set up and initialize PowerSync. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main application file used in this guide to show you how to set up and initialize PowerSync. | |
The main application file used in this guide which demonstrates how to set up and initialize PowerSync. |
This will start the app, initialize the database and connect to the PowerSync instance. | ||
|
||
<Warning> | ||
Depending on what you set for `dbFilename`, the app start (and all is working correctly) three files will be created; `<dbFilename>.db`, `<dbFilename>.db-shm` and `<dbFilename>.db-wal`. You should exclude these from version control when creating the project so make sure to update your `.gitignore` accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little confusing
the app start (and all is working correctly) three files will be created;
## Introduction | ||
In this tutorial, we’ll explore how to create a new Node.js applicaiton with TypeScript and PowerSync for offline-first capabilities. In the following sections, we’ll walk through the process of integrating PowerSync into a Node.js application, setting up local-first storage, and handling synchronization efficiently. | ||
|
||
## Prerequisits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Prerequisits | |
## Prerequisites |
This PR introduces a "from scratch" node.js tutorial for developers. This is WIP and needs more polish.