ContentQL ContentQL Docs

Project structure

This page provides you an overview of the folder and files conventions in creating contentql themes, as well as tips for organizing your project.


Folder and file conventions

The contentql project structure is similar to what you've seen in payload cms with pre-default media, users and blogs collections.

Top level Folders

FoldersDescription
actionsauthentication using next safe actions
appNext.js app folder
componentsAll the components related logic
emailsResend Emails templates
payloadpayload cms folder
scriptsscripts related code
seedseeding process
trpctypescript RPC mutation related code
utilsutilies folder

Below is an overview of the folder structure to help you understand how Next.js is organized within ContentQL. The (app) folder contains the UI-related code.

Folder Descriptions

Folder NameDescription
(app)/(account)Contains account-related logic
(app)/(auth)Handles authentication functionality
(app)/(marketing)Contains logic for rendering marketing blocks
(payload)/(admin)payload admin code
(payload)/(api)api related logic

To learn more about folder naming conventions, refer to the official Next.js documentation:

Top-Level Files

Here are the key configuration files located at the root of the project:

File Name
.env.exampleRequired environment variables
next.config.tsConfiguration file for Next.js
package.jsonProject dependencies and scripts
payload-types.tsAutomatically generated types
payload.config.tsConfiguration file for Payload CMS
tailwind.config.tsConfiguration file for tailwind css
tsconfig.jsonConfiguration file for typescript

Payload CMS Folder Structure

The Payload CMS folder structure is integrated into the src/payload directory. This directory contains two important subfolders: blocks and style, with the blocks folder housing the components used throughout the application.

package.json
next.config.mjs

Organizing your project

Blocks Folder Structure

The blocks folder is a key component in theme development. Within this folder, you can organize your blocks based on the specific theme you are building. For example, when developing a blog theme, you might create folders such as Hero, FeaturedPosts, and LatestPosts to structure your blocks accordingly.

Each block is represented as a folder, which contains two core files:

  • Component.tsx
  • config.ts

Naming Conventions for Block Files

Each block folder in the blocks directory follows a standardized naming convention for the files it contains:

File NameDescription
Component.tsxContains the UI logic and presentation for the block.
config.tsDefines the block’s configuration, including its slug and other necessary settings.

For more information on defining slugs in config.ts, refer to the Payload CMS Fields documentation.

Collections

By default, you'll get a few collections such as media, blogs, users, pages, tags.

On this page