This repo is an example of how to use the @flowdb/* NPM packages, creating an
example chat application similar to Slack. This is what the schema looks like:
Each workspace has channels, channels have messages, and messages can be replied to with thread messages.
- Clone this repo and
cdinto the root of the repo. - Run
yarn install. - Run
yarn startto run the chat example app. - Click around and try editing some data.
src/index.tsx- entry point to the React app.src/backend/index.ts- the FlowDB backend definition, including schema and views.src/generated-types.ts- TypeScript bindings for the backend definition, generated by@flowdb/cli.
- Start the webpack dev server using
yarn startand edit anything insrc/. - To update
generated-types.tsafter changingbackend/index.ts, runyarn generate-types --watch - Build using
yarn buildto run linting, type checking and build the webpack output.
@flowdb/api: API for defining a schema, views, and connecting to the database.@flowdb/cli: CLI for generating types and deploying to the real database.@flowdb/react: Utilities for developing a React application.
- If the app crashes in the browser after some changes, try opening the dev tools > "Application" tab > "Local storage" tab > delete all entries.
