This guide aims to establish a consistent coding style and naming conventions among team members throughout the development process. It specifies rules for different directories within the project: apps/server
adheres to Nest.js conventions, while apps/web
and libs
follow React-based conventions.
- Do not place components inside
index.ts
. It should only be used to export components from the same directory. - If there are other directories on the same level as an
index.ts
file, export the contents of those directories'index.ts
files.
// Good
// src/components/index.ts
export * from './Button';
export * from './Card';
// Bad
// src/components/index.ts
export const Button = ...
- Component files:
<ComponentName>.jsx
- Class Files:
<ClassName>.ts
- Utility files:
<utilityName>.js
- Styles:
<ComponentName>.scss
- Controller:
<feature>.controller.ts
- Service:
<feature>.service.ts
- Module:
<feature>.module.ts
- Interface:
<feature>.interface.ts
- If a single component requires multiple files, use PascalCase for the directory name (e.g.,
UserProfile
). - For directories containing a group of related components, use lowercase with hyphens to separate words (e.g.,
action-screen
).
// Good for single component
src/components/UserProfile/
// Good for group of related components
src/components/action-screen/
When submitting a pull request, please make sure that the GitHub Actions job named test
passes successfully. This job includes unit tests, build checks, and linting.
To run the same tests as the test
job on your local machine, use the following command:
nx run-many -t lint test build
The e2e
GitHub Actions job is currently unstable. Therefore, if this job doesn't pass, it can be temporarily ignored when submitting a pull request.
To run the E2E tests locally, you can use the following command:
nx run-many -t e2e
When committing changes, please use the following prefixes to categorize the type of commit:
feat
: A new feature that you're adding to the application.fix
: A bug fix.refactor
: Code change that neither fixes a bug nor adds a feature, but improves code quality.chore
: Miscellaneous tasks that don't modify the source code or test files, such as configuration changes.test
: Adding missing tests or correcting existing tests.
Example commit messages:
feat: add login button to navbar
fix: resolve issue with user authentication
refactor: improve code readability in UserProfile component
chore: update build script
test: add unit test for login functionality