Almost all data stuctures can be generated automatically, by using scripts among with MySQL, Graphql, OpenAPI etc. If you use all lowercase naming, you have no need worry about the casing issues.
Use /folder/[slug]/index.jsx instead of /folder/[slug].jsx.
In Next.js project, folder tree may look like this:
plain. ├── _app.tsx ├── _document.tsx ├── index.tsx └── posts └── [slug].tsx
However, this way is not extendable, when we need to add a sub page like /post/[slug]/comments, you need to change the previous file name.
The best practise is that:
plainROOT/pages/ ├── _app.tsx ├── _document.tsx ├── index.tsx └── posts └── [slug] └── index.tsx
Similar, in Nuxt.js project, you may adapt it to this way:
plainROOT/pages/ ├── index.vue └── posts └── _slug └── index.vue
UPPERCASE in file namesEspecially in routing directories. It's wierd to see an URL like this:
plainhttps://example.com/SomePath/WithUppercase?Params=something
URL should be case insensitive.
UPPERCASE in data structureAlmost all data stuctures can be generated automatically, by using scripts among with MySQL, Graphql, OpenAPI etc. If you use all lowercase naming, you have no need worry about the casing issues.
BAD:
javascript{
"createdAt": "2021-05-22 16:00:00"
}
GOOD:
javascript{
"created_at": "2021-05-22 16:00:00"
}
Unique IDs, such as:
/post/:slug/product/:id/anything/detail/:idDo not use paths like /anything/detail to show a single fetched data. When you share the link to others, they will get a 404 error.
Such as dark mode status, localization config, page/component data to share.
Persistize a state, or offline data.
TBD.