For the impatients: go to my new blog on https://blog-rmannibucau.rhcloud.com/ .
Blogging is probably the easiest way to share some tips and experiences. But – not to offend anyone – it needs a technical solution adapted to the writer(s).
I started blogging in 2012 on this wordpress.com blog which is an awesome platform ! Everything is already set up : hosting and installation are managed for you.
However, since few months, I felt quite limited relying on the free wordpress platform.
The main issue on wordpress.com is that you can not freely customize/design your blog (theme, plugins, …). Part of that, I often share codes and the provided themes didn’t support snippets very well. And that was embarrassing.
Second, I’m mainly writing about Java but I’m doing it on a PHP platform ! So I felt like promoting something I don’t use myself. It doesn’t respect “eat your own dogfood” principle and I started to feel inconsistent about that.
So I decided to move away from the wordpress.com platform to a more appropriate one.
Then the question was: where to move and what solution to choose ?
Studied options were:
- custom wordpress or CMS hosting
- custom application
Most of the CMS I evaluated (wordpress, drupal, joomla…) were based on PHP technology. This is not an issue by itself but now I want to be consistent with what I’m writing and therefore I decided not to go with a non-Java solution.
To go even further I desired a EE (or at least JAX-RS) based solution but I didn’t find any major open sourced one.
After all, a blog is not that complicated:
- category or tag
- and of course…. content !
So writing it can make sense.
Wait ! No comments ? Yes, after few years of blogging, I realized that it is great to leave a comment directly. But it also prevents the discussion (and often the issue) from being solved in the project list. That’s why I decided to not implement comments. However, it doesn’t mean you can not discuss about a post ! You can of course contact me through my twitter account, or through the project’s mailing-list related to the post, if accurate.
In current blogging sphere, the generated sites have good vibes but I didn’t want to go that way because it requires re-deployment for content updates, and I want to be able to share the content management with non-technical people.
To simplify, it means being able to edit, refresh and get the updates. This means I need a more classical HTTP application.
As mentioned above, the backend decision was to be JAX-RS based solution. Goal is to be able to extend the views in the future and easily write clients (including a CLI).
We have the “backend front” choice, but what about the persistence?
Using JavaEE, I have JPA built-in and it is often used for blogs so it can be a good candidate. But in 2016,there are other options:
- NoSQL : OrientDB, MongoDB, Cassandra are good candidates for instance
- Git(hub) : yeah, flat files and a java git client to handle CRUD operations
Here, I decided to use JPA (a relational database more than JPA actually) because it is easier to work with and integrate a RDBMS than other databases today:
- A default datasource is provided by JavaEE (or TomEE for pre JavaEE 7 versions) and therefore allows you to run without any addition
- Most of hosting providers (cloud or not) will support it, but maybe not other solutions
- Git (or Github) was either a custom git repository I didn’t want to maintain (backup etc…) but private hosting was not free. Side note: not using private hosting means your blog (and even your sources) will likely be read on github itself. That means you have no way to view statistics, etc…
I will not detail more the backend implementation, even if some parts are interesting. But I will probably do in other posts. The goal of this post is just to share the other all decision.
The only drawback I got with it was its little community, and it is something I’d like to avoid from now on.
The alternative at that time (yeah it was few months ago ;)) were AngularJS and ReactJS. Angular was not chosen because version 2 was close to be out but not yet usable. So you understand now why I chose ReactJS? Well not exactly… I tested Angular2 even if it was not ready to be used at that time. I identified that their API + Typescript usage makes backend/frontend writing at the same time smoother than usual.
As this coding was done during my spare time, while I didn’t have major constraints, I decided to wait a bit for Angular2 to choose it as a final solution.
So my fullstack blog is: JPA/JAX-RS/Angular2.
You can make researches : all java solutions have drawbacks/limitation and *by nature* all good solutions are based on NodeJS. They are the first users so that’s natural😉
Concerning java, maven was a natural solution, especially because of the quality of tomee-embedded maven plugin which makes the development very easy. More, there is a nice NodeJS maven plugin, so I just needed a NodeJS build solution. Gulp (http://gulpjs.com/) was evaluated but was too task-oriented (do it yourself) for a simple project like a blog. Thus, I decided to work with webpack (https://webpack.github.io/docs/) which has an insanely easy angular2 starting sample and a very easy built-in API.
Was it the right choice?
In terms of code, I’m quite happy about that stack : I can use TomEE goodness for backend writing and testing (more to come in future posts ;)) Furthermore, Angular2 is simple even for a Java developer. On the build side, the only trick was to ensure to be able to test Java part without building the full frontend task, and the opposite as well. But it is actually easy. Finally, development workflow is quite efficient.
However “all is not rosy”! Angular2 uses RxJs which is insanely great in terms of API and even patterns. However, it makes the frontend quite bigger than the original VueJS solution for instance. They are working on it, and it will likely be improved in the future. It is
not a real blocker, but can have an impact on mobile devices when network is not good enough.
To sum up, I am quite happy with that stack even if some optimizations can still be done and hope this new blog will enable sharing more content in a better manner.