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
App
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
Auth - where your auth handlers live. See Authentication
Errors - collection of errors for your app. See Errors
Events - collection of events that is emitted from your app. See Events
Features - a generic folder where you can collate features/services for your app.
Migrations - definition of your database. See Migrations
Models - a collection of automatically generated models based on your database. See Models
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
Templates - where email templates are compiled from. See Mail
You can make use of fastify conventions to add additional middlewares, plugins by exposing an index.jsin this directory.
Config
This is where configuration of your instance lives. These are non-environment variable dependent configuration.
See Configuration
Deploy
These are utility and Infrastructure-as-code scripts useful for deployment.
See Deployment
Packages
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
Storage
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
Test
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
Web
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
Changelog
2024-12-20 - Initial Documentation
Last updated