BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Podcasts Roq: Leveraging Quarkus to Build Static Sites at the Speed of Go

Roq: Leveraging Quarkus to Build Static Sites at the Speed of Go

Andy Damevin, a developer who worked on Quarkus for almost a decade, talks about Roq. A project that started as an experiment to try to see if it’s possible to build a static web site generator on top of quarkus. He touches on the rationale for choosing Java and Quarkus, how to migrate to Roq, and the platform's future.

Key Takeaways

  • Java evolved into a much more developer-friendly programming language. Beyond the evolution of the language itself, Quarkus and its focus on developer experience also play a big role.
  • Roq’s architecture is very simple: a thin layer on top of Quarkus that translates markdown files into static HTML pages.
  • In general, Roq’s footprint and bootstrapping are quite fast. This comes from two factors: Quarkus’ efficiency and the light nature of the extension.
  • To migrate an existing web deployment to Roq, it suffices to extract the content into markdown files and to add them to Roq.
  • Next, the maintainers are looking into adding more “non-technical” user-friendliness to the platform.

Transcript

Olimpiu Pop: Hello, everybody. I'm Olimpiu Pop, an InfoQ editor. And I have in front of me, Andy, who is the builder, the fire-starter of Roq, which is more or less a new way of putting Markdown language online, right? But before, Andy, can you please introduce yourselves and then tell us what actually Roq is?

Andy Damevin: Of course. So I'm Andy Damevin. I'm a full-stack developer. I love Java. I love UIs. And above all, I love making it all streamlined. I love when things are easy to use. I've been in the Quarkus team for nine years. If you don't know Quarkus, Quarkus is a Java framework. It's getting pretty famous. And I made a lot of tools for Quarkus already.

Why Young Developers Can Love Java Too [01:25]

Olimpiu Pop: So what's the connection between Quarkus and Roq? Because in the end we are here to speak about Roq, right?

Andy Damevin: Yes, we are here to speak about Roq. Roq is a static site generator and it allowed to create static sites using Quarkus behind the scene, but you don't need to know about Quarkus or Java. It's just that it's using its power to do it.

Olimpiu Pop: That's nicely said. But before we delve into why would you like to build another static website generator, because usually that's a piece of technology for other areas, not for Java, I have to take note about the fact that you said, "I like Java". For those people that don't know Andy, he's very young and he still likes Java. And that's why I wanted to see how did Java has changed in the nine years since you joined the Quarkus team in terms of language and how easy it is to get started with it? Mainly the language level that you use like a developer.

Andy Damevin: So I see two questions. The first is about Java and why it's cool again, let's say that this way. And the other is about why using Java for Roq. And that, I think, is a totally different question. And you also ask why another static site generator?

Olimpiu Pop: Well, we'll just take them one by one, but now I'm just curious because for a long period of time, people are saying whenever you say Java, they said slow. Java, slow. This was like a contest. And then everybody was explaining how fabulous different type of ecosystems are. And now these voices start to get smaller and smaller. And I think in the last couple of weeks, I organized at least two meetups and there are a lot of young people, meaning fresh graduates that are working and looking into Java. And that was like, wow, finally it's getting out of those weeds and it's nice. So Java is in a good place. Then going back to what you mentioned, yes. Why another static sites generator?

Andy Damevin: So why Java again? To be fully honest, at some point I started working a bit in Go, and I thought Java was not going to be something in the future. And Quarkus really changed the game. It's not really Quarkus. It's the fact that it brings that native speed that was missing in Java. I always love Java. I always preferred coding in Java rather than in Go, because it give a really nice format to things. Everything is clean, you have test, it's well organized. And that's what I love about Java. And I think to make really nice infrastructures to really powerful application, Java is the perfect solution. But the thing is, people were moving away from it and starting using Go and stuff like that, mostly because it can compile to binaries. And if you take Java, you were not about to do that. And the JVM was a problem.

And now it's starting to be a good thing again because when you see that you can do binary again, then you start to switch back to the JVM again because you say, "Okay, I can do binary". I can be quick, but I can also do optimization at runtime and things like that you can do with the JVM that you can do with Play Native. I think that makes Java cool again. And that's not taking everything that Java has really evolved with the new JDKs that are arriving. If you take everything together, I think it would be something in the future.

Olimpiu Pop: Yes, but we are promising or the community is promising that Java is dying for at least 15 years. And for me, it seems that the ecosystem is growing and growing. And looking aside, it's like somehow very much differentiator in terms of the different generation of technologies. If you just think initially you had the EJBs a long time ago, you had enterprise Java bins and that was awful. And then we had the new wave of stuff and it was Spring that was trying to do something there. And then we had the POJOs, regardless of where they are enterprise or Spring. And then we have now this, you can call it Renaissance if you want. We had a third generation of way of writing applications and that's Quarkus and probably you can put Micronaut in the same category, but that's a whole different perspective of looking at it is fast.

Why Another Static Website Generator Written in Java [06:00]

And what I particularly liked a lot about what Quarkus did even since it began and I had at least one conversation with Max Anderson about it, you thought about the developer joy. And that was a new metric that appeared for the developer because up to then you spoke about performance, you spoke about patterns, and then all of a sudden you had an all different mechanism. That was good. Did any of this play any role into writing Roq around Quarkus?

Andy Damevin: So the thing with Roq is it's just luck, let's say it that way. Because I don't think that Quarkus initially was the best place and the best system to make a static site generator. It wasn't obvious. And when I built it, I thought, "Okay, maybe it's more than what I initially thought when I started it". I started it because it was easy to make. It was just a small piece on top of Quarkus. So I thought, "Okay, why not?" And then I thought, "Oh, but we have everything in Quarkus that you need". But just out of Quarkus, the static site generator is just a small part. It's nearly nothing compared to everything that Quarkus brings. And I don't think there are any other static site generator that have everything ready beforehand. And the static site generator is just a small part of it.

Olimpiu Pop: So Roq is actually an extension on Quarkus. So actually what you have is a Quarkus engine that is enabled to generate static sites, right?

Andy Damevin: Yes.

Olimpiu Pop: Okay. That might make sense in some situations, but isn't it too heavyweight? If I need a plain website... I don't know, I have a bunch of MD files. I want to create something like a blog, a release site or whatever. Do I really need something as powerful as Quarkus behind it?

Andy Damevin: If you take that question, you need to consider the alternatives, obviously. And if you compare it to the alternative, I think it makes Roq a really good candidate in your choice because in the end, Quarkus is not making it heavier at all and it brings an awesome developer experience and we will see later a wider experience. If you want to write content, it's also really good. So if you put everything together, yes, I think it's a good candidate.

How Does Roq Look Under the Hood? [08:23]

Olimpiu Pop: Okay. What actually is behind the scenes? So how should I look at it? Okay, we have Quarkus and we know that it starts fast and it has a bunch of things internally that allows it to process things faster due to the way how the team build it around the reactive streams and everything inside. And then obviously the way how it handles and loads the data allows it to be very fast. So it's clear that this is a very powerful tool. What's needed more to be able to build static websites? Okay, please describe how basically the architecture looks like. Okay, we have hardcore that provides with the context. And then what else does Roq bring to the table or what you had to put together?

Andy Damevin: That's a good question. So how is Roq working? If you look closely, in Quarkus, you have two distinct parts of the built-in and the runtime. That's a big particularity about Quarkus. But just to say, everything I'm saying now is not making Roq more complicated. It's just that it's how it's made, but you don't need to know all that to actually use it. But it's always nice to know it's working behind the scene. What changed in my mind is when I thought, "Okay, when you're building a static website, you want to build your website and building mean generating all those pages statically". When you think about Quarkus, you have the build time. So you want to build things at build time, but I thought, okay, why do we need to build things at build time? We could actually work like on any normal Quarkus application that is served at runtime and generate it like a snapshot.

You just dump everything as files from the Quarkus application. And that's actually how Roq works. It's just starting a Quarkus application, but it's so light that it's really fast and it's dumping everything from your Quarkus application to static files. This is what makes it pretty unique because you're actually using Quarkus like the Quarkus runtime. You're starting it to generate your things. And that's also what's cool for development because when you're developing compared to other static site generator, we don't actually generate anything. We just use Quarkus server. It will just render on demand. So you have live reload by default and when you actually need to grid, then we are going to dump everything as files.

Migrating an Existing Blog to Roq [10:55]

Olimpiu Pop: So let's take an example and we discussed about this previously. Let's say the Java advent calendar that is published each year in December, we have the articles and so on and so forth. Probably now we have 13 to 15 years of articles there. They are part of a database probably in WordPress. I don't know. I never understood how WordPress works. Well, it's PHP who actually knows what's in there. But if we are looking into migrating it to Roq to just say that, "Okay, we are bootstrapping and we are pushed into Java ecosystem", what actually should we do? What are the steps that we should take to go get on the other side?

Andy Damevin: Something special about WordPress is the fact that I don't think it's a static site generator. It's more a content management system, and I don't think it's generating things statically. Maybe you can, but I'm not sure. It is using PHP and it's rendering at runtime as far as I know.

Olimpiu Pop: Yes, that's a whole conversation, but let's think about it, making it simple. So we generate the articles when obviously you want a static site generator because it's more secure on one hand side and then it's easier to index. So basically this would be the things that I would think of to need a static site generator. What should I do? Because in the end, if I understand correctly, Roq is using MD files. So you're using Markdown, right?

Andy Damevin: Yes. Markdown.

Olimpiu Pop: There are a bunch of them.

Andy Damevin: Yes, you can use Markdown or AsciiDoc.

Olimpiu Pop: Okay. So any of the more programmatic way of writing things, Markdown is a lot more simple. AsciiDoctor is more complex. If you have more complicated stuff and you want to put more stuff in there, it's very powerful. But it's moving away from what you see it's all to get to a more programmatic way of looking at things. And probably GitHub made MD very, very powerful. So if I understand correctly, we need to have these things in place. So we have the Markdowns with the content that we want on our website, right?

Andy Damevin: Yes.

Olimpiu Pop: Then if we look about the website, the other thing that we need is about styling. How does it look in terms of templating and stuff like that? How is that done in Roq?

Andy Damevin: So if you want to convert from WordPress to Roq, considering that you can easily convert from HTML to Markdown or to AsciiDoc, I suppose you would have to take your DB as HTML and convert it to Markdown. It doesn't mean that you need to write article in Markdown because you have a lot of editors that allows you to just use it like you would do on Word on any other writing tool, and then it will just convert it to Markdown. When you have all your Markdown, there is a structure that you put your files in, and instead of having a DB, you will put them on a file system.

And when you have all your file, you will need templates that direct how your page look like, and that's pretty much it. For styling, you use a Quarkus extension, which is named the web bundler. It will take all your JavaScripts, all your styles, bundle them to make them production ready, and make them available to your application and without any configuration. So that's out of the box.

Olimpiu Pop: Okay. So if I get it correctly, you'll use a full structure for your ERP where you're just putting the things one after the other and then use either MD files or AsciiDoctor the types that you are done. And in terms of templating, you need another Quarkus extension that will take care of the web stuff and just bundle it and that's it.

Andy Damevin: Yes.

How Many Resources Does Roq Need? [14:36]

Olimpiu Pop: How about the footprint? If I'm looking at the normal application, so just out of the box without any kind of tinkering around, what should I expect in terms of amount of resources that I need? Is it huge? It's decent. Can I run it on, I don't know, Raspberry Pi, I can take a very small space in the cloud and just run it? So what should I think in terms of running it?

Andy Damevin: When you are a developer, you will use Quarkus to develop the base of the website. If you are a writer, you can use Quarkus and the file system to edit content. You can just do it on the file system. We are building a CMS as part of the UI. So as a writer, you will be able to just create edit like you would do on WordPress with what you see and what you get and everything. So for a writer, it's pretty cool. And then you have the generating part where you generate all the pages and out of that, you get all the pages that you can run on any static server. So you could start it on Nginx or Apache or whatever. It's just static files. So it will work on Raspberry, I suppose.

Olimpiu Pop: Okay, great. So there are two different things to that. It's up to me what I get. So in the end, I'll just get the content and it depends on me where I put it. And then behind it's the engine that actually does the transformation, right? Did I understand correctly?

Andy Damevin: Yes. And the engine is specialized. So you could also say that those parts are quite light.

Olimpiu Pop: How friendly would it be for non-programmers? Is it enough to just tell them, "Okay, write an MD file and just drop it there"?

Andy Damevin: So, we actually have already the case where user are not Java friendly, writers are not Java friendly and they'd be using it on different site and feedback were good compared to the other like JDK or Hugo. So yes, it's pretty easy to use and it will be even more easy very soon because for now you need the JDK installed on your machine, which can be a burden for people. It's already installed on most machine without you knowing, but if you don't have it, that can be a problem. And we are building a small wrapper so that anyone can start developing of writing without having anything on this machine, which I think it's pretty cool. I don't think there are any other SSG in which you can do that.

Future Improvements for Roq [16:54]

Olimpiu Pop: Okay. So let me see if I get it correctly. Is it a way to bootstrap yourself? I don't know, as it was the Gradle Wrapper in the lack of a better example where I just got everything and I just started it and that's it? That's what you have in mind?

Andy Damevin: Yes.

Olimpiu Pop: And how would I get my hand on that? It's just downloading it or it's installed via Homebrew or what do you have in mind?

Andy Damevin: So that's still to figure out. We're really working on making the story as streamlined as possible and there are still pieces missing, but we want them to be there. Even starting a binary can be hard for writers, I think. Some are not using the terminal and I'm not sure how we could do that, but in the end when you start Quarkus, it could be a really small app that just spin up the local server and then you do everything on your browser, which is local. This is something we want for Roq. It's not there yet because it's pretty fresh, but that would be cool.

Olimpiu Pop: Well, good luck with that. Let's see how cool it is. Andy, what else should we know about Roq that I didn't ask?

Andy Damevin: I've been working on the web bundler extension for Quarkus. This is the one that lets you add JavaScript styles and libraries. Without you configuring anything, it will just make them Pro ready. It can be served on your static server. And I'm working on the V2 and the V2 has out of the box super for Tailwind. I know a lot of people want Tailwind or such UI frameworks to style their website. It's really important for static site generators. So it's coming and it will be soon there. We already have the web bundler, but the V2 will come.

We're also thinking about AI in two places actually. One will be the CMS that will be in the WA where you will be able to write article. It will automatically add tags or guess the title or write part of the article or tell you suggestion about your article, stuff like that. So you can have AI help you edit content. And the other part where we are considering AI is because everyone is talking about AI now and it's important, but we will always need to have content on the web. If you don't have the content, the AI will not be able to build its data and without its data, it won't be able to work. So for this, you will need to provide the content and those generators will need to know how to make it friendly for AIs to consume. And we are actually working also on that so that when you use Roq, it will automatically generate all the metadata that is necessary for AI to consume. Semantic graph, it will be AI friendly for AIs to consume.

Olimpiu Pop: One last question for me to wrap up, and that's more probably for managers than for developers. There are a lot of changes in the IBM/Red Hat ecosystem. A lot of things move from one side to another. Where does Quarkus remain? Is it with IBM? Is it with Red Hat? Any concerns about changing license because that was a topic not long ago? Can you share anything on that point?

Andy Damevin: So first thing, I'm maybe not the best person to answer that question, but something I can say is that the fact that Quarkus has moved to Commonhaus, which is the most important part, it means that it's fully open source and led by an open source organization.

Olimpiu Pop: Yes. Okay. So Quarkus's destiny is tied to Open House Foundation and that allows it to still remain in the open source ecosystem and that's governed by that organization, right?

Andy Damevin: Exactly. And it doesn't mean that Red Hat and IBM will stop helping it, but I have not much information on that part, but they're also still building projects on top of it. So it means that they will rely on it in the future.

Olimpiu Pop: Okay, great. Thank you for your time and for sharing all the information.

Andy Damevin: Thanks to you, Olimpiu.

About the Author

More about our podcasts

You can keep up-to-date with the podcasts via our RSS Feed, and they are available via SoundCloud, Apple Podcasts, Spotify, Overcast and YouTube. From this page you also have access to our recorded show notes. They all have clickable links that will take you directly to that part of the audio.

Previous podcasts

Rate this Article

Adoption
Style

BT