In this article, we will look at several problems that every developer who uses a boilerplate can face:
- How to customize your project
- How to store it in your repository and still be able to pull all updates
All app templates and boilerplates are built to implement all possible functions and features. But, of course, it’s real life, and somebody would like to change your nice fonts, colors, pictures, icons, add more pages, change the structure, database models, change styles, et cetera, not to mention the code base itself.
In our boilerplate, we were trying to find a golden mean - to make everything as much customizable as possible but leave some things not changeable at all - to avoid unnecessary clutter. So, it’s only about technologies: we use PostgreSQL for the database and ReactJS/Bootstrap for the front end.
As our source is stored in the Git repository, we would assume you use Git too. Working with other types of version control should be pretty straightforward too. With Git, the trick is to link the code with two repositories simultaneously. It’s not hard and doesn’t lead to a mess. Let’s assume you clone the repo:
git clone https://github.com/ctrlTilde/node-api-skeleton <your_folder_name>
Now, we rename the origin to, say, upstream:
git rename origin upstream
Then we can link the code to our repository:
git remote add origin <your_repo_git_address>
Then work as usual, and make a lot of changes and customizations.
When it’s time to commit changes, keep the usual workflow:
git add .
git commit -m 'our awesome code'
git push origin master
Now, after a while, we want to pull the latest changes from the upstream:
git pull upstream master
You will probably have to merge files. Git is great in auto merging, but sometimes it can't resolve conflicts independently. You will see which files need to be merged manually. Most IDEs have an interface for managing merge conflicts embedded.
After you finish merging, add and commit your changes as usual.
You also can chain several repositories one by one. For example, in CtrlTilde, the first project is always open-source, the next one (which is cloned from it) is paid, and the third level are all custom projects. So, every next project is, at its core, the extension of the previous one.