Crema has a vast and professional folder structure
The folder structure is professional and easy to understand. A typical Nx workspace is structured into "apps" and "libs". This distinction allows us to have a more modular architecture by following a separation of concerns methodology, incentivizing the organization of our source code and logic into smaller, more focused, highly cohesive units. Nx automatically creates TypeScript path mappings in the
tsconfig.base.jsonfile, such that other apps or libs can easily consume them like below.
// Example of importing from the library
import AppLoader from '@crema/components/AppLoader';
Therefore, consuming libraries is very straightforward, and similar to what you might already be accustomed to in previous projects.
In Crema-4.x.x all apps will go into the apps directory. You will the starter template to start your project. You will get a minimum of four apps by default in Crema-4.x for each variant as follows.
- 1.source: app based on the context API
- 2.source-redux: app based on the Redux
- 3.source-toolkit: app based on the redux-toolkit
- 4.starter-kit: starter-kit based on the context API
You can remove the extra dependency of the project that not belongs to your project after the development is done.
A common mental model is to see the application as "containers" that link, bundle and compile functionality implemented in libraries for being deployed. As such, if we follow an 80/20 approach:
- place 80% of your logic into the
- and 20% into
apps/Crema is using an advanced folder structure like below