# 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](/novel-server/routing.md)
* Auth - where your auth handlers live. See [Authentication](/novel-server/authentication.md)
* Errors - collection of errors for your app. See [Errors](/novel-server/errors.md)
* Events - collection of events that is emitted from your app. See [Events](/novel-server/events.md)
* Features - a generic folder where you can collate features/services for your app.
* Migrations - definition of your database. See [Migrations](/novel-server/migrations.md)
* Models - a collection of automatically generated models based on your database. See [Models](/novel-server/models.md)
* 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](/novel-server/background-jobs.md)
* Templates - where email templates are compiled from. See [Mail](/novel-server/mail.md)

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](/novel-server/configuration.md)

</details>

<details>

<summary>Deploy</summary>

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

See [Deployment](/novel-server/deployment.md)

</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](/warranty.md)

</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](/novel-server/uploading-files.md)

</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](/novel-server/testing.md)

</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](/novel-server/with-novel-web.md)

</details>

## Changelog

* 2024-12-20 - Initial Documentation


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.novel.dev/novel-server/project-structure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
