Next.js Discord

Discord Forum

About NextJS Project Folder Structure

Answered
Eastern yellowjacket posted this in #help-forum
Open in Discord
Eastern yellowjacketOP
I have concept confuse, I know that app folder and pages folder can create together.
Is it not necessary to create pages folder ? because it can create different pages in app folder e.g app/dashboard/setting.tsx.
If I have a scenario which is included app and pages folder at the same directory level,
How to pass data from app folder 's some pages to pages folder 's some pages ?
Answered by averydelusionalperson
you can do something like me ig, I've no root layout, different layouts for each route group.
View full answer

55 Replies

afaik there is no way you can pass data from app folder to pages folder.
may I ask, why you need pages folder tho?
@averydelusionalperson may I ask, why you need pages folder tho?
Eastern yellowjacketOP
No, I just want to clarify that between app folde and pages folder
So, what 's the usage of pages folder ?
if you still want to use next 12 pages dir features, you can use pages folder
it isn't necesarry
many people still use pages dir
and app dir simultaneously
Eastern yellowjacketOP
Oh, I forgot to say my nextjs version is between 13 and 14 XD
If I have a scenario, which is include backend dashboard e.g CRUD CMS and frontend client website
I must need the app folder and pages folder ?
app dir is mandatory
pages folder is not
Eastern yellowjacketOP
however, the backend and frontend will not share the same layout.tsx
ofcourse
you can have different layouts 🤷‍♂️
Eastern yellowjacketOP
how to fully separate the layouts ?
use route groups?
Eastern yellowjacketOP
one app folder -> one layout.tsx
you can do something like me ig, I've no root layout, different layouts for each route group.
Answer
(auth) -> layout.tsx
(dashboard) -> layout.tsx
(website) -> layout.tsx
Eastern yellowjacketOP
:meow_meow:
Is this a best practice setup ?
there is nothing like best practice, it works, and it doesn't have any issues afaik
@averydelusionalperson you can do something like me ig, I've no root layout, different layouts for each route group.
Eastern yellowjacketOP
yes, exactly I means the root layout
so, api, client website, backend dashboard can put into app folder ?
yes
Eastern yellowjacketOP
no pages folder ?
if you need it
keep it
if you don't
then don't
Eastern yellowjacketOP
OK
thanks a lot bro
no problem, if your question is cleared, consider marking answer as solution
Original message was deleted
^
🫡
Eastern yellowjacketOP
where are u come from bro
India
Eastern yellowjacketOP
hong kong
XD
noice, we've users here from hong kong
Eastern yellowjacketOP
Would u mind share your fully folder structure screen capture as my reference ?
@averydelusionalperson noice, we've users here from hong kong
Eastern yellowjacketOP
discord ?
yeah, on this channel
@averydelusionalperson yeah, on this channel
Eastern yellowjacketOP
wordwide XD
you work in india bro ?
@Eastern yellowjacket Would u mind share your fully folder structure screen capture as my reference ?
Eastern yellowjacketOP
thx a lot bro
Eastern yellowjacketOP
@averydelusionalperson If inside the app folder
e.g From your screen scap
how to pass data from dashboard to website ?
state mangeemnt tools ? or through api get data ?
consider creating a new post on #help-forum since this is a different question
Eastern yellowjacketOP
Ok