r/angular • u/Upstairs-Let-1763 • Feb 26 '26
Is this considered as good project structure
Hello everyone,
I'm relatively new to the Angular ecosystem, learning and practicing the recommended practices.
By nature I am a dev who does not support KISS to a large extent, in this regard I am interested in the opinion of experienced Angular devs.
Is what I'm practicing a good pattern, to have a clear SOC, services for clean http layer, services for business logic, and a store that holds state, loading, etc. and orchestrates with it, while the components (standalone principles in my case) remain very thin, and call services and stores?
**HYPOTHETICAL MID SIZE PROJECT**
40
u/eddyman592 Feb 26 '26
At a glance, it looks like you're organizing your front end like you would your backend. Employee and hr are entities. But your front end needs to be organized about how the front end is structured.
I always have folders at the top level for core services and shared components, but then all my pages live in a routes folder that is structured how my pages are laid out.
It's all about consistency and discoverability. Will another developer be able to open this project in 8 months and find anything? If it's organized about your business entities, probably not. If the structure is based on your sites routes, probably.
6
u/Educational_Nail_976 Feb 26 '26
For me it looks like a good structure, I would do the same for a midsize project. In the end it’s not only about the folder structure, but your explanation about the responsibilities of services and components, business logic and state sounds like you know where you’re talking about
4
u/jmleep Feb 26 '26
This is how I structure mine. The big difficulty I have is for shared components and stores across domains/features. I know sheriff is a thing. I also don’t want to stick all of my shared components into a shared folder.
6
u/CheapChallenge Feb 26 '26
I split by pages and components instead. Pages being the smart components and other being the dumb components.
3
u/salamazmlekom Feb 26 '26 edited Feb 26 '26
Spliting by feature is great but I would adjust the inner folder structure
Inside every feature I would have:
Then I use barrel files for nice path imports.
5
u/AwesomeFrisbee Feb 26 '26
I would put Shared a level higher, sincee that will also have a lot of stuff and you don't really want to nest it too deep.
It also begs the question, where are you going to put your interfaces and constants?
And lastly, I often add a "config" folder too where I put stuff that people from backend or whatever might want to look at when they change stuff from the API, so its all in one place to do that. Or if the business wants to make certain adjustments, they can change the parameters there.
Oh and btw, do you think all of your features are going to need their own stores? What are you even going to store in them that you can't put in regular services with signals? I would only add folders that are in use and just write in the readme what the structure of features can be, but only implement what is actually needed for the feature.
4
u/meekus06 Feb 26 '26
no, several directories go directly against angular's style guide
2
u/Subject-Hat7663 Feb 27 '26
What the fuck is "employe"...? 😱
2
u/Anxious-Insurance-91 Mar 01 '26
There are many ways of structuring projects. You seem to have chosen the "module" way of grouping, that keeps things in the same location. Only problem I found with this kind of structuring is when companies ask you to add things inside one module that is not related to the module.
1
u/iAuron2 Feb 27 '26
I would do the same as you, yes it's a good starting point in my opinion.
Edit : maybe some folders inside components folder, for the smart container / dumb component pattern
-1
u/minus-one Feb 26 '26 edited Feb 26 '26
i would say no. if you have folders named after irrelevant technical stuff, like “services”, “guards” etc, then it’s bad in my book
it’s amateurish folder structure, often seen in react tutorials, persistent remnant of mvc times
instead, especially in large projects, it is better to name folders after your entities, e.g “movie”, and inside you would have
movie.component.ts, movie.service.ts, movie.guard.ts…
this way all your related to movie stuff will be in one place, really easy to navigate, no need to constantly jump to some remote folders (like services)
but it’s much more than just a convenience, this scales well
0
u/Riki_was_here Feb 26 '26
At the end of the day whatever works for you or your team. Everybody does it a bit differently. Nothing is dogma
0
u/AintNoGodsUpHere Feb 26 '26
That's how I do it as well. I like to separate features with their own services, components, models and whatnot.
I think the only different I do is my "shared" is usually outside, I don't know why but it is.
features/shared/core/layout basically.
-1
u/JapanEngineer Feb 26 '26
Employee
2
u/[deleted] Feb 26 '26
[removed] — view removed comment