Skip to main content

Project structure

What you'll learn
  • How Foscia files are organized inside your projects

Foscia files are organized in an opinionated manner. This keeps your project directory structure clean and allow Foscia to provide better features when using the CLI, such as:

  • Suggesting composables or transformers to use when making models or composables using foscia make model or foscia make composable.
  • Importing available files (models.ts, action.ts, makeModel.ts, etc.) when generating other files (such as models, some frameworks integration files).

Example project structure

Your Foscia files are stored in one directory you choose when initiating your project using foscia init.

Here is an example of a Nuxt v4 project using Foscia and storing Foscia's related files into app/data directory.

root-path/
└── app/
└── data/
├── composables/
│ ├── commentable.ts
│ └── publishable.ts
├── models/
│ ├── comment.ts
│ ├── gallery.ts
│ └── post.ts
├── enhancers/
│ └── withCount.ts
├── runners/
│ └── firstOrFail.ts
├── loaders/
│ ├── loadUsingRelation.ts
│ └── loadMissingUsingRefresh.ts
├── transformers/
│ └── toMomentDatetime.ts
├── utils/
│ ├── reducer.ts
│ └── reviver.ts
├── action.ts
├── models.ts
└── makeModel.ts

Structure description

PathDescription
composables/Composables.
models/Models.
loaders/Relationship loaders.
enhancers/Action enhancers.
runners/Action runners.
transformers/Transformers.
utils/Other utilities files, such as model reducer and model reviver.
action.tsExport an action factory.
models.tsExport an array of available models, to be used by registry or other files.
makeModel.tsExport a model factory.