# Humand Main API Monorepo This is the main repository for Humand's backend, structured as a monorepo using pnpm for package management and Nx for build and dependency management. ## Project Structure The project is organized as a monorepo with the following workspaces: - **monolith**: Humand's main API, containing most of the business logic. - **migrations-runner**: Tool for managing and executing database migrations. - **common**: Shared code library and reusable utilities between different services. ## Prerequisites - Node.js - pnpm - Docker ## Development Environment Setup ### Installing Dependencies ```bash pnpm install ``` ## Nx Commands The syntax to run commands is the name of the project + the target - **Build specific project**: `pnpm nx run monolith:build` - **Test all projects**: `pnpm nx run-many --target=test` - **Lint specific projects**: `pnpm nx run-many --target=lint --projects=monolith,common` - **Clean nx cache**: `pnpm nx reset` ### Nx Cache Nx uses a distributed cache to speed up builds. If someone else has already built the same code, Nx will use their cached build instead of rebuilding. To enable local caching, you need to: 1. Create a `.env` file in the project root 2. Add your AWS credentials from the DEV environment: ``` AWS_ACCESS_KEY_ID=your_access_key AWS_SECRET_ACCESS_KEY=your_secret_key ``` 3. Reference `.env.example` for the correct format The CI also uses this cache, so if you build locally and push, the CI won't need to rebuild the same code. ## Pnpm commands We use pnpm workspaces, so we can run commands from the root. For example if you want to run the command lint only for the workspace common you can run `pnpm --filter common lint` ## Tests Refer to each package's specific documentation for detailed instructions on how to run tests. ## More Information Check the README.md specific to each workspace for more detailed information: - [Monolith](./humand-packages/monolith/README.md) - [Migrations Runner](./humand-packages/migrations-runner/README.md) - [Common](./humand-packages/common/README.md)