Monorepo for Sovryn Layer frontend app and indexer.
Requirements:
- [email protected]
- pnpm@10
- docker compose (for indexer)
Project uses nx for workspace management.
To run web-app and indexer:
pnpm install- install node modules- Adjust
.env.localinapps/web-app(optional) - Adjust
.envinapps/indexer(optional) pnpm docker:indexer- spin off redis and postgresql for the indexer (optional)pnpm serve- run both web-app and indexer in development mode
pnpm install- Adjust
.env.localinapps/web-appforVITE_API_BASEto include deployed indexer url. pnpm serve:web- runs web-app in development mode.
pnpm install- Adjust
.envinapps/indexer(optional) pnpm docker:indexer- spin off redis and postgresql for the indexer (optional)pnpm serve:indexer- run indexer in development mode.
To add new npm dependency to the app or package, use --filter flag when running pnpm to select to which project command should apply:
pnpm add lodash --filter web-app - installs lodash for web-app app.
pnpm remove lodash --filter sdk - removes lodash from sdk package.
pnpm add typescript -w -D - installs typescript to the workspace root as dev dependency.
Indexer uses drizzle-orm to work with migrations.
You may run drizzle commands on root folder of monorepo and it will be forwarded to indexer, ex: pnpm drizzle-kit studio
packages folder contains libraries that may be shared between projects. To create new packages, consult (nx documentation)[https://nx.dev/features/generate-code].
Once new package is generated, you may use that package in an app by adding it in the apps package.json file.
For example, if package generated is named as @sovryn/my-pgk and want to use it in the indexer, add "@sovryn/my-pgk": "workspace:*" to indexers package.json dependencies and run pnpm install on repositories root. Then @sovryn/my-pgk can be imported in the code normally.
packages/slayer-shared - MUST contain only code which can run in both browser and node environment and is dedicated for helper functions, interfaces and typings that should be shared between web-app and indexer.
packages/sdk - is just a placeholder right now. Likely to hold npm package with helpers to use sovryn layer for other projects in the future.