Across Indexer monorepo
You can read further details on each component's README file
Configuration packages:
@repo/eslint-config
:eslint
configurations@repo/typescript-config
:tsconfig.json
s used throughout the monorepo
Other components that need to use these configurations should include the package names in their dev dependencies and then extend the configurations from component-local configuration files. For example:
// a component package.json
{
// ...
"devDependencies": {
// ...
"eslint-config": "workspace:*",
"tsconfig": "workspace:*"
}
}
// a component tsconfig.json
{
"extends": "@repo/typescript-config/base.json",
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"],
// ...
}
// a component .eslintrc.js
module.exports = {
extends: ["@repo/eslint-config/index.js"],
// ...
};
This Turborepo has some additional tools already setup for you:
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
To install dependencies for all apps and packages, run the following command from the root of the repository:
pnpm install
Turborepo suggests to install dependencies directly in the component that uses them.
To do that, add the dependency to the package.json
of the component running the following commands from within the workspace:
pnpm add some-runtime-package
pnpm add -D some-dev-dependency-package
To add a dependency to a named workspace, regardless of the current workspace or directory, run the followig command:
pnpm add some-runtime-package --filter someworkspace
pnpm add -D some-dev-dependency-package --filter someworkspace
If you ever need to update the root package.json
, no matter what directory you’re in, you can add and remove by including the -w switch:
pnpm add -w some-runtime-package
pnpm add -wD some-dev-dependency-package
To build all apps and packages, run the following command:
pnpm build
Note: Call pnpm install
before running pnpm build
if you've added a new package or updated dependencies.
To develop all apps and packages, run the following command:
pnpm dev
To run tasks only for the components you're currently working on, you can use the --filter flag:
turbo build --filter=<component>
turbo dev --filter=<component>
This repository is configured to use Docker Compose to create a development environment with all external dependencies.
To start the development environment, run the following command:
docker-compose up
To stop the development environment, run the following command:
docker-compose down
Each application (the indexer + the api) will run in the development environment. This is
enabled by default and managed by the docker-compose.yml
file.
Example:
The development environment requires the following ENV variables to be set:
DATABASE_HOST="postgres"
REDIS_HOST="redis"
DATABASE_PORT
DATABASE_USER
DATABASE_PASSWORD
DATABASE_NAME
REDIS_PORT
Avoid putting shared code in any app. Instead, create a new package with the shared code and have the apps import it. To do so, you can use this repo's template package following instructions here.
Learn more about the power of Turborepo: