This is the monorepo containing all Stanza JavaScript packages and samples.
Refer to the README.md
file linked to each sample, and the Stanza Docs.
samples/express-demo
- Express (Node) sample, showing Stanza guards. (Good first sample to start with.)samples/next-with-stripe
- Next.js sample that uses the Stripe React component.samples/react-simple
- Simple React sample appsamples/simple-next
- Simple Next.js sample app
The following samples are used primarily during Stanza development, and are works in progress:
samples/browser-simple
- Browser sample app using a mocked hubsamples/hub-mock-api
- Express sample app using a mocked hub
packages/core
- Stanza JS core library, used by browser, node, and other packagespackages/browser
- Stanza browser SDKpackages/mobile
- Stanza mobile SDKpackages/sdk-node
- Stanza Node SDKpackages/sdk-cloudflare
- Stanza Cloudflare SDK
packages/next
- Stanza components for Next.jspackages/next-node
- Stanza Node SDK adapter for Next.jspackages/stanza-react
- Stanza React componentspackages/stanza-rn
- Stanza React Native componentspackages/mocks
- Stanza mocks for use in development and testing
Stanza JS uses the following tools, which you should familiarize yourself with:
Throughout this document, we'll assume that Nx is not installed globally and use npx nx
.
If you prefer to install Nx globally,
you can use nx
instead of npx nx
anywhere that it is mentioned.
Install all dependencies for the monorepo:
npm install
If you get deprecation or vulnerability warnings, they are likely from our development dependencies only, and unrelated to Stanza packages.
To be certain, you can run npm audit --omit=dev
which should find 0 vulnerabilities. If this is not the case, please
open an issue.
After everything is installed, you can build all of the packages and sample applications:
npx nx run-many --target build
If you prefer, you can build a single sample application, including its dependent packages. For example:
From the repository root:
npx nx build express-demo
Or, from a specific directory:
cd samples/express-demo
npx nx build
Running a sample application is similar to building, but uses the serve
target:
From the repository root:
npx nx serve express-demo
Or, from a specific directory:
cd samples/express-demo
npx nx serve
By default, these samples will run in development mode. Saving a file will restart the application.
To add a new package:
npx nx generate @nx/js:library {your package name} --publishable --importPath @getstanza/{your package name}
To add a sample app, you can use one of the available Nx packages as a starter template.
Some examples:
npx nx generate @nx/next:app {your app name}
npx nx generate @nx/web:app {your app name}
npx nx generate @nx/react:app {your app name}
Because we manage the repository as a monorepo with Nx, all dependencies should be installed from the root directory.
Stanza supports only evergreen browsers, and Node releases in current, active, or maintenance phases.