# Project Structure

Novel adopts a monorepo approach made available by NPM. Workspaces for pnpm and yarn are different to NPM as everything is hoisted to the root node\_modules. This allows to reference code easily in imports.

You can inspect Novel Web's project structure here <https://github.com/madewithnovel/next.js>

Novel API follows a similar structure

<details>

<summary>App</summary>

This is where your application lives. All business features and logic reside here. You have full control over these folders

* API - where your route handlers live. See [routing](https://docs.novel.dev/novel-server/routing "mention")
* Auth - where your auth handlers live. See [authentication](https://docs.novel.dev/novel-server/authentication "mention")
* Errors - collection of errors for your app. See [errors](https://docs.novel.dev/novel-server/errors "mention")
* Events - collection of events that is emitted from your app. See [events](https://docs.novel.dev/novel-server/events "mention")
* Features - a generic folder where you can collate features/services for your app.
* Migrations - definition of your database. See [migrations](https://docs.novel.dev/novel-server/migrations "mention")
* Models - a collection of automatically generated models based on your database. See [models](https://docs.novel.dev/novel-server/models "mention")
* Schema - a generic folder where you can store jsonschema, zod, or typebox definitions.
* Tasks - where your background tasks and cron jobs live. See [background-jobs](https://docs.novel.dev/novel-server/background-jobs "mention")
* Templates - where email templates are compiled from. See [mail](https://docs.novel.dev/novel-server/mail "mention")

You can make use of fastify conventions to add additional middlewares, plugins by exposing an `index.js`in this directory.

</details>

<details>

<summary>Config</summary>

This is where configuration of your instance lives. These are non-environment variable dependent configuration.

See [configuration](https://docs.novel.dev/novel-server/configuration "mention")

</details>

<details>

<summary>Deploy</summary>

These are utility and Infrastructure-as-code scripts useful for deployment.

See [deployment](https://docs.novel.dev/novel-server/deployment "mention")

</details>

<details>

<summary>Packages</summary>

This is where Novel core code lives. It is not advisable to modify any packages that come from this folder. Warranty covers the directories that contain the Warranty.md file.

Telemetry is sent to Novel based on errors that stem from these packages. It helps us develop Novel and determine which features need work.

See [warranty](https://docs.novel.dev/warranty "mention")

</details>

<details>

<summary>Storage</summary>

If you are not using Cloudflare or S3 for your file uploads, the default storage is the storage folder. Do not delete the .gitignore in this folder.

See [uploading-files](https://docs.novel.dev/novel-server/uploading-files "mention")

</details>

<details>

<summary>Test</summary>

Test helpers and suites live in this folder. You have full control on whether you want to collocate tests or group them in this folder.

See [testing](https://docs.novel.dev/novel-server/testing "mention")

</details>

<details>

<summary>Web</summary>

This is a placeholder directory that you can install Novel web into, and Novel API will pick up and run for you. If you wish to keep these 2 codebases separate, it is allowed.

See [with-novel-web](https://docs.novel.dev/novel-server/with-novel-web "mention")

</details>

## Changelog

* 2024-12-20 - Initial Documentation
