-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Added nextjs tutorial page #17
Open
kinhdev24
wants to merge
1
commit into
digitalfortress-dev:main
Choose a base branch
from
kinhdev24:feat/nextjs-structure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# [Next.js](https://nextjs.org/) Project Structure | ||
|
||
This page provides an overview of the project structure of a Next.js application. It covers top-level files and folders, configuration files, and routing conventions within the `app` directories | ||
|
||
--- | ||
|
||
### Folder structure | ||
|
||
Most of the code lives in the `app` folder and looks something like this: | ||
|
||
``` | ||
+-- 📂 app # app router | ||
| | ||
+-- 📂 project # pages router | ||
... | ||
| | ||
+-- 📁 public # static assets to be served | ||
| | ||
+-- 📁 components # shared components used across the entire application | ||
| | ||
+-- 📁 config # global configurations, exported env variables etc. | ||
| | ||
+-- 📁 hooks # shared hooks used across the entire application | ||
| | ||
+-- 📁 lib # reusable libraries preconfigured for the application | ||
| | ||
+-- 📁 stores # global state stores | ||
| | ||
+-- 📁 test # test utilities and mocks | ||
| | ||
+-- 📁 types # shared types used across the application | ||
| | ||
+-- 📁 utils # shared utility functions | ||
``` | ||
|
||
For easy scalability and maintenance, organize most of the code within the page router folder. Each page router folder should contain code specific to that feature, keeping things neatly separated. This approach helps prevent mixing feature-related code with shared components, making it simpler to manage and maintain the codebase compared to having many files in a flat folder structure. By adopting this method, you can enhance collaboration, readability, and scalability in the application's architecture. | ||
|
||
A page router could have the following structure: | ||
|
||
``` | ||
app/projects | ||
| | ||
+-- 📁 api # exported API request declarations and api hooks related to a specific feature | ||
| | ||
+-- 📁 assets # assets folder can contain all the static files for a specific feature | ||
| | ||
+-- 📁 components # components scoped to a specific feature | ||
| | ||
+-- 📁 hooks # hooks scoped to a specific feature | ||
| | ||
+-- 📁 stores # state stores for a specific feature | ||
| | ||
+-- 📁 types # typescript types used within the feature | ||
| | ||
+-- 📁 utils # utility functions for a specific feature | ||
``` | ||
|
||
NOTE: You don't need all of these folders for every feature. Only include the ones that are necessary for the feature. | ||
|
||
--- | ||
|
||
### See similar instructions in the NextJS documentation | ||
|
||
###### [Top-level files](https://nextjs.org/docs/getting-started/project-structure#top-level-files) | ||
|
||
###### [Routing Conventions](https://nextjs.org/docs/getting-started/project-structure#app-routing-conventions) | ||
|
||
###### [Nested Routes](https://nextjs.org/docs/getting-started/project-structure#nested-routes) | ||
|
||
###### [Dynamic Routes](https://nextjs.org/docs/getting-started/project-structure#dynamic-routes) | ||
|
||
###### [Route Groups and Private Folders](https://nextjs.org/docs/getting-started/project-structure#route-groups-and-private-folders) | ||
|
||
###### [Parallel and Intercepted Routes](https://nextjs.org/docs/getting-started/project-structure#parallel-and-intercepted-routes) | ||
|
||
###### [Metadata File Conventions](https://nextjs.org/docs/getting-started/project-structure#metadata-file-conventions) | ||
|
||
###### [Routers](https://nextjs.org/docs/getting-started/project-structure#routes) | ||
|
||
###### [Dynamic Routers](https://nextjs.org/docs/getting-started/project-structure#dynamic-routes-1) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kinhdev24 We shouldn't show the source code structure in the coding-conventions folder, Kinh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be on platform -> web -> source code structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I will update it soon. Thanks for your feedback, anh Quynh