Contributor's Guide
Project Structure

Project Structure

This page provides an overview of the project structure of Circuit Parts application. It covers top-level files and folders, configuration files, and routing conventions within the app and pages directories.

Top-Level Folders

Top-level folders are used to organize your application's code and static assets.

PathDescription
appNextjs App Router
componentsReact components for the website
contentThe content and static data for the website
contextReact context hooks for state management
libUtility functions used by the application
pagesNextjs Pages Router
publicStatic assets to be served
typesTypescript type definitions and interfaces
.huskyTool for managing git hooks

Top-Level Files

Top-level files are used to configure your application, manage dependencies, run middleware, integrate monitoring tools, and define environment variables.

FileDescription
next.config.jsConfiguration file for Next.js
package.jsonProject dependencies and scripts
middleware.tsNext.js request middleware
.envEnvironment variables
.env.localLocal environment variables
.env.productionProduction environment variables
.env.developmentDevelopment environment variables
.eslintrc.jsonConfiguration file for ESLint
.eslintignoreConfiguration file for ESLint to ignore specific files/folders
.gitignoreGit files and folders to ignore
tsconfig.jsonConfiguration file for TypeScript
tailwind.config.tsConfiguration file for Tailwind CSS
env.jsConfiguration file for Environmental Variables

Routing files

The following file conventions are used to define routes app router (opens in a new tab)

RouteExtensionDescription
layout.tsxLayout
page.tsxPage
loading.tsxLoading UI
not-found.tsxNot found UI
error.tsxError UI
route.tsAPI endpoint

Nested Route Conventions

RouteDescription
folderRoute segment
folder/folderNested Route segment

Good to know: The following naming conventions are used for nested routes:

  • If the route name is a single word: folder. Example: checkout
  • If the route name uses multiple words: folder-folder. Example: order-history

SEO File Conventions

FileExtensionDescription
favicon.icoFavicon file
sitemap.tsDynamic site map generater
robots.txtRobots file for search engines

Lib Folder

File/DirectoryDescription
constantsGlobal constants used by the application
reduxRedux reducers and config files
schemaYup and zod schema files
server-actionsNextjs server actions
utils.tsUtility functions used accross the application.