Vue.js Modular Architecture

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ม.ค. 2025

ความคิดเห็น • 51

  • @MrShnaiderTV
    @MrShnaiderTV ปีที่แล้ว +2

    As front-end developers, it is high time for us to think about the architecture of our projects and raise quality standards during development. This video brings up an important topic. If the architecture described in this video doesn't quite suit you, here's a tip. Architectures are based on two groups of principles: coupling and cohesion. I would describe the last group as follows: combine what "uses each other", "is used simultaneously" and "changes for the same reason". Based on these principles, you can change the architecture to suit yourself. Start by creating a directory when creating a new page and put into it all the files that appear during the development of this page: vue components, stores, composables, etc. If any of this will be used on other pages, put it in the project root directories (by type). Over time, you will find a directory structure that you like. The main thing is to follow these 3 principles and then you will get all the advantages of a "modular architecture" (which is actually just an architecture)

  • @xucongzhan9151
    @xucongzhan9151 3 ปีที่แล้ว +14

    Haha, have to point out that this is what Angular has been promoting since Day 1, which I am a huge fan of. Glad to see it in a Vue form. I am actually in the middle of a similar refactoring and this tutorial helps. Thanks for sharing.

  • @sanjarmirakhmedov8311
    @sanjarmirakhmedov8311  2 ปีที่แล้ว +2

    Due to several people pointing out, I just wanted to make clear that the video is not full on about architecting/writing the actual code, but rather showing how to implement a modular/feature based folder structure with opinionated way of wiring up things. Important to note here, that it's not an absolute one way to go, you can come up with your own implementation of a modular folder structure.

  • @cegrif01
    @cegrif01 2 ปีที่แล้ว +3

    Really nice architecture! I like to use scoped slots to further decouple the gathering of the data (store) from the presentation of that data. Webpack knowledge is definitely a must so that js exports load properly. This is an excellent video Sanjar. Thank you!

  • @yosvelquintero
    @yosvelquintero 2 ปีที่แล้ว +1

    I have worked with Angular and React... But I can tell you that Vue with this modular architecture looks amazing!!
    Thank you Sanjar Mirakhmedov for sharing good content!!👌

    • @sanjarmirakhmedov8311
      @sanjarmirakhmedov8311  2 ปีที่แล้ว +1

      Glad you have enjoyed the video, by the way same architecture can be applied to React and Angular as well, the principles stay the same=)

  • @MeonisRP
    @MeonisRP 3 ปีที่แล้ว +1

    Забавно, я думал об этом вчера даже нигде не слышав. И тут твой видос. Значит такой паттерн существует)

  • @codedjango
    @codedjango ปีที่แล้ว +1

    Can you do this tutorial for Vue 3?

  • @AnassSanba-f5d
    @AnassSanba-f5d ปีที่แล้ว +1

    I recommend using shared folder as well coz sometimes u need to acces data between features and that's i think can become nasty

  • @SuperKnivesOut
    @SuperKnivesOut 2 ปีที่แล้ว +1

    can someone help me do this with nuxt? it's more closed in terms of changing folder structure

  • @derHodrig
    @derHodrig 3 หลายเดือนก่อน

    our ticket application startet as a small project but it grew over time... we should used such modular arch way earlier, if not from beginning. Apps can grow from small to medium or large code bases really fast, it just needs new ideas or requests for your customers...

  • @asim-gandu-phenchod
    @asim-gandu-phenchod 3 ปีที่แล้ว +2

    You earned a like bro. Really appreciate your video. Thanks a lot

    • @sanjarmirakhmedov8311
      @sanjarmirakhmedov8311  3 ปีที่แล้ว

      Thank you very much, I am glad that you’ve enjoyed the video ;)

    • @asim-gandu-phenchod
      @asim-gandu-phenchod 3 ปีที่แล้ว

      @@sanjarmirakhmedov8311 Can you please make a small video/playlist of a very basic project like a todo list or a stopwatch and explain the whole modular architecture of Vue using the project?

  • @lucahoffmann8695
    @lucahoffmann8695 ปีที่แล้ว

    i keep getting the error "router.addRoutes is not a function" inside the router.js of my module...
    i am using
    "vue": "^3.3.4",
    "vue-router": "^4.2.4"
    any idea why this function does not work / exist ?

  • @hangor3620
    @hangor3620 2 ปีที่แล้ว +2

    Great video, i've refactorred my codebase using this approach. Looks promising. One thing i couldn't solve is using keep-alive with nested router-views, so i just implemented all the stuff you've talked in the video but without using the Module.vue component and nested sub-routes. In addition, it looks a bit different with vue 3 and vue-router 4, but the general idea is the same:) Do you think it's fine to drop Module.vue and nested router-view?

  • @luansinh0
    @luansinh0 ปีที่แล้ว

    There is a way to implement it with Nuxt?

  • @danielcastllomarfull
    @danielcastllomarfull ปีที่แล้ว

    Very nice. Thanks!

  • @karthikeyanpalanisamy8299
    @karthikeyanpalanisamy8299 3 ปีที่แล้ว +1

    Nicee Architecture to implement

  • @user-cf5uf7vf2g
    @user-cf5uf7vf2g 2 ปีที่แล้ว

    really similar like composer project, great tutorial.

  • @baihakialbiruni2565
    @baihakialbiruni2565 2 ปีที่แล้ว +1

    thanks sir, very very useful, im from indonesia

  • @vlad6075
    @vlad6075 2 ปีที่แล้ว +1

    There is also patterns like atomic wich i like to use c:

  • @alimodz6253
    @alimodz6253 2 ปีที่แล้ว

    does it make sense to also create a "components" folder inside a module to store components only used within that module views

    • @sanjarmirakhmedov8311
      @sanjarmirakhmedov8311  2 ปีที่แล้ว +1

      Sure thing, you can come up with your very own structure within the modules, the video explains only the very abstract/core concepts of splitting your app into several independent modules

  • @ShinigamiZone
    @ShinigamiZone ปีที่แล้ว

    It looks interesting and maybe worth trying.
    But how does this work with e.g. i18n and some VSCode extensions 🤔

    • @nero1375
      @nero1375 5 หลายเดือนก่อน

      it is simple, don't use VSCode and create a core module registering de i18n config. Stop searching for all the answers and start thinking about your context

  • @kaloyannikolov5806
    @kaloyannikolov5806 2 ปีที่แล้ว

    Ok but what happens if we need to have navigation ? And we don't want to rerender the navigation bar every time in new module since its loosing its animation states ?

    • @sanjarmirakhmedov8311
      @sanjarmirakhmedov8311  2 ปีที่แล้ว +1

      If you want to persist the navigation across all modules, then you define it in the Root component as it's shown in the video, so that the only thing re-renders is the .

  • @yatagun
    @yatagun 3 ปีที่แล้ว +5

    Круто! Давай еще! Можно даже на русском запилить такое же видео - на русском очень мало инфы об архитектуре вью да и вообще что то сложнее туду личта по вью

    • @sanjarmirakhmedov8311
      @sanjarmirakhmedov8311  3 ปีที่แล้ว +1

      Большое спасибо, рад что тебе понравилось! Может быть в будущем будут видео на русском ;)

  • @_parassolanki
    @_parassolanki 2 ปีที่แล้ว +1

    Its good when you separate out files when its been used multiple times but for smaller app its not needed you can just define your logic in one file and its fine.
    Separate out things (logic) when needed

  • @ChiCity511
    @ChiCity511 2 ปีที่แล้ว +1

    Does this have any performance advantages or is it purely organizational?

    • @sanjarmirakhmedov8311
      @sanjarmirakhmedov8311  2 ปีที่แล้ว +1

      It's purely organization, because you basically handle only the way you split up the files and folders, but not how they run.

  • @mhDuke
    @mhDuke 2 ปีที่แล้ว

    very good video Sanjar.

  • @namaefumei
    @namaefumei 3 ปีที่แล้ว

    Does this really work in large scale projects?
    I have a project that has more than 100 pages and around 60 components.
    If I use this method I'll have to have more than 300+ files and folders.

    • @sanjarmirakhmedov8311
      @sanjarmirakhmedov8311  2 ปีที่แล้ว +6

      Yes, it is specifically good for large projects, the increase in folders/file size is a benefit rather than downside, it’s easier to manage folder for a feature, than one gigantic folder for all features.

  • @rhejiearanez9951
    @rhejiearanez9951 2 ปีที่แล้ว

    Thanks for this content bro I appreciate it. by the way, I subscribe to your channel.

  • @ob6217
    @ob6217 2 ปีที่แล้ว

    is dis counted as mvc architecture??

    • @sanjarmirakhmedov8311
      @sanjarmirakhmedov8311  2 ปีที่แล้ว

      Not really, this is just a way to organize your frontend code so that its more manageable and scalable, its more of a folder/file architecture with some minor additional stuff.
      MVC is a bit different topic, related to code logic organization.

  • @tutunmayan
    @tutunmayan 2 ปีที่แล้ว

    Has benefits if you have a large team and a large project. Otherwise won't make a real difference

    • @sanjarmirakhmedov8311
      @sanjarmirakhmedov8311  2 ปีที่แล้ว

      Of course, if you are building a very simple application with few pages and components, then it would probably be an overkill, but if your app already features few modules, then its really beneficial even if the team is small. Mentally it's easier to focus on one feature at a time, and have everything under your hand nicely in one folder.

  • @xjuampa7983
    @xjuampa7983 2 ปีที่แล้ว

    This video is so good

  • @syakirrahman4747
    @syakirrahman4747 2 ปีที่แล้ว

    Thank you bro

  • @SonNguyen-lw9nj
    @SonNguyen-lw9nj 2 ปีที่แล้ว

    thanks you!

  • @jcatstreams8550
    @jcatstreams8550 ปีที่แล้ว

    Тег вью 3, хотя используется вью 2😢

  • @azizarifrizaldi1817
    @azizarifrizaldi1817 ปีที่แล้ว

    cool!

  • @mowazzemhosen366
    @mowazzemhosen366 3 ปีที่แล้ว

    wow man

  • @tbloom5328
    @tbloom5328 ปีที่แล้ว

    This is ridiculous. This structure is out of the box in Vue. This is NOT a architecture, design patterns are as mentioned.

  • @AMFLearning
    @AMFLearning 2 ปีที่แล้ว +1

    #amflearningbydoing #amflearning nice content