<?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: Vincent</title>
    <description>The latest articles on DEV Community by Vincent (@vincentdesmares).</description>
    <link>https://dev.to/vincentdesmares</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%2F585350%2F8bf5f732-cc73-41aa-bb2b-2bd19d15664c.jpeg</url>
      <title>DEV Community: Vincent</title>
      <link>https://dev.to/vincentdesmares</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vincentdesmares"/>
    <language>en</language>
    <item>
      <title>Quickly create a POC/MVP with GraphQL and NodeJS!</title>
      <dc:creator>Vincent</dc:creator>
      <pubDate>Wed, 24 Feb 2021 08:38:18 +0000</pubDate>
      <link>https://dev.to/vincentdesmares/quickly-create-a-poc-mvp-with-graphql-and-nodejs-361o</link>
      <guid>https://dev.to/vincentdesmares/quickly-create-a-poc-mvp-with-graphql-and-nodejs-361o</guid>
      <description>&lt;p&gt;Discover graphql-sequelize-generator and the magic of schema-generated GraphQL!&lt;/p&gt;

&lt;h2&gt;
  
  
  Tldr;
&lt;/h2&gt;

&lt;p&gt;Graphql-sequelize-generator is a library that will help you to quickly setup a Node.js POC/MVP with &lt;a href="https://github.com/sequelize/sequelize"&gt;Sequelize&lt;/a&gt; and GraphQL.&lt;/p&gt;

&lt;h1&gt;
  
  
  We want a POC, and we want it now!
&lt;/h1&gt;

&lt;p&gt;When we started to work on Teamstarter we wanted to quickly test it on our user base and see if the concept worked. We needed a very simple implementation of the core of the concept, a private crowdfunding platform for organizations, a &lt;a href="https://en.wikipedia.org/wiki/Proof_of_concept"&gt;proof of concept&lt;/a&gt; (POC).&lt;/p&gt;

&lt;p&gt;Usually, when I do a small POC of a random idea, most of the time it ends up as a dead repository on my Github after a few weeks, like an ECS based on redux or a procedural generation library based on Postgis. Many ideas, low energy: Motivation is bitch 😩.&lt;/p&gt;

&lt;p&gt;I learned through a painful experience that the &lt;em&gt;quicker I produce a POC, bigger is the chance I kept some motivation&lt;/em&gt; to iterate on it and make something of it at the end.&lt;/p&gt;

&lt;p&gt;But being fast is sometimes not enough. From times to times, I get super motivated after reading a tweet or an article and search for an old repository to get it back on his foot. Sadly, most of the times &lt;em&gt;my “fast and ugly" code prevent me to do so&lt;/em&gt; by being &lt;em&gt;impossible to understand!&lt;/em&gt; 🤬😭.&lt;/p&gt;

&lt;p&gt;To sum up, in my experience, a useful POC is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🏃🏾‍♀️ Created quickly&lt;/li&gt;
&lt;li&gt;📚 Simple to iterate on&lt;/li&gt;
&lt;li&gt;👀 Easy to understand and pick up after having forgotten about it&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Is GraphQL a good fit for Proof of concepts?
&lt;/h1&gt;

&lt;p&gt;GraphQL is amazing for many reasons (&lt;a href="https://www.youtube.com/watch?v=zVNrqo9XGOs"&gt;here&lt;/a&gt;, &lt;a href="https://www.robinwieruch.de/why-graphql-advantages-disadvantages-alternatives"&gt;here&lt;/a&gt; and &lt;a href="https://programmingwithmosh.com/backend/why-should-i-pick-graphql/"&gt;here&lt;/a&gt;) and is a top choice for efficient API development nowadays.&lt;br&gt;
Yet, even if it might generate &lt;em&gt;a nice and easily understandable API&lt;/em&gt;, it is &lt;em&gt;most of the time painfully slow to setup&lt;/em&gt; and extend compared to REST 🥵.&lt;/p&gt;

&lt;p&gt;The setup is slow because you have to spend time describing your schema field by field, while there is a huge chance you already did it in your ORM.&lt;/p&gt;

&lt;p&gt;The addition of new endpoint is slow too as GraphQL only describe what a resolver(link) is and not basic methods to fetch the data in your database.&lt;/p&gt;

&lt;p&gt;After a few painful POCs we decided to work on tools that could help on the two last points, setup and extendability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KkwRpT3B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lu5kqx7morl9ywb5jppt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KkwRpT3B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lu5kqx7morl9ywb5jppt.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  What is GSG?
&lt;/h1&gt;

&lt;p&gt;From those problems we created &lt;a href="https://github.com/teamstarter/graphql-sequelize-generator"&gt;graphql-sequelize-generator&lt;/a&gt; 🎉&lt;br&gt;
&lt;em&gt;The setup is way faster by using the definition of the ORM (Sequelize) to generate procedurally the endpoints.&lt;/em&gt; We do not generate a full schema by default, it’s up to you to decide what do you want to expose. But it only takes 3 lines of code!&lt;/p&gt;

&lt;p&gt;The extendability is solved by using graphql-sequelize and custom made create/update/delete mutations.&lt;br&gt;
&lt;em&gt;We also provide a lot of hooks and advanced options that you can discover in &lt;a href="https://dev.tothe%20documentation"&gt;the documentation&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Get started in 2 minutes
&lt;/h1&gt;

&lt;p&gt;We made 2 boilerplates: In &lt;a href="https://github.com/teamstarter/gsg-boilerplate"&gt;javascript&lt;/a&gt; and &lt;a href="https://github.com/teamstarter/gsg-boilerplate-typescript"&gt;Typescript&lt;/a&gt; to quickly create a create-react-app application backed by NodeJS and Express.&lt;/p&gt;

&lt;p&gt;For both we tried to reduce the setup to a bare minimum:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone git@github.com:teamstarter/gsg-boilerplate.git; cd gsg-boilerplate
$ nvm use
$ yarn
$ yarn db-reset
$ yarn dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you’re good to go!&lt;/p&gt;

&lt;h1&gt;
  
  
  What’s next? What about the MVPs?
&lt;/h1&gt;

&lt;p&gt;We did not intend to develop something that could do more than a POC as deeply nested queries tends to end in a huge amount of database queries.&lt;/p&gt;

&lt;p&gt;But surprisingly, thanks to our configuration of grapghl-dataloader your POC can become an MVP without any problem! 🥳 By hooking on Sequelize query hooks and batching the intercepted requests, the query count is kept to an acceptable level.&lt;/p&gt;

&lt;p&gt;To make is easier to understand you will find below a small visualisation of the problem and the solution ✍️&lt;/p&gt;

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

&lt;p&gt;We are currently using it in production with a Postgres AWS medium database, with more than 20000 active users per month and have no performances problems! 🚀&lt;br&gt;
Also, due to its minimal code footprint the maintenance is really easy and simple 😊&lt;/p&gt;

&lt;h2&gt;
  
  
  Thanks for reading!
&lt;/h2&gt;

&lt;p&gt;We are using GSG every day and we hope that some of your next ideas will avoid the Github graveyard of the forgotten projects! 🙏&lt;/p&gt;

&lt;p&gt;If you have any problem with the lib or the boilerplates, do not hesitate to open an issue on Github or submit a PR!&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;If you want to discover GraphQL :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zero To GraphQL In 30 Minutes &lt;a href="https://www.youtube.com/watch?v=H8YnVk2vhzg"&gt;https://www.youtube.com/watch?v=H8YnVk2vhzg&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A recent white paper on &lt;a href="https://export.arxiv.org/pdf/2003.04761.pdf"&gt;how using Graphql could be faster than Rest&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A few slides on how GraphQL is &lt;a href="https://vincentdesmares.github.io/talk-startups-and-graphql-benefits-and-drawbacks/#/0"&gt;a good fit for a startup&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More about GraphQL-Sequelize-Generator&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://teamstarter.github.io/gsg-documentation/gettingStarted"&gt;https://teamstarter.github.io/gsg-documentation/gettingStarted&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/teamstarter/graphql-sequelize-generator"&gt;https://github.com/teamstarter/graphql-sequelize-generator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  We're hiring
&lt;/h2&gt;

&lt;p&gt;You are a junior dev able to work in Paris quickly? &lt;a href="https://www.welcometothejungle.com/fr/companies/teamstarter/jobs/developpeur-fullstack-nodejs-react-h-f_paris"&gt;Reach us!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>node</category>
    </item>
  </channel>
</rss>
