Ultimate Project Structure in Angular

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 45

  • @adamsmielewski8711
    @adamsmielewski8711 11 місяців тому +17

    Oh my god that's what I've been searching for, a tutorial where someone treats me like a competent developer

    • @DevBySeb
      @DevBySeb  11 місяців тому

      Thanks for the feedback and for watching mate 🙏🏼

  • @NicolasPena-ds5xt
    @NicolasPena-ds5xt Рік тому +6

    Nice explanation! It's a clean solution the way you handle import paths

    • @DevBySeb
      @DevBySeb  Рік тому

      Thanks for the awesome feedback mate and thank you for watching 🙏

  • @MaddesMat
    @MaddesMat Рік тому +1

    Thanks for sharing with us!!! 🎉

    • @DevBySeb
      @DevBySeb  Рік тому

      Thank you for watching 🙏🙏

  • @nambi1718
    @nambi1718 Рік тому +1

    Nice explanation ! 👏

    • @DevBySeb
      @DevBySeb  Рік тому

      Thanks for the awesome feedback mate 🙏🏼

  • @phpmvk1
    @phpmvk1 9 місяців тому +1

    Fantastic video! It's a good topic to cover, I'm glad I found this!
    Just one part I have not been able to understand well:
    Starting around 5:50, you said that we don't want to export the UI Modules from the SharedModule to avoid multiple import statements.
    I can understand the goal of keeping the code cleaner through barrel files for the imports at the top of each file, but wouldn't you be able to keep your FeatureModules code cleaner by only importing the SharedModule (with all UI Modules in its exports array) instead of importing all the UI Modules there individually like you started doing at 11:09?

    • @DevBySeb
      @DevBySeb  9 місяців тому +1

      Thanks for the feedback mate 🙏🏼 import files would look better as you explained however it would impact the performance negatively since you’d import every ui-module in every feature module 😃

  • @ahmedmk534
    @ahmedmk534 Рік тому +1

    much appreciated! can you share the formatter settings you are using please? thanks

    • @DevBySeb
      @DevBySeb  Рік тому +1

      Thanks for watching mate 🙏🏼 I’m using ”prettier” with default settings 😀

  • @jakasha873
    @jakasha873 Рік тому +1

    i definitely gonna use it in my project!!!

    • @DevBySeb
      @DevBySeb  Рік тому

      Thanks for watching mate - glad to help 🙏

  • @rexbear4607
    @rexbear4607 Рік тому +2

    Where do you place your nested routes ? Lets say /account module has /acount/:id and account/:id/settings and account/:id/settings/random-route1, .../settings/random-route-2.
    Do you keep nesting files inside of pages deeper and deeper or you flatten and keep max one level with longer description like account-detail-settings-random1.
    And also when is the time for subroute to be its own module or all the pages are their own modules.
    Sry if its confusing question.

    • @DevBySeb
      @DevBySeb  Рік тому +2

      Thats a good question mate! 😁 if there are a couple of nested routes its fine. However, if its too many nested routes, I would consider breaking it into submodules. Meaning, we create a new folder within the feature module named "subfeature 1", "subfeature 2" etc. The reason is we want to enable for lazy loading 😁

  • @jseh_
    @jseh_ 10 місяців тому +3

    but why inside app and not src?

    • @DevBySeb
      @DevBySeb  9 місяців тому +1

      Good question mate, either place should work. I just prefare to have it in that way

  • @reynandelizo1480
    @reynandelizo1480 3 місяці тому

    hi want angular version your used in this project do you have a folder structure for angular 17 and 18 I checked the latest angular version it have a standalone composennt and signals that application faster and better than previous angular version.

  • @devinvestidor
    @devinvestidor 4 місяці тому

    Good tips! Thanks for your sharing :)

  • @Maxonepiece
    @Maxonepiece Рік тому +1

    Amazing vid!!!

    • @DevBySeb
      @DevBySeb  Рік тому +1

      Thanks for the awesome feedback mate and for watching! 🙏

  • @Navistar-cu2po
    @Navistar-cu2po 6 місяців тому +1

    what if all the components are standalone including app.component.ts? we must make standalone: false or remove it entirely?

    • @DevBySeb
      @DevBySeb  6 місяців тому

      Good question mate I’m going to do a video about standalone components and project structure

  • @sajalmia8407
    @sajalmia8407 Рік тому +1

    That is great. I do similar type thing in my project. what is your oppinion about account module have children module, Call AccountDetails module, so account details module contain just like account module(page, service, etc)?

    • @DevBySeb
      @DevBySeb  Рік тому

      I think that sub features as you explain is an good idea. You should have it in that way, but at the same time - keep it as simple as possible 👌

  • @Ayush-bk3rv
    @Ayush-bk3rv 9 місяців тому +1

    can i use the shared ui components inside the core module components, or is it just for modules/features

    • @DevBySeb
      @DevBySeb  9 місяців тому +1

      Good question mate. Core is usually connected to the app, therefore, we should add shared things into the shared folder

    • @Ayush-bk3rv
      @Ayush-bk3rv 9 місяців тому +1

      thank you @@DevBySeb

  • @luizthomaz9865
    @luizthomaz9865 Рік тому +1

    I thought the way you explained it was sensational. In terms of aesthetics, it is a completely clean code, can you tell me in terms of performance, would it change anything?
    And talking about lazy-loading, how do I reduce my "main" in the final build, it's getting 2.4mb... would you have any examples?

    • @DevBySeb
      @DevBySeb  Рік тому +1

      Thanks for watching and the awesome feedback mate!
      In terms of performance:
      * If you utilize lazy loading - it will have a significant impact in terms of performance as it will only load things when the user hits a certain route.
      * If you combine that with build optimization and three shaking - it may impact the performance in a positive way, I have a short video on how to achieve that here: ua-cam.com/video/NPsRXz5MOSg/v-deo.html
      When it comes to lazy loading, etc, the build sizes will most likely be the same. However, with threeshakeability and build optimization - it might decrease the size of the build :)

  • @valiibraimi195
    @valiibraimi195 Рік тому +2

    How do you get 317k (gzipped: 91k) on the VSC ?

    • @DevBySeb
      @DevBySeb  Рік тому +1

      You can add an extension to vscode named "Import Cost" 😁

  • @fabi5189
    @fabi5189 Рік тому +1

    What are your thoughts on using standalone components with this structure

    • @DevBySeb
      @DevBySeb  Рік тому

      Excellent question mate. I love standalone components. The structure could be similar but with less files, and would be trivial for ui components and shared components. So its a good idea to use it where its suitable.

  • @jakasha873
    @jakasha873 Рік тому +1

    i got a question: which folder should i move my interceptors to?

    • @DevBySeb
      @DevBySeb  Рік тому +1

      Great question - if it's a core interceptor (one used for ALL requests on a global level) - I would add it under the core/interceptors folder. If it's a feature specific one, I would create an interceptor folder there e.g. feature1/interceptors.
      If it's none of the above, its most likely a shared one - so under shared/interceptors (when it's used in some of the features but not all). Hope that helps :)

    • @jakasha873
      @jakasha873 Рік тому +1

      @@DevBySeb thanks a lot

  • @marmont8005
    @marmont8005 Рік тому +1

    Nice bro!

  • @tranvansi6302
    @tranvansi6302 4 місяці тому

    What font vs code. Thank bro

  • @technovelodos
    @technovelodos 10 місяців тому +1

    If you have to explain to someone what the difference is between "core" and "shared", then it's a flawed model. Project structure should be self evident and not require any additional "explaining". Just like when you are building UI designs, there should be no "ambiguous choices" - any choices the dev has to make (where do I put this bit of code) should be automatic and unambigous.

    • @DevBySeb
      @DevBySeb  10 місяців тому

      Thanks for your feedback mate. However, I don’t agree with it. I believe it might be obvious what differences there are between the core and shared folders if you are used with that particular thinking 😃

    • @oleksiiprykhodko517
      @oleksiiprykhodko517 5 місяців тому

      @@DevBySeb Thank you so much for the video. This is really very good material.
      But I need an example of the layout of different services.
      If I understand correctly, everything related to the main layout (menu, header, footer) is located in CORE. If I have an HTTP service, which will be used by all other services, then we also locate it in CORE? If I have a service responsible for the appearance of toast (with errors or info) on the screen, do I locate it in CORE or in SHARED?