<?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: MOXY</title>
    <description>The latest articles on DEV Community by MOXY (@moxy).</description>
    <link>https://dev.to/moxy</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%2F443714%2F44b49e87-c492-490e-ac53-3743b51c4c75.jpg</url>
      <title>DEV Community: MOXY</title>
      <link>https://dev.to/moxy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/moxy"/>
    <language>en</language>
    <item>
      <title>Next.js with MOXY</title>
      <dc:creator>MOXY</dc:creator>
      <pubDate>Thu, 15 Oct 2020 11:14:40 +0000</pubDate>
      <link>https://dev.to/moxystudio/next-js-with-moxy-4pk4</link>
      <guid>https://dev.to/moxystudio/next-js-with-moxy-4pk4</guid>
      <description>&lt;h2&gt;
  
  
  Some context
&lt;/h2&gt;

&lt;p&gt;At MOXY we aim for a balance between impact, excellence and pragmatism. This has even brought us the Awwwards &lt;strong&gt;Mobile Site of Year&lt;/strong&gt; prize &lt;a href="https://moxy.studio"&gt;for our own website&lt;/a&gt;, which is evaluated by a Google jury.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PQgedtFz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xtu2111wkc91fjci8nv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PQgedtFz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xtu2111wkc91fjci8nv2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://moxy.studio"&gt;https://moxy.studio&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To achieve this sort of result, our designers and engineers work together from day 1 to deliver a balanced outcome given the project constraints, be it time or budget. This close collaboration between people with different expertise allows everyone to give input early on, often resulting in better ideas and solutions. We’ve combined this into a process that we call &lt;strong&gt;Engineered Design&lt;/strong&gt; (we might talk about this in a future article).&lt;/p&gt;

&lt;p&gt;A clear process is key, but we also needed the right tech foundations, and that’s why I’m writing this article, to talk about our web boilerplate, the challenges it solves, and &lt;strong&gt;how that improves Developer Experience&lt;/strong&gt;, and &lt;strong&gt;ultimately the User Experience&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The challenge
&lt;/h2&gt;

&lt;p&gt;There’s a lot of frontend craftsmanship involved in projects of this level, especially on making everything work smoothly while keeping the project maintainable. That’s why we use and love &lt;a href="https://reactjs.org/"&gt;React&lt;/a&gt;, one of the most popular libraries to build user interfaces.&lt;/p&gt;

&lt;p&gt;But React is just a view layer. Every time we wanted to start a project, we were dedicating a lot of time laying down the foundations. The process was repetitive, error-prone and tedious. That time would be definitively better spent on the actual website implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Our first attempt
&lt;/h2&gt;

&lt;p&gt;To reduce the time it takes to setup a project, we created &lt;a href="https://github.com/moxystudio/react-with-moxy/"&gt;React with MOXY&lt;/a&gt;, an open-source boilerplate that packaged React, React Router and modern JavaScript tooling such as ESLint, Stylelint, Webpack, Babel, PostCSS and Jest. It even had support for &lt;a href="https://en.wikipedia.org/wiki/Isomorphic_JavaScript"&gt;server-side rendering&lt;/a&gt;, which is very challenging and complex to get it right, but more on that later.&lt;/p&gt;

&lt;p&gt;Our engineers would copy this project and would have a barebones website working in minutes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/moxystudio/react-with-moxy"&gt;&lt;strong&gt;moxystudio/react-with-moxy&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;MOXY’s boilerplate to create isomorphic react applications.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Many websites were successfully built with it, but it was hard to keep up with the speed in which these libraries release new versions. The maintenance burden was increasing as months passed by to the point it became unsustainable.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  MOXY advocates for open-source and its philosophy. If something can be reused, then we create a package. And if that package is not critical for our business, then we make it open-source.
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;After three years of existence, MOXY has a vast catalogue of &lt;a href="https://github.com/moxystudio"&gt;open-source packages&lt;/a&gt;, and &lt;a href="https://www.npmjs.com/package/cross-spawn"&gt;some&lt;/a&gt; of &lt;a href="https://www.npmjs.com/package/proper-lockfile"&gt;them&lt;/a&gt; have millions of downloads each month. We’re also consumers of open-source and we continuously monitor what’s being released in the wild.&lt;/p&gt;

&lt;p&gt;One of the open-source projects that caught our attention was &lt;a href="https://nextjs.org/"&gt;Next.js&lt;/a&gt;, by Vercel (previously Zeit). We immediately saw its potential, and once it caught up with the features we needed, we ditched React with MOXY for Next.js. It was a humble step to replace a project we created with one made by another company, but I’m glad we did it.&lt;/p&gt;

&lt;p&gt;Fun fact: Next.js &lt;a href="https://github.com/vercel/next.js/blob/53a3ffea25a21847ea1882dcd08ab1634f5b2af7/package.json#L70"&gt;uses&lt;/a&gt; &lt;a href="https://github.com/moxystudio/node-cross-spawn"&gt;cross-spawn&lt;/a&gt; ️❤️, one of MOXY’s most popular open-source projects with &lt;strong&gt;~37.000.000 weekly downloads&lt;/strong&gt; as of this date 😲.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next.js matured
&lt;/h2&gt;

&lt;p&gt;Next.js is the React framework that everyone was missing. It has a vast feature set, is well supported and maintained, and has a huge community.&lt;/p&gt;

&lt;p&gt;One of its core features is &lt;a href="https://nextjs.org/docs/basic-features/pages#server-side-rendering"&gt;Server-side Rendering&lt;/a&gt; (SSR). SSR is a technique that allows you to serve an initial payload with HTML, JavaScript, CSS, and application state. JavaScript running on the client picks up the rendered HTML and resumes its normal operation. This approach has many benefits, but the primary ones are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Consistent SEO, as the crawlers will see fully rendered pages just like traditional static web pages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Functional Social Sharing, as we can add social meta tags specific for each page. Social networks will be able to correctly show a preview card for all pages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Faster &lt;a href="https://web.dev/first-contentful-paint/"&gt;First Contentful Paint&lt;/a&gt; (FCP), as the browser doesn’t need to wait for JavaScript to display content. This improves the perceived performance, that is, how fast a website seems to visitors.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another core feature is &lt;a href="https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation"&gt;Static Generation&lt;/a&gt; (SG). As opposed to SSR, where the server renders pages on every new request, with SG, pages are rendered at build-time. When a request arrives to the server, the page is already rendered and is sent to the client right away. Pre-rendered pages can also be cached by &lt;a href="https://en.wikipedia.org/wiki/Content_delivery_network"&gt;CDNs &lt;/a&gt;to further boost performance. The major disadvantage of SG, however, is when you need to update content. It’s very frustrating to change an article in a &lt;a href="https://en.wikipedia.org/wiki/Headless_content_management_system"&gt;CMS&lt;/a&gt; and having to wait several minutes for the change to be shown on the live website. And for websites that have hundreds of thousands of pages, it’s just too slow to be viable. Next.js v9.4 introduced &lt;a href="https://nextjs.org/blog/next-9-4#incremental-static-regeneration-beta"&gt;Incremental Static Regeneration&lt;/a&gt; (ISG) under beta, where static pages are updated behind the scenes as traffic comes in. This technique retains the benefits of SG while solving its shortcomings regarding updates.&lt;/p&gt;

&lt;p&gt;But what’s awesome is that Next.js allows us to combine SSR with SG and ISG, allowing pages to be partially static and partially dynamic!&lt;/p&gt;

&lt;h2&gt;
  
  
  A new boilerplate is born
&lt;/h2&gt;

&lt;p&gt;After embracing Next.js, we decided to create a new boilerplate, &lt;a href="https://github.com/moxystudio/next-with-moxy"&gt;Next.js with MOXY&lt;/a&gt;, which is also open-source. All the code and libraries that were in our previous boilerplate were removed as they are all being abstracted by Next.js. The maintenance burden was gone and we had more time to dedicate to our clients’ projects.&lt;/p&gt;

&lt;p&gt;All websites we make have a base set of features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Internationalization&lt;/strong&gt; (i18n): Multi-language support is added from the start, even if the project doesn’t initially require it. Uses &lt;a href="https://formatjs.io/docs/react-intl/"&gt;React Intl&lt;/a&gt; and &lt;a href="https://github.com/moxystudio/next-intl"&gt;@moxy/next-intl&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Page transitions:&lt;/strong&gt; Orchestrates exit and enter transitions between routes, includes support to add customized visual effects to such transitions and restores the scroll position automatically. Powered by &lt;a href="https://github.com/moxystudio/react-page-swapper"&gt;@moxy/react-page-swapper&lt;/a&gt; and &lt;a href="https://github.com/moxystudio/next-scroll-behavior"&gt;@moxy/next-scroll-behavior&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t1dDuDpS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kihbeww73tcxhav61bd6.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t1dDuDpS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kihbeww73tcxhav61bd6.gif" alt="Page transitions on Audio UX, one of our most recent projects."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Page transitions on Audio UX, one of our most recent projects.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Accessibility&lt;/strong&gt; (a11y): Care for accessibility, by using semantic HTML, and paying attention to keyboard interactions or alternative input and output devices. Automatic checks are in place to enforce good practices on accessibility.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SEO&lt;/strong&gt;: Any top-level pages will have dedicated metatags which integrate with search engines and social media scrapers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Analytics:&lt;/strong&gt; Usage of &lt;a href="https://marketingplatform.google.com/about/tag-manager/"&gt;Google Tag Manager&lt;/a&gt; to easily add analytics to the projects, like page views or track interactions. Analytics are only enabled after we have consent from the visitor, to comply with GDPR and similar legislation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code linting&lt;/strong&gt;: Usage of &lt;a href="https://eslint.org/"&gt;ESLint&lt;/a&gt; and &lt;a href="https://stylelint.io/"&gt;Stylelint&lt;/a&gt; to ensure code is consistent across the codebase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unit testing&lt;/strong&gt;: Automated tests to validate the correctness and to provide confidence upon code changes, using &lt;a href="https://jestjs.io/"&gt;Jest&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Docker&lt;/strong&gt;: A Dockerfile to package the website into a &lt;a href="https://www.docker.com/"&gt;Docker&lt;/a&gt; image that can run anywhere, on the cloud or on-premises.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Changelog generation:&lt;/strong&gt; A changelog file adhering to the &lt;a href="https://www.conventionalcommits.org/"&gt;Conventional Commits specification&lt;/a&gt; is automatically generated and kept up to date on each release.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Staging pipeline&lt;/strong&gt;: A CI/CD pipeline that automatically runs tests and deploys the website to a staging environment, with support for pull requests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Documentation&lt;/strong&gt;: A webpage with key documentation, including instructions on how to set it up and how to deploy it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MUCFQJJu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jau5svrrjs0udy253qtb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MUCFQJJu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jau5svrrjs0udy253qtb.png" alt="Documentation for Next.js with MOXY."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Documentation for Next.js with MOXY.&lt;/p&gt;

&lt;p&gt;We have embedded all these features, and a few more, into our boilerplate. Moreover, we have an optional set of recipes that can be followed to easily add other features. Two examples are recipes to integrate with &lt;a href="https://next-with.moxy.tech/docs/recipes/contentful"&gt;Contentful&lt;/a&gt; and &lt;a href="https://next-with.moxy.tech/docs/recipes/dato-cms"&gt;DatoCMS&lt;/a&gt;, two of the leading headless CMS on the market.&lt;/p&gt;

&lt;p&gt;You may visit the project’s website at &lt;a href="https://next-with.moxy.tech/"&gt;https://next-with.moxy.tech&lt;/a&gt;. Feel free to use it, give feedback and contribute! 🙏&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LQGgTzjr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ud6hh6wk0ak6ck6kqptw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LQGgTzjr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ud6hh6wk0ak6ck6kqptw.png" alt="Next.js with MOXY logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next.js with MOXY logo&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;With &lt;a href="https://nextjs.org/"&gt;Next.js&lt;/a&gt; and &lt;a href="https://next-with.moxy.tech/"&gt;Next.js with MOXY&lt;/a&gt;, our team has an efficient way to kickstart a project with features that meet our base offering. Recipes can be followed to progressively add other features, such as creating a simple REST API or integrating with a CMS.&lt;/p&gt;

&lt;p&gt;The developer experience is consistent across projects that are using it, and our engineers are able to switch projects easier than ever. We’re now able to deliver faster and with a higher degree of polishing, two things highly appreciated by our clients.&lt;/p&gt;

&lt;p&gt;Below a quick peek on the most recent projects we’ve built using &lt;a href="https://next-with.moxy.tech/"&gt;Next.js with MOXY&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Audio UX — &lt;a href="https://auxnyc.com/"&gt;https://auxnyc.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A full-service audio branding agency specializing in audio logos, UX sound design, automotive sound design, audio for voice experiences, and more.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OlAryxpP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ngkvfak3elrsimz1l88m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OlAryxpP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ngkvfak3elrsimz1l88m.png" alt="Audio UX"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dashdash — &lt;a href="https://dashdash.com"&gt;https://dashdash.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do more with your spreadsheets. Build powerful &lt;a href="https://dashdash.com/sales"&gt;sales&lt;/a&gt; and &lt;a href="https://dashdash.com/marketing"&gt;marketing&lt;/a&gt; tools. Publish them as web apps. All in one tool, without code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--88lGUTvQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/y8tl4hbejegsw83gg2ej.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--88lGUTvQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/y8tl4hbejegsw83gg2ej.png" alt="Dashdash"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;THU Japan — &lt;a href="https://japan.trojan-unicorn.com"&gt;https://japan.trojan-unicorn.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;THU is a strong community with a powerful bond. THU Japan is a Storytelling Bootcamp event taking place in the city of Kaga, Japan in 2020.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SDiGIurc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hpfxq5fxe83ov2pr6l26.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SDiGIurc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hpfxq5fxe83ov2pr6l26.gif" alt="THU Japan"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;At MOXY, we build websites and applications that our customers can feel proud of, instead of being embarrassed and frustrated. Our Engineered Design process helps our customers have a deeper understanding of their challenges, and provides a clear path for solving them through careful design and implementation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Looking for help with a project? &lt;a href="https://moxy.studio/contacts"&gt;Tell us a bit more&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by&lt;/em&gt; André Cruz&lt;/p&gt;

</description>
      <category>react</category>
      <category>nextjs</category>
      <category>web</category>
    </item>
    <item>
      <title>Kickoff your application with js-libp2p
</title>
      <dc:creator>MOXY</dc:creator>
      <pubDate>Thu, 15 Oct 2020 09:11:46 +0000</pubDate>
      <link>https://dev.to/moxystudio/kickoff-your-application-with-js-libp2p-4n8h</link>
      <guid>https://dev.to/moxystudio/kickoff-your-application-with-js-libp2p-4n8h</guid>
      <description>&lt;p&gt;I want to welcome you to libp2p! This guide will walk you through setting up a fully functional libp2p node, so that you can take control of the spacecraft 🚀 from that point on and build your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;P2P based systems and applications have been around for several decades now. Such projects have well known challenges and difficulties that need to be addressed regarding their networking layer.&lt;/p&gt;

&lt;p&gt;Over the years, new projects have implemented p2p networking primitives again and again. These projects usually had their networking layer tight with the application layer and were not open source. Moreover, some projects did not even reach the application layer development as a consequence of all the networking challenges that needed to be solved before getting into it.&lt;/p&gt;

&lt;p&gt;All things considered, during these decades the available projects did not contribute to a rapid growth of the p2p ecosystem. One of the primary goals of libp2p is to fill this gap by enabling application and system developers to focus on their use cases and business logic while relying on a composable networking stack.&lt;/p&gt;




&lt;h3&gt;
  
  
  What is libp2p?
&lt;/h3&gt;

&lt;p&gt;Libp2p is a composable and modular networking stack, which was designed to be able to become the networking layer of any type of p2p system. Its modular nature is the key to enable such a variety of projects, while also being upgradable for future network requirements.&lt;/p&gt;

&lt;p&gt;Understanding where libp2p fits is important to understand how it is designed and how it can be used. Different p2p systems have different needs and requirements, while they might run in different environments and have different hardware capabilities.&lt;/p&gt;




&lt;h3&gt;
  
  
  Considerations before starting
&lt;/h3&gt;

&lt;p&gt;Before you start with libp2p, it is important to understand what environments you expect your application to run on. Nowadays, you can run JavaScript code in several different environments, some of them with their own particularities.&lt;/p&gt;

&lt;p&gt;While the libp2p core codebase aims to work in multiple environments, there are some limitations that are not possible to overcome at the time of writing. As an example, browsers do not support listening for connections via WebSockets, but only to dial known addresses, as they are designed for the traditional client-server model. As a consequence of these limitations, some environments will require to think about a network topology and additional infrastructure as a way to achieve connectivity, as well as to provide a smoother experience to the end user.&lt;/p&gt;

&lt;p&gt;While the libp2p core codebase aims to work in multiple environments, there are some limitations that are not possible to overcome at the time of writing. As an example, browsers do not support listening for connections via WebSockets, but only to dial known addresses, as they are designed for the traditional client-server model. As a consequence of these limitations, some environments will require to think about a network topology and additional infrastructure as a way to achieve connectivity, as well as to provide a smoother experience to the end user.&lt;/p&gt;




&lt;h3&gt;
  
  
  Create your libp2p node with js-libp2p
&lt;/h3&gt;

&lt;p&gt;It is usually recommended to start with a base configuration of libp2p and build upon it, specially for new users that are not entirely familiar with every single piece of the libp2p stack. The most important documents to have handy are the &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/API.md"&gt;API documentation&lt;/a&gt; and the &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md"&gt;Configuration documentation&lt;/a&gt;. The former is divided into two main parts, one for creating a libp2p node and one to interact with it, while the latter is focused on configuring each type of libp2p module. The configuration of libp2p is a key part of its structure. Each project should go through what libp2p can offer and select what is important for them. Regardless of how it is configured, its top level API will always be the same.&lt;/p&gt;

&lt;p&gt;The first step is to install libp2p in your project with your favourite JavaScript Package Manager. In this guide, we will configure the libp2p node in several stages, as this can make troubleshooting configuration issues much easier.&lt;/p&gt;

&lt;p&gt;It is important to specify that the following content is based on &lt;code&gt;libp2p@0.29&lt;/code&gt; as the way libp2p is configured might change in upcoming releases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic setup
&lt;/h3&gt;

&lt;p&gt;With libp2p installed, let’s configure the absolute minimum needed to get your node running. The only modules libp2p requires are a &lt;a href="https://github.com/libp2p/js-interfaces/tree/master/src/transport"&gt;Transport&lt;/a&gt; and a &lt;a href="https://github.com/libp2p/js-interfaces/tree/master/src/crypto"&gt;Crypto&lt;/a&gt; module. Moreover, it is highly recommend that a basic setup should also have a &lt;a href="https://github.com/libp2p/js-interfaces/tree/master/src/stream-muxer"&gt;Stream Multiplexer&lt;/a&gt; configured. The create options can be checked in the &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create"&gt;API.md#create&lt;/a&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Transport
&lt;/h3&gt;

&lt;p&gt;Libp2p uses Transports to establish connections between peers over the network. You can configure one Transport, or as many as you like. Supporting more Transports will improve the ability for other nodes on the network to communicate with you.&lt;/p&gt;

&lt;p&gt;You should select Transports according to the runtime where your application will run. You can see a &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md#transport"&gt;list&lt;/a&gt; of some of the available Transports. As an example, in a browser environment &lt;code&gt;libp2p-websockets&lt;/code&gt; and &lt;code&gt;libp2p-webrtc-star&lt;/code&gt; are typically installed.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;If you need a transport that is still not available, you can easily create your own transport. The only requirement of a libp2p transport is to be compliant with the &lt;a href="https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/transport"&gt;transport interface&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Crypto
&lt;/h2&gt;

&lt;p&gt;In a p2p context, encryption is an essential component for the communication on the libp2p network. Every connection is required to be encrypted to ensure security for everyone.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;libp2p-noise&lt;/code&gt; is the &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md#connection-encryption"&gt;recommended module&lt;/a&gt; to use at the moment. Secio is being &lt;a href="https://blog.ipfs.io/2020-08-07-deprecating-secio/"&gt;deprecated&lt;/a&gt; but other encryption modules might appear soon.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;If you want to use your own connection encryption module, you just need to guarantee that it is compliant with the &lt;a href="https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/crypto"&gt;crypto interface&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multiplexers
&lt;/h3&gt;

&lt;p&gt;Multiplexers are not required by libp2p, but they are super important for the efficiency of the connections using several protocols that libp2p will run. It allows libp2p to run several of its internal protocols, like Identify, as well as allow your application to easily run any number of protocols over a single connection.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Running libp2p
&lt;/h3&gt;

&lt;p&gt;With a Transport, Crypto and Stream Multiplexer modules specified, you can &lt;strong&gt;start&lt;/strong&gt; your libp2p node. However, you also need to specify its listening addresses, so that your transports can listen for connections from other peers. Otherwise, your node will be a "dial only" peer.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;This will work perfectly in a Node.js environment, but it will not be able to start in a browser context. The listen multiaddr &lt;code&gt;/ip4/127.0.0.1/tcp/8000/ws&lt;/code&gt; aims to listen for new websocket connections on the local 8000 port. As previously stated, browsers do not support listening for connections. As a result, this type of multiaddr should not be used if your application will run in a browser environment. However, you can still use the websockets transport to dial other peers that can listen for websocket connections.&lt;/p&gt;

&lt;p&gt;The described issue is one of the main reasons to have libp2p-webrtc-star transport. The other multiaddr &lt;code&gt;/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star&lt;/code&gt; aims to listen on a different machine that can listen for new connections. The star server on &lt;code&gt;wrtc-star1.par.dwebops.pub&lt;/code&gt; will listen for new connections and relay them to the appropriate peer. More than listening from connection on behalf of other peers, the star server acts as a peer discovery mechanism and informs the connected peers once a new peer joins. Bear in mind that this is a public available star server and its availability is not guaranteed. You should &lt;a href="https://github.com/libp2p/js-libp2p-webrtc-star/blob/master/DEPLOYMENT.md"&gt;setup&lt;/a&gt; your own for production.&lt;/p&gt;

&lt;p&gt;You can check the complete &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#libp2p-instance-methods"&gt;API documentation&lt;/a&gt; o understand what you can do with your node from now on.&lt;/p&gt;




&lt;h3&gt;
  
  
  Customize your js-libp2p node
&lt;/h3&gt;

&lt;p&gt;Now that you can have connectivity with other nodes in the network, it is time to select the modules that you need for your application, as well as to tune the node according to your needs.&lt;/p&gt;

&lt;p&gt;There are several other modules that can be added, in order to fulfil the needs of a p2p application. These include Peer Discovery, Pubsub, Content Routing and Peer Routing, among others. Bear in mind that you should only add modules you need.&lt;/p&gt;

&lt;h3&gt;
  
  
  Peer Discovery
&lt;/h3&gt;

&lt;p&gt;One of the most important characteristics of a typical p2p application is its ability to find other peers in the network. Libp2p provides &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md#peer-discovery"&gt;several&lt;/a&gt; discovery protocols. Some of them are also dependent of the runtime of the node, like &lt;code&gt;libp2p-mdns&lt;/code&gt;, which will not work in the browser.&lt;/p&gt;

&lt;p&gt;You can also provide your configuration for each peer discovery module you provide. It is also important to point out that transports with built in peer discovery capabilities (e.g &lt;code&gt;libp2p-webrtc-star&lt;/code&gt;) are automatically added as discovery modules (but can be disabled).&lt;/p&gt;

&lt;p&gt;With Peer Discovery modules added, libp2p will handle everything and add the discovered peers to its Peer Store.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Pubsub
&lt;/h3&gt;

&lt;p&gt;Some applications will potentially need a pubsub message service for real-time communication. There are &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md#pubsub"&gt;two pubsub routers available&lt;/a&gt;, but &lt;code&gt;libp2p-gossipsub&lt;/code&gt; is the recommended router to use thanks to its efficiency and security. Once you have a pubsub router in your node, you are able to use the &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#pubsubgetsubscribers"&gt;Pubsub API Methods&lt;/a&gt;, where the most common methods are &lt;code&gt;subscribe&lt;/code&gt; and &lt;code&gt;publish&lt;/code&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Content and Peer Routing
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md#content-routing"&gt;Content routing&lt;/a&gt; offers a way to find where content lives in the network, while &lt;a href="https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md#peer-routing"&gt;Peer Routing&lt;/a&gt; provides a mechanism to find other peers in the network by making queries using a Peer Routing algorithm. There are currently two implementations for each of these, the DHT (Distributed Hash Table) which provides both content and peer routing, and one delegate router implementation for content routing and one for peer routing. The delegate routers aim to leverage more capable nodes to issue DHT queries on behalf of the requesting peer. It is common to leverage &lt;code&gt;go-ipfs&lt;/code&gt; nodes for this purpose.&lt;/p&gt;

&lt;p&gt;You can have multiple routers, as well as the DHT at the same time. If that is the case, libp2p will start by trying the DHT. If it is not successful, it will try each router until it succeeds.&lt;/p&gt;

&lt;p&gt;It is important pointing out that peers with less capabilities are &lt;strong&gt;not&lt;/strong&gt; recommended to use the DHT.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Create your own protocol
&lt;/h3&gt;

&lt;p&gt;So far, we went through the basics for building a regular p2p app. We may decide which modules to use according to our needs, or even create new ones. But, libp2p also allows the creation of new protocols.&lt;/p&gt;

&lt;p&gt;Libp2p is a "modular system of protocols", where custom protocols operate in a similar fashion as a RESTful API. Each protocol has an identifier and an handler. As an example, &lt;a href="https://ipfs.io"&gt;IPFS&lt;/a&gt; uses the &lt;code&gt;ipfs-bitswap&lt;/code&gt; protocol on top of libp2p for custom data exchange between peers.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;After you have your custom protocol, you just need to hook it into libp2p. The &lt;code&gt;handle&lt;/code&gt;  will listen for stream messages under the protocol and call the provided handler.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  What is next?
&lt;/h2&gt;

&lt;p&gt;Once you have your networking building blocks ready to be used by your app, you can start focusing on it! 🎉 But before going into production, you should setup your own infrastructure. The code examples here use public infrastructure provided by Protocol Labs for experimenting, but they are not meant to be used in production and their availability is not guaranteed. According to your requirements and used modules, you might need to setup webrtc-star servers, delegate routers, or even circuit relay nodes.&lt;/p&gt;

&lt;p&gt;There are a few new features expected for the upcoming libp2p releases that will help with some of the pain points covered here regarding connectivity and discoverability. Stay tuned and let’s distribute the web together! ❤️&lt;/p&gt;

&lt;p&gt;At MOXY we’ve been contributing to libp2p and also leveraging it to deliver distributed applications, namely &lt;a href="https://moxy.studio/work/nomios"&gt;Nomios&lt;/a&gt; and &lt;a href="https://moxy.studio/work/discussify"&gt;Discussify&lt;/a&gt;, among a few others underway. If you are looking for help with a project that could benefit from p2p capabilities, &lt;a href="https://moxy.studio/contacts"&gt;tell us a bit more&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you have any question, issue, or even new ideas with &lt;a href="https://libp2p.io/"&gt;libp2p&lt;/a&gt;, you are welcome to reach out to me directly on &lt;a href="https://twitter.com/vascosantos10"&gt;Twitter&lt;/a&gt;, create a topic in the libp2p &lt;a href="https://discuss.libp2p.io/"&gt;discussion forum&lt;/a&gt; or open Github issues in any &lt;a href="https://github.com/libp2p"&gt;libp2p repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by&lt;/em&gt; &lt;a href="https://dev.to/vascosantos"&gt;Vasco Santos&lt;/a&gt;&lt;/p&gt;

</description>
      <category>p2p</category>
      <category>decentralized</category>
      <category>dapp</category>
    </item>
    <item>
      <title>React Native with MOXY</title>
      <dc:creator>MOXY</dc:creator>
      <pubDate>Wed, 14 Oct 2020 09:50:50 +0000</pubDate>
      <link>https://dev.to/moxystudio/react-native-with-moxy-2el</link>
      <guid>https://dev.to/moxystudio/react-native-with-moxy-2el</guid>
      <description>&lt;h1&gt;
  
  
  Background
&lt;/h1&gt;

&lt;p&gt;About one year and a half ago, MOXY began its journey in the domain of mobile apps engineering. Even before that, as professionals that build digital solutions for the web and continuously monitor industry trends, we were conscious the web is not always the most adequate target platform to deliver certain kind of products and experiences. At the time, new business opportunities in the mobile market started to present themselves when some of our clients approached us to develop apps for them. We then realized it was time to realign our strategy and decided to seriously invest in exploring the mobile technology scene and train our team to develop and design apps for handheld devices targeting iOS and Android.&lt;/p&gt;

&lt;p&gt;If we were to invest resources in learning how to develop to mobile platforms, we were to do it the way right way.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Above all, our premise was that the commitment towards what our clients entrusted us to build and the quality bar we set upon ourselves would have to remain the same: to deliver impactful experiences, visual appealing and polished apps which make us proud and our clients happy.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As such, the mobile development framework of choice would have to ideally comply with the following criteria:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Cross-platform:&lt;/strong&gt;  share a single code base across iOS and Android so we could ship faster and at a lower cost.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Open-source:&lt;/strong&gt;  as an open-source driven company, the technology would have to be backed and maintained by an experienced and massive developer community.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Maturity &amp;amp; stability:&lt;/strong&gt;  the technology would have already reached a stage where it has become reliable to be used in production without major hassles.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Developer experience:&lt;/strong&gt;  the development and debugging tools would have to be easy and pleasant to use. Using the same tools, libraries and languages we already use daily to develop websites would be a major plus as well.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Native capabilities:&lt;/strong&gt;  unlimited access to the native APIs which enable us to develop more specialized and sophisticated apps.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Native-like performance:&lt;/strong&gt;  reasonable load times and smooth animations and transitions.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Why React Native?
&lt;/h1&gt;

&lt;p&gt;React Native is an open-source cross-platform development framework created by Facebook and it was first released to the public in 2015. Armed with the possibility to build native apps using React, a UI library also created by Facebook, React Native’s popularity among web developers grew quickly, which led to the establishment of a thriving community and the proliferation of countless open-source libraries and learning material. Moreover, in the last five years, besides Facebook, several tech giants such as &lt;a href="https://eng.uber.com/ubereats-react-native/" rel="noopener noreferrer"&gt;Uber&lt;/a&gt;, &lt;a href="https://microsoft.github.io/react-native-windows/" rel="noopener noreferrer"&gt;Microsoft&lt;/a&gt; and  &lt;a href="https://engineering.shopify.com/blogs/engineering/react-native-future-mobile-shopify" rel="noopener noreferrer"&gt;Shopify&lt;/a&gt; adopted React Native and continue to place their bets on it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Naturally, it also deserved our attention.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As with everything in technology, our choices are motivated by trade-offs and risk is always involved. We ended up choosing React Native as it ticked the most boxes in our list of goals we set fourth above. The decisive factors behind our decision were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The dominance of JavaScript from the frontend to the backend in our tech stack.&lt;/li&gt;
&lt;li&gt;The long standing usage of React for our web development projects and how much we love it!&lt;/li&gt;
&lt;li&gt;The possibility to utilize tools and libraries we were already familiar with such as ESLint, Babel, Jest, Redux and React Intl, to name a few.&lt;/li&gt;
&lt;li&gt;Our proficiency in JavaScript and React as a whole.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cross-platform development frameworks are very complex and none of them is perfect. React Native is no &lt;a href="https://github.com/react-native-community/discussions-and-proposals/issues/104" rel="noopener noreferrer"&gt;exception&lt;/a&gt;, but it continues to evolve with fast release cycles and has been getting better and better in the last couple of years. Furthermore, a major &lt;a href="https://medium.com/swlh/react-natives-re-architecture-in-2020-9bb82659792c" rel="noopener noreferrer"&gt;architectural shift&lt;/a&gt;, several performance improvements and optimizations are expected to land throughout this year. You can stay tuned by keeping an eye on the  &lt;a href="https://reactnative.dev/blog/" rel="noopener noreferrer"&gt;official blog&lt;/a&gt; for announcements and on the  &lt;a href="https://github.com/react-native-community/discussions-and-proposals" rel="noopener noreferrer"&gt;discussions and proposals repository&lt;/a&gt; to follow ongoing discussions and upcoming developments. Moreover, if you’re interested in having an outlook of the current state of React Native, feel free to check the article by &lt;a href="https://blog.logrocket.com/why-keep-faith-react-native/" rel="noopener noreferrer"&gt;LogRocket&lt;/a&gt; to learn more.&lt;/p&gt;

&lt;p&gt;Beyond React Native, we did have a look at other contenders in the cross-platform space for native apps, namely Flutter and NativeScript, but, without disregarding their potential, both did not meet our criteria. Had we chosen to use Flutter, we would have to learn a new programming language, Dart, for core development and we determined such investment was not worth for us, at least for the time being. Spending time to learn, master and keep up with React Native, Android and iOS ecosystems was and still is enough of a challenge of its own. Thus, we put Flutter aside.&lt;/p&gt;

&lt;p&gt;NativeScript, on the other hand, could have been a more interesting candidate as native APIs can be accessed from JavaScript seamlessly. Unlike React Native, where we have to write code in three different languages to bridge the JavaScript and the native realms, writing code in one language is a major upside from productivity and maintenance standpoints. Unfortunately, NativeScript lacked React support and still does to this day (only Angular and Vue are supported). React has been our library of choice for quite a while now, in which we heavily invested our team to consolidate its expertise; for this reason alone we discarded NativeScript as well, as it would not be convenient to switch to another stack.&lt;/p&gt;

&lt;h1&gt;
  
  
  React Native CLI vs. Expo
&lt;/h1&gt;

&lt;p&gt;Upon settling on React Native, our next task, most recently, was to evaluate and assess existing toolkits and frameworks that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allowed us to easily kickstart new apps.&lt;/li&gt;
&lt;li&gt;Offered APIs and tools out-of-the box to speed up development and delivery.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was essential as in our first React Native projects we spent a lot of time (and money) over and over again to setup the basics before starting the actual development. We had to put an end to this approach and seek a more efficient and effective solution.&lt;/p&gt;

&lt;p&gt;In our hunt, the &lt;a href="https://expo.io/" rel="noopener noreferrer"&gt;Expo&lt;/a&gt; project caught our eye. Expo is open-source, free and one of the most complete solutions we found as it offers a SDK with dozens of APIs, a CLI which builds production-ready iOS and Android binaries and deploys them to the app stores, and &lt;a href="https://expo.io/features" rel="noopener noreferrer"&gt;much more&lt;/a&gt;. To build apps with Expo, developers have two  &lt;a href="https://docs.expo.io/introduction/managed-vs-bare/" rel="noopener noreferrer"&gt;workflows&lt;/a&gt; at their disposal: &lt;em&gt;managed&lt;/em&gt;  and  &lt;em&gt;bare&lt;/em&gt;. However, from our experience, all the apps we developed required us to have complete control over the native projects and we anticipate this scenario is not likely to change in the near future, so the managed approach does not work for us. Regardless, it was important for us to understand the several &lt;a href="https://docs.expo.io/introduction/why-not-expo/" rel="noopener noreferrer"&gt;limitations&lt;/a&gt; of managed projects and lost benefits in bare projects, the most critical to us being listed below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The build service provided by the Expo CLI is not yet available to bare projects which, in our opinion, is a huge downside and the biggest. Building and deploying iOS and Android apps automatically to the app stores requires knowledge of how app signing works, native development toolchains and APIs or even third-party tools, such as  &lt;a href="https://fastlane.tools/" rel="noopener noreferrer"&gt;Fastlane&lt;/a&gt;. In managed projects, that process is simplified by hiding away all the complexity involved in the process.&lt;/li&gt;
&lt;li&gt;There are many native APIs yet to be supported in the managed workflow.&lt;/li&gt;
&lt;li&gt;In the managed workflow, Expo bundles APIs and dependencies we may not even use which leads to an increase of the app binary’s size.&lt;/li&gt;
&lt;li&gt;Third-party modules which require native access can only be used in the bare workflow.&lt;/li&gt;
&lt;li&gt;If we want to use a push notification service other than Expo’s, it can only be done in the bare workflow.&lt;/li&gt;
&lt;li&gt;In the bare workflow, common configurations such as setting up a splash screen or app icons are not so straightforward. It is necessary to perform configurations in the native projects of each platform and use native tooling such Xcode’s Layout Editor, Android’s Image Asset Studio, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One last aspect worth noting about the managed workflow is that each version of the Expo SDK is &lt;a href="https://docs.expo.io/versions/latest/#each-expo-sdk-version-depends-on-a" rel="noopener noreferrer"&gt;tightly&lt;/a&gt; &lt;a href="https://github.com/expo/fyi/blob/master/react-native-releases.md" rel="noopener noreferrer"&gt;coupled&lt;/a&gt; to a specific React Native version and is subject to a time-based release cycle. This can be problematic for three reasons. First, to ensure compatibility and stability, React Native can’t be updated before Expo itself is and, as a result, we might miss on the latest fixes and new features in between. Second, if we’re tied to a React Native version we might not be able to support the latest Android or iOS major versions if an upgrade is required. Third and last, as each new version of the SDK is released on a quarterly timeframe, we might have to wait a while for bug fixes to be addressed. If there are delays during this process, things might get complicated.&lt;/p&gt;

&lt;p&gt;To change things for the better, the Expo team &lt;a href="https://blog.expo.io/expokit-2019-1e5cb02106f8" rel="noopener noreferrer"&gt;humbly took one step back&lt;/a&gt; and has been taking several measures gradually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Last year, &lt;a href="https://blog.expo.io/you-can-now-use-expo-apis-in-any-react-native-app-7c3a93041331" rel="noopener noreferrer"&gt;introduced&lt;/a&gt; Unimodules which allows us to selectively import modules from the Expo SDKs in any React Native app, be it a bare Expo project or not! This outstanding addition results from a change of direction driven by developer feedback and the long-term  &lt;a href="https://blog.expo.io/expokit-2019-1e5cb02106f8" rel="noopener noreferrer"&gt;commitment&lt;/a&gt;  made by the Expo team to unify the development experience across both workflows.&lt;/li&gt;
&lt;li&gt;Building upon the above, the &lt;a href="https://blog.expo.io/the-expo-sdk-39-roadmap-36bf5137e8db#f95e" rel="noopener noreferrer"&gt;roadmap&lt;/a&gt; for &lt;a href="https://github.com/expo/fyi/blob/master/managed-app-size.md#what-we-are-doing-right-now-to-make-this-better-in-the-future" rel="noopener noreferrer"&gt;2020&lt;/a&gt; looks promising as it plans to address many of the pressing pain points we outlined here towards the end of the year.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The ideal workflow for us would be the possibility to enjoy the perks offered by the managed workflow combined with those offered by the bare one. In light of the current situation, as we weighed in the pros and cons, we concluded we wouldn’t gain much from using the bare workflow. We eventually decided to remove Expo from the equation for the time being and spin up a barebones React Native project enhanced with foundational features, popular libraries, tooling and conventions. To that end, we created a skeleton app with React Native’s CLI, which is more or less equivalent to an &lt;em&gt;ejected&lt;/em&gt; Expo project but without web support (which we don’t need).&lt;/p&gt;

&lt;p&gt;We like to keep our options open and, as such, we’re not shutting the door on Expo permanently. On the contrary, judging by the trajectory the project is being taken, there’s a high likelihood of us embracing it sometime in the future. We’ll be closely monitoring how things roll out in the coming months.&lt;/p&gt;

&lt;h1&gt;
  
  
  A new boilerplate emerges
&lt;/h1&gt;

&lt;p&gt;As a company that advocates for open-source, our vision was to design a boilerplate that would serve our own needs but, at the same time, could be consumed by the open-source community and leverage its efforts.&lt;/p&gt;

&lt;p&gt;Enter React Native with MOXY.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/moxystudio/react-native-with-moxy" rel="noopener noreferrer"&gt;moxystudio/react-native-with-moxy&lt;/a&gt;&lt;br&gt;
&lt;em&gt;MOXY's boilerplate to accelerate the setup of new React Native based mobile applications.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Following the rationale and principles behind our &lt;a href="https://medium.com/moxystudio/next-js-with-moxy-9a9f772662b" rel="noopener noreferrer"&gt;boilerplate for web projects&lt;/a&gt;, there are a few things included by default but some of them can be easily removed, adapted or even ignored as it is not our intention to lock anyone in. Developers are free to use as little or as much features as they like.&lt;/p&gt;

&lt;p&gt;Below you can find the base feature set included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Internationalization&lt;/strong&gt;  (i18n): Multi-language support is added from the start, even if the project doesn’t initially require it. Powered by &lt;a href="https://formatjs.io/docs/react-intl/" rel="noopener noreferrer"&gt;React Intl&lt;/a&gt; and &lt;code&gt;[@react-native-community/react-native-localize](https://github.com/react-native-community/react-native-localize)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility&lt;/strong&gt;  (a11y): Automatic checks are in place to enforce good practices and correctness on accessibility.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code linting&lt;/strong&gt;: Usage of &lt;a href="https://eslint.org/" rel="noopener noreferrer"&gt;ESLint&lt;/a&gt; to ensure code is consistent across the codebase.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unit testing&lt;/strong&gt;: Automated tests to validate correctness and to provide confidence upon code changes with &lt;a href="https://jestjs.io/" rel="noopener noreferrer"&gt;Jest&lt;/a&gt; and &lt;a href="https://github.com/testing-library/native-testing-library" rel="noopener noreferrer"&gt;Native Testing Library&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Streamlined&lt;/strong&gt;  &lt;strong&gt;SVG support:&lt;/strong&gt;  Import your SVG files just like any other module and use them as a React component. Powered by &lt;code&gt;[@react-native-community/react-native-svg](https://github.com/react-native-community/react-native-svg)&lt;/code&gt;  and &lt;code&gt;[react-native-svg-transformer](https://github.com/kristerkari/react-native-svg-transformer)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sane and scalable directory layout:&lt;/strong&gt;  Guidelines optimized for clear organization and separation of concerns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Screen navigator:&lt;/strong&gt;  Straightforward, JavaScript-based solution to manage of your app’s routes and screen transitions with &lt;a href="https://reactnavigation.org/" rel="noopener noreferrer"&gt;React Navigation v5&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment variables:&lt;/strong&gt;  Twelve-factor your app’s config with  &lt;code&gt;.env&lt;/code&gt;  files and access your variables from both JavaScript and native realms. Enabled by &lt;code&gt;[react-native-config](https://github.com/luggit/react-native-config)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Splash screen:&lt;/strong&gt;  Provide your user’s a pleasant startup experience by displaying a welcome screen while JavaScript is loading or asynchronous operations run to completion. Powered by &lt;code&gt;[react-native-bootsplash](https://github.com/zoontek/react-native-bootsplash)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Changelog generation:&lt;/strong&gt;  A changelog file adhering to the &lt;a href="https://www.conventionalcommits.org/" rel="noopener noreferrer"&gt;Conventional Commits specification&lt;/a&gt; is automatically generated and kept up to date on each release.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation&lt;/strong&gt;: A webpage with key documentation, including instructions on how to setup a new app.&lt;/li&gt;
&lt;/ul&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fg6u7usmpwkqug05zaxfl.png" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fg6u7usmpwkqug05zaxfl.png" alt="Documentation for React Native with MOXY"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Documentation for React Native with MOXY.&lt;/p&gt;

&lt;p&gt;We have baked in all these features and best practices into our boilerplate and many more are planned to come. Moreover, we have an optional set of recipes that can be followed to progressively add other features. One of such recipes is a walkthrough on how to integrate  &lt;a href="https://react-native-with.moxy.tech/docs/recipes/redux" rel="noopener noreferrer"&gt;Redux&lt;/a&gt;, a popular global state manager.&lt;/p&gt;

&lt;h1&gt;
  
  
  What’s next?
&lt;/h1&gt;

&lt;p&gt;Our endeavor is still in its infancy but there is so much more in store! Here’s a quick peek of what’s on the short-term roadmap:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Error tracking &amp;amp; monitoring:&lt;/strong&gt;  Explore the market of error logging solutions such as BugSnag, Sentry and Firebase Crashlytics and develop integrations for a select few in the form of an abstraction layer to enable us to easily switch between implementations. Unhandled native and JS errors will be reported automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytics:&lt;/strong&gt;  Explore the market of solutions to measure and analyze user behaviors by keeping track of custom events, such as Firebase Analytics. We’re planning to integrate one such solution in the boilerplate by default and create a set of instructions on how to configure it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handle crashes gracefully&lt;/strong&gt;: Users are never happy when an app crashes unexpectedly and closes abruptly without any feedback. In order to deliver a more professional experience, we have to intercept native and JS errors and display a proper screen to inform something went wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update to React Native 0.63:&lt;/strong&gt;  The &lt;a href="https://reactnative.dev/blog/2020/07/06/version-0.63" rel="noopener noreferrer"&gt;latest version&lt;/a&gt; of React Native has been around for about one month now so it’s time to upgrade from 0.61.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enable&lt;/strong&gt; &lt;a href="https://fbflipper.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;Flipper&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;debugger integration:&lt;/strong&gt;  Flipper is now &lt;a href="https://reactnative.dev/blog/2020/03/26/version-0.62" rel="noopener noreferrer"&gt;enabled by default&lt;/a&gt; on React Native 0.62 and onwards. &lt;a href="https://github.com/jhen0409/react-native-debugger" rel="noopener noreferrer"&gt;React Native Debugger&lt;/a&gt; is a great project has been serving us well, but Flipper offers a much superior user interface and developer experience. Furthermore, Flipper is extensible via its plugin API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;iOS and Android versioning strategy:&lt;/strong&gt;  We have been exploring industry practices on how to handle the versioning of Android and iOS apps at scale and how it can be fit together with our Git workflows. Inspired by such practices, we will design and document our approach and employ it in the release management process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic deployment:&lt;/strong&gt;  Design a CI/CD pipeline in GitHub Actions to test, build and deliver iOS and Android apps to TestFlight and Google Play, respectively. We’re looking into using Fastlane to achieve this. We will provide detailed documentation on how to setup everything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add support for Expo’s Unimodules:&lt;/strong&gt;  Thanks to the efforts of the Expo team, we can leverage &lt;code&gt;[react-native-unimodules](https://docs.expo.io/bare/installing-unimodules)&lt;/code&gt; infrastructure to cherry-pick SDK modules as we go instead of bringing in the whole thing and seamlessly integrate each one in the boilerplate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stay tuned! 💪&lt;/p&gt;

&lt;p&gt;Meanwhile, you may visit the project’s website at &lt;a href="https://react-native-with.moxy.tech/" rel="noopener noreferrer"&gt;https://react-native-with.moxy.tech/&lt;/a&gt;. Feel free to use it, give feedback and contribute! 🙏&lt;/p&gt;

&lt;h1&gt;
  
  
  Wrapping up
&lt;/h1&gt;

&lt;p&gt;With React Native with MOXY, our team has an efficient way to kickstart apps that meet our business offerings and clients’ requirements.&lt;/p&gt;

&lt;p&gt;Now, the developer experience is consistent across projects and our engineers are able to onboard new or ongoing projects with minimal friction. We’re now able to iterate and ship faster with a higher degree of polishing, two things highly appreciated by our clients.&lt;/p&gt;

&lt;p&gt;Check out the most recent app we built with React Native with MOXY:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.tridonic.com/com/en/products/companionsuite-4service-nfc-app.asp" rel="noopener noreferrer"&gt;&lt;strong&gt;4service NFC&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Enables quick and easy configuration and analysis of Tridonic’s LED drivers.&lt;/p&gt;
&lt;/blockquote&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmh1xdmnswbyz4mrrkbnh.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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmh1xdmnswbyz4mrrkbnh.jpeg" alt="4service NFC app"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;At MOXY, we build websites and applications that our customers can feel proud of, instead of being embarrassed and frustrated. Our Engineered Design process helps our customers have a deeper understanding of their challenges, and provides a clear path for solving them through careful design and implementation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Looking for help with a project?&lt;/strong&gt; &lt;a href="https://moxy.studio/contacts" rel="noopener noreferrer"&gt;&lt;strong&gt;Tell us a bit more&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by&lt;/em&gt; &lt;a href="https://dev.to/acostalima"&gt;André Costa Lima&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>android</category>
      <category>ios</category>
      <category>mobileappdevelopment</category>
    </item>
  </channel>
</rss>
