Skip to content

[REFACTOR]: File structure of types, constants, and enums #1337

@StereoPT

Description

@StereoPT

Description:

Currently, there is no standardized file structure for organizing types, constants, and enums in a Next.js project. As a result, it can be difficult for developers to navigate and maintain their codebase, leading to potential issues and bugs.

To address this, we propose implementing a standardized folder structure for these types of files. Here are some potential pros and cons of this approach:

Pros:

Improved organization and readability of the codebase
Easier maintenance and debugging
Consistency across the project, reducing confusion and potential errors

Cons:

Requires additional upfront planning and implementation time
May require some changes to existing code

Idea of recommend folder structure for types, constants, and enums:

- src/
  - types/
    - index.ts
    - UserType.ts
    - ProductType.ts
  - constants/
    - index.ts
    - APIRoutes.ts
    - Colors.ts
  - enums/
    - index.ts
    - SizeEnum.ts
    - StatusEnum.ts

In this structure, each type, constant, or enum has its own file within a designated folder. The index.ts file in each folder serves as the entry point for importing and exporting the respective files.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions