0

Context:
I have recently joined a new company where they have a particular folder structure in the project where they have different modules in different folders in a single project. Each module folder has separate submodule and then separate child folders for back-end(in Python) and front-end(in AngularJS) code. Separate developers are responsible for different modules. It's my responsibility now to make this code modular.

I suggested two solutions:

  1. having the separate git repo for front-end and back-end code

  2. keep each module in a separate repo. Most of the back-end code returns JSON response and not HTML code, thus the front end mostly use Ajax calls to connect with the back-end.

The second one was approved.

Thus I am going to create separate git repo for the separate module and also trying to make a simple package manager script in Node.js for downloading code according to git tag mentioned in a config.json to create the same folder structure in a single project, kind of like how Bower does things. Only those modules which are going to be edited by the developer can be put in the config to ignore downloading and instead the developer can use git submodule to make changes in that particular module so that they can use git commands on the module (Commit, pull and push). This is being done so that no developer can modify the code of other modules and so that we can manage the code properly by having them in a separate repo.

Current Folder Structure:

Project Root
  |-app
    |-common (Code used by all the modules)
    | |-js
    | |-py
    |-modules
    |   |-module1
    |   | |-submodule1
    |   | | |-js
    |   | | |-py
    |   | |-submodule2
    |   | | |-js
    |   | | |-py
    |   | ...
    |   |-module2
    |   | |-submodule1
    |   | | |-js
    |   | | |-py
    |   | ...
    |   ...

Questions:
So my question is, is mainly how do other companies make their projects modular, specifically when both back-end and front-end code are in the same module. Is it recommended to have modules in the separate repo?(Already answered by the link provided by gnat)
Also is it good practice to have back-end and front-end together? In short, am I doing things the right way or not, to make the project modular by writing a custom script?

Current stack (In case it's required):
Back End - WebApp2 using Python
Front End - AngularJS
Cloud Platform - Google App Engine SE
HTML Templating Engine - Jade
CSS Templating Engine - Stylus
Task Runner - Gulp (We used to have grunt there, but I recently changed it to gulp)

3
  • 2
    Possible duplicate of Choosing between Single or multiple projects in a git repository?
    – gnat
    Commented Jun 8, 2017 at 7:36
  • @gnat Thanks for the link. It's certainly helpful. Although I have kinda already decided that I want multiple repos. I just want to know what is the standard when you're separating modules in multiple repos and how everyone does it, considering that there's both front end and back end code in each module.
    – noob
    Commented Jun 8, 2017 at 8:52
  • From the description of the existing layout it sounds like the code is already modular, and your question is just about modularising your Git repos? Commented Mar 8, 2018 at 17:44

1 Answer 1

3

I want to answer this but the thing is, does modular really refer to how your going to separate programs into repositories? Usually a program being modular would refer to a program and its ability to be split up into interchangeable chunks which are independent of each other. That's a whole other topic.

However, in regards to repositories I've found teams usually just have one per module like you have.

And including front-end and back-end isn't so bad. Haven't seen anyone complain about that (though if I'm wrong id love to know).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.