This is an opinionated baseapp for product-ready project to be used as a starting point for your project. To start, run the following commands in your terminal:
If your machine does not have pnpm
installed, you can install it by running the following command in your terminal, then restart your terminal.
npm install -g pnpm
To install all the dependencies, run the following command in your terminal.
pnpm install
To start the development server with storybook, run the following command in your terminal. This is helpful for developing components in isolation.
pnpm dev-storybook
To start the development server, run the following command in your terminal.
pnpm dev
Open http://localhost:3000 with your browser to see the result. If you are new to Next.js, you can go through the home page to learn more about the baseapp.
All files and folders name should be in kebab-case. Eg: toggle-button.tsx
or leave-management/
.
All variables and functions should be in camelCase. eg: const isButtonDisabled = true;
or function toggleButton() {}
.
All React components should be in PascalCase, so it can be called as a React component. Eg: <Button/>
.
All Interfaces should be in PascalCase, and it should have a prefix of I
or suffix of Props
, such as interface IButton {}
or interface ButtonProps {}
. Eg:
interface IButtonProps {
isDisabled: boolean;
}
All Types should be in PascalCase, and it should have a prefix of T
. Eg:
type TUser = {
name: string;
}
All Enums AND its contents should be in PascalCase, and it should have a prefix of E
. Eg:
EButtonColor {
Primary,
Secondary,
Tertiary
}
All Classes name should be in PascalCase.
app
folder. Each folder that have page.tsx
will be considered a website directory.
app/page.tsx
will be https://example.com/
.
app/articles/page.tsx
will be https://example.com/articles
.
app/articles/[id]/page.tsx
will be https://example.com/articles/1
.()
and the folder with ()
is hidden from the URL. For example, app/(modules)/articles/page.tsx
will be https://example.com/articles
._
. For example, app/_components/anything.tsx
.[]
. For example, app/[id]/page.tsx
will be https://example.com/1
.Your project should be structured as follows:
βββ app
β βββ (modules)
β β βββ leave-management (example)
β β β βββ _types
β β β β βββ t-leave.tsx
β β β βββ _components
β β β β βββ client-components
β β β β β βββ create-button.tsx
β β β β β βββ update-button.tsx
β β β β βββ server-components
β β β β β βββ delete-button.tsx
β β β βββ _data
β β β β βββ leave-client.tsx
β β β β βββ utils.tsx
β β β βββ [id]
β β β β βββ page.tsx
β β β β βββ edit
β β β β β βββ page.tsx
β β β βββ create
β β β β βββ page.tsx
β β β βββ page.tsx
βββ components
β βββ toggle-button (example)
β β βββ toggle-button.tsx
β β βββ toggle-button.stories.tsx
βββ public
| βββ general
| β βββ default-avatar.png
| βββ modules
| β βββ leave-management (example)
| β β βββ example-image.png
βββ styles
βββ utils
@/app/
folder.@/components
folder.Button
component should be in the @/components/button
folder.button
component should have a button.stories.tsx
file. This way, all developers can explore the component in isolation.@/public
folder.@/styles
folder.@/utils
folder.@/app/(modules)
. For example, the articles
feature should be in the articles
folder. Or the leave-management
feature should be in the leave-management
folder._components
. For example, the articles
feature should have its own @/app/articles/_components
folder.Development done. Pending documentation
Development done. Pending documentation
Development done. Pending documentation
Development done. Pending documentation
Development done. Pending documentation