Next.js Discord

Discord Forum

Is app file structure is good ?

Answered
Northeast Congo Lion posted this in #help-forum
Open in Discord
Northeast Congo LionOP
Is app file structure good instead src file structure for Next.js app ?
Is it ok if I don't use Express.js in Next.js app and use default server provided by Next.js ?
Answered by Knopper gall
It's great for most applications, sometimes you'll be smarter offloading some tasks to a separate server (such as compute heavy tasks)
nine times out of ten you'll be perfectly fine using route handlers, middleware, server components and server actions for what you need to do
View full answer

43 Replies

Knopper gall
It's great for most applications, sometimes you'll be smarter offloading some tasks to a separate server (such as compute heavy tasks)
nine times out of ten you'll be perfectly fine using route handlers, middleware, server components and server actions for what you need to do
Answer
@Northeast Congo Lion which one should prefer ?
Knopper gall
I'd recommend using nextjs primarily, then use express if needed for the computationally heavy tasks
@Northeast Congo Lion use the nextjs server for basic crud operations
Northeast Congo LionOP
you mean, no need to use express
as your scale increases, you might need things like cron jobs etc.. this is when you shift to express
nextjs server is good to get you started, but it does lack features of like express in terms of every single functionality they provide
makes sense?
Knopper gall
What we're both trying to say, is use Next, until you can't use next for what you're trying to do
^
@Knopper gall What we're both trying to say, is use Next, until you can't use next for what you're trying to do
Northeast Congo LionOP
ok, if somehing will not work out then go for express, right?
if I have no idea, in that sense
@Northeast Congo Lion ok, if somehing will not work out then go for express, right? if I have no idea, in that sense
Knopper gall
pretty much, next is good for most of what you'll need
@Knopper gall pretty much, next is good for most of what you'll need
Northeast Congo LionOP
what about file structure, is this ok. without src folder
I am using app structure with next routing, not custom
@Knopper gall pretty much, next is good for most of what you'll need
Northeast Congo LionOP
lib folder is for backend, I mean schema and backend (database)

api is for api routing
looks fine
@Northeast Congo Lion lib folder is for backend, I mean schema and backend (database) api is for api routing
Knopper gall
little bit confused about the route groups, but looks fine
you can check my structure if you want examples of without src
@Knopper gall little bit confused about the route groups, but looks fine
Northeast Congo LionOP
you mean this ()
in route
@Knopper gall little bit confused about the route groups, but looks fine
Northeast Congo LionOP
for database, lib folder is ok ?
@Arinji https://github.com/Arinji2/vibeify/tree/master/
Northeast Congo LionOP
you create utils for database stuff
@Northeast Congo Lion you create utils for database stuff
yup, its not in that project
Northeast Congo LionOP
@Arinji @Knopper gall guys thanks for reply 🙏
I was really confused which one to follow but now its clear
I can follow this folder structure in every project
No worries, remember nextjs dosent really care about your structure (most of the time)
so you can get creative with it
thats just what i use + most agree with
with nextjs, spend less time planning, and more time building :D
Northeast Congo LionOP
I recently started to build projects in Next.js cause its good for SEO and other things which react js is not providing. and also I am seeing it, its very good than react.
but need to learn new things
@Arinji with nextjs, spend less time planning, and more time building :D
Northeast Congo LionOP
yeah
that's true, no need to make routing, just create folders and that's it
btw mark an answer whichever helped you :D
@Arinji btw mark an answer whichever helped you :D
Northeast Congo LionOP
both
well you gotta chose one xD
@Arinji well you gotta chose one xD
Northeast Congo LionOP
oh, you need to make multiple choice
😂
I mark it
Original message was deleted
follow this :D
Knopper gall
The thread gets closed by you marking as solved, but you can only mark one question as the answer haha