Filenames
Last updated
Last updated
By default, filenames should match the name of the declaration being exported, but in kebab-case. Common exceptions include:
Page-related files
page.tsx, layout.tsx
(filenames are lowercase)
Types/Interfaces
the file is often named types.ts
and will export multiple local types
Schemas
the file is often named schemas.ts
and will export multiple local schemas
Constants
the file is often named constants.ts
and will export multiple local constants
We follow the
Filename:
layout.tsx
Declaration:
export default function Layout() {...}
Location:
~/pages/x/layout.tsx
Filename:
page.tsx
Declaration:
export default function Page() {...}
Location:
~/pages/x/page.tsx
kebab-case, .tsx
Filename:
noun-adjective.tsx
Declaration:
export function NounAdjective() {...}
Location:
database-related: components/database folder
~/components/database/x/_components/...
Learn more about the "database folder" system
reusable/app-wide:
Storybookized: components/storybook folder
~/components/storybook/noun-adjective/noun-adjective.tsx
// TODO: Learn more about Storybookizing components here
Non-Storybookized: components folder
standalone, simple:
~/components/noun-adjective.tsx
standalone, complex:
~/components/noun-adjective/noun-adjective.tsx
Learn more about "component folders" here
folder of related components:
~/components/related-components/noun-adjective.tsx
local: _components folder
component-folder/_components/noun-adjective.tsx
Learn more about "local" components here
kebab-case, .ts
(generally)
Filename:
function-name.ts
(.tsx
as needed)
Declaration:
export function functionName() {...}
Location:
reusable/app-wide: helpers folder
~/helpers/function-name.ts
local: _lib folder
component-folder/_lib/function-name.ts
Filename:
use-x.ts
(.tsx
as needed)
Declaration:
export function useX() {...}
Location:
reusable/app-wide: hooks folder
~/hooks/use-x.ts
local: _lib folder
component-folder/_lib/use-x.ts
Filename:
types.ts
Declaration:
database-related:
export type TDoc = ...
exported props:
export interface ComponentProps {...}
all other:
export interface TRelevantName {...}
Location:
database-related: "router" folder
~/api/routers/x/types.ts
reusable/app-wide: types folder
~/types/x/types.ts
local: _lib folder
component-folder/_lib/types.ts
Filename:
schemas.ts
Declaration:
database-related:
FE: schema, schemaCreate, schemaUpdate
BE: schemaBE, schemaBECreate, schemaBEUpdate
all other:
export const schemaX = {...}
Location:
database-related "router" folder
~/api/routers/x/schemas.ts
)
reusable/app-wide: schemas folder
~/schemas/x/schemas.ts)
local: _lib folder
component-folder/_lib/schemas.ts