A good start is half the battle..
Such or similar statements also apply to the development of web applications. Anyone who starts with the right tools, in a suitable environment and with a solid foundation, may later not have to tediously restructure the app. Design patterns and best practices in general are often taken very seriously in boilerplates, giving the developer clear guidelines.
With this mindset I have looked at the “Ultimate Boilerplate for Products” Pup from cleverbeagle.com. This is a template for the development of a web application based on Meteor, React, MongoDB and GraphQL. Subsequently I want to answer the question to what extent boilerplates help us with the development of prototypes and when they may actually hinder us.
What does Clever Beagle’s Tool Pup have to offer?
With the installation of Pup (currently in version v2.0.1) you get the executable source code of a small web application for managing Markdown documents. The app contains components to realize the following tasks:
- User registration via OAuth and user administration via an admin panel
- Sending e-mails based on HTML and text templates
- Automatic generation and indexing of a random database set
- Table definitions via GraphQL and an own GraphQL Playground
- Create a sitemap and SEO metadata with app details
- Routing setup for public and authenticated requests
- Server side rendering (SSR) for faster presentation in the browser
- Form validation
- Styling and customization via bootstrap and styled-components
- Browser policies for protection against XSS
- Data export, account deletion and declaration of consent according to GDPR / DSGVO
- Local git repository with an own Linter Script Hooks
- Unit and end-to-end (E2E) tests
- Configuration for Development / Staging / Production Settings
- Complete workflow for app releases and continuous integration including DNS entries, SSL certificates and hosting on Meteor Galaxy (Requires additional access data)
This list is constantly being expanded, as Pup always strives to relieve the developers even more and cover more areas through this boilerplate.
A few weeks ago we delivered the Meteor application Teams & Scores to the Regional association of sport clubs for target shooting in Burgenland.
The main target of the application was to provide an easy way to collect the results of competitions. Flexibility was a core quality, as the score calculation is different from discipline to discipline in target shooting. So, the application can be used for other sport activities as well.
It includes the management of the associated clubs and their members. The permission model is based on the email address of the members and allows the editing depending on their role, e.g. the director of a club may create and edit club members, a club member may edit his own entry, etc.
The customer is very happy with the new application, is it offers an up-to-date user experience for the competition directors, who enters the results, as well as for the users, who want to look up their scores and standing.
The next step is the implementation of team-based championships.
The application is available at http://bsslv.meteor.qnipp.com
Meteor downloads all the packages in the user directory in ~/.meteor/packages. There is no command to clean up this directory, as Meteor doesn’t know the dependencies of all the applications on your computer.
As my partition is always too small, I just wrote a one-liner to solve this problem:
cd ~/.meteor/packages; for i in * ; do pushd $i > /dev/null; ls | sort -V | head -n-1 | while read v ; do rm -rf $v .$v* ; done ; popd ; done
This will delete all but the newest version of every package. If an application needs an older version, it will be downloaded and re-installed by the next start of this application.
It saved me 2.5 GB today. The script works very well in Linux, it should work on Mac OS X as well.
If you delete the link to the meteor command line tool by mistake (it happened to me in the first version of the line above, which contained a bug), you can use the following command to recreate it from the newest version available:
cd ~/.meteor/packages; ln -sf `ls -d packages/meteor-tool/* | sort -Vr | head -n1`/mt-os.linux.x86_64/meteor .
Use all the commands with caution and at your own risk.
You want to start a new Meteor project? Instead of starting from scratch with an empty directory and no packages, you could take an existing boilerplate. There’s no official boilerplate, but a number of them are provided by the community.
The list contains at least the link to the respective Github page. I haven’t tested them, as I created the list as starting point to find a suitable boilerplate for my next Meteor project.
And what else?
The boilerplate by @matteodem contains the command line utility orion to generate the folder structure for the application.
iron-cli is a scaffolding tool for Meteor, which generates the directory structure for Blaze templates, collections, routers, etc. (Tutorial)
Yeoman is a tool for all kinds of web applications, and Google finds various generators for Meteor applications, e.g. for Angular (very active project) and React.
A different approach ist taken by Meteor Kitchen. The complete application including views, models, navigation structure is generated by a single configuration file. Unfortunately, the project is not published as open source (yet).
I’m still choosing the starting point. Let me know your opinion by commenting on this post.