In this article we will look at several problems that every developer who uses a boilerplate can face:
Basically, all app templates and boilerplates are built with intention to implement all possible functions and features you can ever image. But, of course, it’s a 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 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, basically, it’s only about technologies: we use PostgreSQL for the database, ReactJS/Bootstrap for the frontend.
Let’s see how we can create a light theme for our dashboard. All SCSS files can be found under /src/shared/theme folder. The dashboard.scss file is where you change all the styles of your dashboard. You also some more common styles in common.scss file and styles for non-authorized pages (like login and registration ones) in auth.scss.
Now, when you change your style and other code, add new files, change existing ones, the question “How would I keep all updates from the official version if I customize and keep all the code in my own repository?” comes.
As our source is being stored in the Git repository, we would assume you use Git too. The 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 mess. Let’s assume you clone the repo:
git clone https://github.com/saasforge/open-source-saas-boilerpate <your_folder_name>
Now, we rename the origin to, say, official:
git rename origin official
Then we can link the code to our own repository:
git remote add origin <your_repo_git_address>
Then work as usual, make a lot of changes and customizations.
When it’s time to commit changes keep the usual workflow:
git add .
git commit -m ‘our cool commit’
git push origin master
Now, after a while we want to pull the latest changes from the official:
git pull official master
Probably you will have to merge files. Git is great in automerging but sometime it can't resolve conflicts on their own. You will see which files need to be merged manually. VS Code by Microsoft allows to merge conflicts using their visual interface (picture by Microsoft):
After you finish with merging, add and commit your changes as usually.
That’s it!
You also can chain several repositories one by one. For example, in SaaS Forge the first project is always open-source, the next one (which is cloned from it) is a paid one, and the third level are all custom projects. So, every next project is, in core, the extension of the previous one.
Any questions, suggestions? Please tweet us or drop a line to our email. Happy coding!