<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dima Miro</title>
    <description>The latest articles on DEV Community by Dima Miro (@dimamiro).</description>
    <link>https://dev.to/dimamiro</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F557714%2Fd6101076-b971-4b29-ad30-0641db540071.png</url>
      <title>DEV Community: Dima Miro</title>
      <link>https://dev.to/dimamiro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dimamiro"/>
    <language>en</language>
    <item>
      <title>Gatsby or Next.js - what to choose in 2021?</title>
      <dc:creator>Dima Miro</dc:creator>
      <pubDate>Mon, 31 May 2021 15:46:49 +0000</pubDate>
      <link>https://dev.to/dimamiro/um-267-gatsby-or-next-js-what-to-choose-in-2021-3pfa</link>
      <guid>https://dev.to/dimamiro/um-267-gatsby-or-next-js-what-to-choose-in-2021-3pfa</guid>
      <description>&lt;p&gt;&lt;strong&gt;When starting a new project I'm often finding myself choosing between Gatsby and Next frameworks. So I decided to write a little post about what are those things for and what to choose in 2021.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I started my journey with Jamstack from Gatsby thanks to my previous team leader which initiated rebuilding a company website using Gatsby as the main framework.&lt;/p&gt;

&lt;p&gt;It was an amazing experience. I fell in love with Gatsby as a framework and Jamstack as an approach almost from the very beginning of coding. And when I decided to run a web agency I pushed Jamstack as a primary architecture and Gatsby as a primary framework to use. I even didn't want to listen that there are alternatives. Gatsby – one love, that's what I thought at that time.&lt;/p&gt;

&lt;p&gt;But the time was passing by and the team started to look around, then we noticed another great React framework Next. Quite similar at the first glance but different at the same time when looking deeper.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Gatsby and Next all about?
&lt;/h2&gt;

&lt;p&gt;Well, both frameworks are created on top of React. What does it mean? It means that you have all React foundations that give you a create-react-app boilerplate plus additional features, toolkit, and guidelines of how the app should be coded on top.&lt;/p&gt;

&lt;p&gt;As I mentioned above, at the first glance they are both fairly similar as they:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;create an app from boilerplate&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;allow to code a website significantly faster with awesome developer experience&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;generate SEO-friendly and super-fast websites&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But there are two common beliefs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Gatsby is for static content only. While some time ago it would be used only for static content that will be stored in CDN, now Gatsby offers a complex product that may be used for both static websites and dynamic apps. The glory of Gatsby as a static-site generator haunts its creators as they have to make a webinar to dispel this.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next is a server-side rendering only framework. Well, maybe once upon a time in a faraway galaxy, but definitely not nowadays. From v9.3 we can choose what approach to use: server-side rendering or static site generation.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;They rapidly evolve and become kind of monsters.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do we get on start?
&lt;/h2&gt;

&lt;p&gt;Let's start from the very beginning. We generate a new project, open it, and... see a boilerplate structure that both frameworks kindly prepared for us. Same at the first glance but a little bit different.&lt;/p&gt;

&lt;h3&gt;
  
  
  Public assets
&lt;/h3&gt;

&lt;p&gt;The folder named &lt;code&gt;public&lt;/code&gt; contains built files in the case of Gatsby and static assets in the case of Next. The last one creates &lt;code&gt;.next&lt;/code&gt; file for built files.&lt;/p&gt;

&lt;p&gt;In both boilerplates, we also have config files where we can provide settings for the project. Both generate different files for us. In Gatsby, a lot of things are going here. All because of plugins. &lt;/p&gt;

&lt;h4&gt;
  
  
  Plugins, addons, and libraries
&lt;/h4&gt;

&lt;p&gt;They build the plugins ecosystem around its functionality and community, which is an important feature you’ll definitely notice as it increases the work speed. Imagine you have a plugin for everything, with a minimum setup time, just paste the code and implement almost every external integration. Cool, isn’t it? I’m sure it’s a killer feature for many devs.&lt;/p&gt;

&lt;p&gt;Next doesn’t have this kind of functionality, but both frameworks support all React libraries. In a nutshell, you can implement your integrations in both frameworks, it’s just a case of extended time in Next, but Gatsby does it faster (depending on the complexity of integration, obviously).&lt;/p&gt;

&lt;h4&gt;
  
  
  Routing
&lt;/h4&gt;

&lt;p&gt;And routing. There is a folder &lt;code&gt;pages&lt;/code&gt; where all our page components will live. Pages will be automatically generated with names of components inside this folder. You should use special link components to route between internal pages.&lt;/p&gt;

&lt;p&gt;The rest of the file structure is not really important as you're free to organize it as you wish: components, context, utils, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does coding feel?
&lt;/h2&gt;

&lt;p&gt;Both frameworks were created to make developer’s live less stressful. Both take care of routine things and allow us to concentrate on the sense of code. They allow us just creating.&lt;/p&gt;

&lt;h3&gt;
  
  
  Documentation
&lt;/h3&gt;

&lt;p&gt;The learning of both frameworks is not a hard thing if you already know how to build React-based projects. Both &lt;a href="https://www.gatsbyjs.com/docs/"&gt;Gatsby&lt;/a&gt; and &lt;a href="https://nextjs.org/docs"&gt;Next&lt;/a&gt; have comprehensive documentation and a lot of tutorials. Just jump into it and get things done!&lt;/p&gt;

&lt;h3&gt;
  
  
  What makes Gatsby cool?
&lt;/h3&gt;

&lt;p&gt;In my opinion, Gatsby burst into the room just like Jackie Chan and turned the game around. It has a lot of features, a full list of which you can find on their website. I want to mention my favorite ones.&lt;/p&gt;

&lt;h4&gt;
  
  
  Gatsby plugins (again)
&lt;/h4&gt;

&lt;p&gt;I've already mentioned that Gatsby built an ecosystem of plugins. You can find a plugin for almost everything you need: a lot of gatsby-components, gatsby-source plugins, gatsby-integrations, etc. Everything is in their &lt;a href="https://www.gatsbyjs.com/plugins"&gt;plugin directory&lt;/a&gt; for free.&lt;/p&gt;

&lt;h4&gt;
  
  
  GraphQL for everything
&lt;/h4&gt;

&lt;p&gt;Another amazing thing in Gatsby – GraphQL for all queries. Inside and outside of the project. I had to use it, but now I found it very useful. You can always check your queries in GraphiQL Playground that is running together with your project on localhost.&lt;/p&gt;

&lt;h4&gt;
  
  
  Image optimization
&lt;/h4&gt;

&lt;p&gt;Last in this post but not least – Gatsby image optimization. They prepared an amazing component called gatsby-image, and this component does everything we need for image optimization. And it has an awesome blurred effect when an image is loading.&lt;/p&gt;

&lt;h4&gt;
  
  
  Gatsby community
&lt;/h4&gt;

&lt;p&gt;Don't forget about community and support. It's an important part when choosing a framework, and I would say that both Gatsby and Next are doing a great job towards community building. In the case of choosing Gatsby, you can rely on their Discord community. You can always find an answer and just chat there.&lt;/p&gt;

&lt;h3&gt;
  
  
  What makes Next cool?
&lt;/h3&gt;

&lt;p&gt;Next doesn't have special plugins and doesn't use GraphQL out of the box. It has a special image component too, but it doesn't have a blurred effect 🙂&lt;/p&gt;

&lt;p&gt;But Next has a lot of other features which make it a favorite of many.&lt;/p&gt;

&lt;h4&gt;
  
  
  Serverless functions
&lt;/h4&gt;

&lt;p&gt;For example, &lt;code&gt;api&lt;/code&gt; folder is generated from the start. I didn't mention it in the previous block, but it's worth it for sure. Every js file in this folder will be executed as a serverless function when a project is hosted on Vercel or Netlify. These functions handle logic like user authentication, form submission, database queries, custom slack commands, and more.&lt;/p&gt;

&lt;h4&gt;
  
  
  SSG + SSR. What?
&lt;/h4&gt;

&lt;p&gt;Another great thing in Next – a hybrid approach. That means that you can combine static site generation (SSG) and server-side rendering (SSR). We got this possibility starting from &lt;a href="https://nextjs.org/blog/next-9-3"&gt;9.3 release&lt;/a&gt; and I also found it very useful.&lt;/p&gt;

&lt;h4&gt;
  
  
  The sophisticated way for updating the content
&lt;/h4&gt;

&lt;p&gt;There are a lot of other great features which you can found in their documentation. I want to mention only one more – incremental static regeneration (ISR). Long story short, if you want to get an idea of that, I suggest jumping into the &lt;a href="https://www.smashingmagazine.com/2021/04/incremental-static-regeneration-nextjs/"&gt;article&lt;/a&gt; written by Lee Robinson for Smashing Magazine, where he explains everything about ISR.&lt;/p&gt;

&lt;h4&gt;
  
  
  Next community
&lt;/h4&gt;

&lt;p&gt;Vercel, Next’s parent company, hires ambassadors that make high-quality content for the community. I've already mention Lee Robinson here, and I suggest taking a look at his &lt;a href="https://www.youtube.com/channel/UCZMli3czZnd1uoc1ShTouQw"&gt;YT channel&lt;/a&gt;, &lt;a href="https://leerob.io/"&gt;blog&lt;/a&gt;, and &lt;a href="https://twitter.com/leeerob"&gt;Twitter&lt;/a&gt;. There is a lot of worthwhile information out there.&lt;/p&gt;

&lt;h2&gt;
  
  
  What will we get in the end?
&lt;/h2&gt;

&lt;p&gt;When your project is compiled you will get a fast and SEO-friendly website or app. You just have to choose the appropriate hosting platform (Vercel, AWS, Netlify, Cloudflare, etc.) and here we go. Your project is live! &lt;/p&gt;

&lt;p&gt;The hosting platforms is a topic that worth making a separate comparison post, which is on my plans. One thing I want to add is that both companies behind those frameworks have their own platforms: Gatsby Cloud and Vercel.&lt;/p&gt;

&lt;h2&gt;
  
  
  And the conclusion
&lt;/h2&gt;

&lt;p&gt;Although Next may look like taking leadership, for me, there no winner in this competition. You can endlessly count the pros and cons of both. In Unikorns, we use both frameworks, and it mainly depends on project needs and structure. Moreover, according to Gatsby’s own comparison, those frameworks are both taking into consideration basic parameters, so it’s mainly a case of personal preferences and skills.&lt;/p&gt;

&lt;p&gt;Hope you enjoyed this article and stay tuned!&lt;/p&gt;

&lt;p&gt;Don’t hesitate to send us a note at &lt;a href="mailto:hello@unikorns.work"&gt;hello@unikorns.work&lt;/a&gt; or visit our website: &lt;a href="http://www.unikorns.work"&gt;www.unikorns.work&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>gatsby</category>
      <category>nextjs</category>
      <category>beginners</category>
    </item>
    <item>
      <title>JAMstack: Blast Off Your Website</title>
      <dc:creator>Dima Miro</dc:creator>
      <pubDate>Thu, 14 Jan 2021 17:42:20 +0000</pubDate>
      <link>https://dev.to/dimamiro/jamstack-blast-off-your-website-5jc</link>
      <guid>https://dev.to/dimamiro/jamstack-blast-off-your-website-5jc</guid>
      <description>&lt;p&gt;Time goes by, and the web is not the same as before. New and new technologies, tools, and approaches are rising almost every day. Google is constantly changing their search algorithms priorities in search ranking. Now they rate better those websites that load faster. Privacy issues cost too much, so security is also quite an important topic today. In this mess, JAMstack was born.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is JAMstack
&lt;/h2&gt;

&lt;p&gt;JAMstack is a new approach to web development. Its three first letters stand for:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Javascript&lt;/strong&gt;. Basically, it’s a programming language. Javascript takes care of request/response operations on the client-side;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API&lt;/strong&gt;. API is a bridge between the client-side with Javascript and server-side with the database;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Markup&lt;/strong&gt;. After data is collected from the server, it's put in markup, and a website starts its rebuilding. Then, the website is optimized by a site generator or a build tool and served in Content Delivery Network (CDN).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This abbreviation was invented by Mathias Biilmann, CEO of Netlify, and we believe that he coined it before definitions behind, but it turned out pretty good.&lt;/p&gt;

&lt;h2&gt;
  
  
  How JAMstack works
&lt;/h2&gt;

&lt;p&gt;Delving deeper into an understanding of the JAMstack conception, let's expand a bit its three-word definition we deciphered above. Commonly speaking it contains:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Markup&lt;/strong&gt;. Markup lies in a remote repository as a source code. It could be Bitbucket, Github repository, or whatever you prefer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content&lt;/strong&gt;. Content lies in the CMS. It could be your own server with a database, or such PaaS like Contentful, or GraphCMS (there are a lot of different services out there).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trigger&lt;/strong&gt;. Every time content or source code changes, the trigger runs rebuild.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build&lt;/strong&gt;. On build-time, the optimized HTML, CSS, and Javascript code is generated based on requested data from CMS. The site generator maximizes static code optimization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment&lt;/strong&gt;. Then the generated code is sent to the CDN (Content Delivery Network), i.e. to servers in different parts of the world. It will load as quickly as possible because the closest physical server from the CDN will be selected, and the request will be redirected to it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why it's so cool
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;First of all, super-high performance. How is this performance achieve? &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pre-rendering. The website is built way before the user requests it.&lt;/li&gt;
&lt;li&gt;Optimization. The site generator (as mentioned above) such as Gatsby.js makes sure that everything is well-optimized.&lt;/li&gt;
&lt;li&gt;Rebuild on demand. The website rebuilds only when source code or content in CMS changes. Not every time when the user requests a website.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Second, is an absence of a rigid binding to the used technologies.&lt;br&gt;
If you suddenly want to change a CMS (Content Management System), it’s not a problem. Only CMS URL should be changed, and probably a couple of things in source code (depends on the data structure returned from CMS).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Third, it’s highly stable.&lt;br&gt;
The website will never crush unless the whole CDN (Content Delivery Network) crushes. But it's very unlikely. Even if there is a bug in source code and build crushes, it's not a problem at all. The changes won’t be published, and the user will see the previous version of the website while you're fixing the bugs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And last but not least, security.&lt;br&gt;
The only thing the intruder can do – download compiled markup (HTML, CSS, and javascript files) of the website. There’s no such situation when someone enters the admin panel by simple manipulations with the website’s URL. No /wp-admin access. CMS is hosted under another URL and nobody (except the owner) can know it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The limitations of the approach
&lt;/h2&gt;

&lt;p&gt;JAMstack websites are cool and awesome, and we do love them, but they are not suitable for everyone and everything. Remember that it's about static content. So, we don't recommend to use it for websites with highly dynamic content. An example of dynamic content is Facebook feed. Feed content is personalized for everyone in a unique way, so we can call it dynamic. But if it was static, the Facebook feed would look the same for everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparison with the "traditional" way of development
&lt;/h2&gt;

&lt;p&gt;As an alternative to the Jamstack, usually considered a LAMP stack, and the undisputed leader in the industry – WordPress. LAMP is another handy-chosen abbreviation that stands for:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;L&lt;/strong&gt; – Linux as a server OS;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt; - Apache as a server architecture;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;M&lt;/strong&gt; - MySQL as a database;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;P&lt;/strong&gt; - PHP/Perl/Python as a server programming language.&lt;/p&gt;

&lt;p&gt;Briefly, the main difference is that the websites created in the LAMP stack are built on every request user makes; a server requests a database and combines the result with data from the page’s markup and plugins to generate the static files.&lt;/p&gt;

&lt;p&gt;The Jamstack websites are built one time and serve the static files immediately after the user has made a request. As a result, we can get this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Funikorns-website-production.s3.eu-central-1.amazonaws.com%2Flighthouse_score_5cefaf36c8.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Funikorns-website-production.s3.eu-central-1.amazonaws.com%2Flighthouse_score_5cefaf36c8.jpeg" alt="Screenshot that represents one hundred points in each lighthouse audit result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LAMP websites could be optimized too, but it requires a lot of hard work, and the result is not always that good. JAMstack is well optimized on start, so it’s super cost-efficient for the client.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Besides the fact that Jamstack is a relatively new player, it is going to be a game-changer. The community and ecosystem are rapidly evolving and constantly expanding possibilities for creating static websites. &lt;/p&gt;

&lt;p&gt;If you have any questions and concerns, we are always happy to answer, help, consult, and just talk about JAMstack and headless approach as such. Feel free to write us at &lt;a href="//mailto:hello@unikorns.work"&gt;hello@unikorns.work&lt;/a&gt; or check out our &lt;a href="https://www.unikorns.work/magazine" rel="noopener noreferrer"&gt;magazine&lt;/a&gt; about development, web design, and SEO.&lt;/p&gt;

&lt;p&gt;Let's make the internet better together!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
