<?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: rike</title>
    <description>The latest articles on DEV Community by rike (@rike).</description>
    <link>https://dev.to/rike</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%2F815516%2F0909eb8d-d61a-452a-85a8-ea4d4df9e61e.png</url>
      <title>DEV Community: rike</title>
      <link>https://dev.to/rike</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rike"/>
    <language>en</language>
    <item>
      <title>A Beginner's Guide to Smart Contracts: Exploring the Simple Storage Contract on Ethereum in 2023</title>
      <dc:creator>rike</dc:creator>
      <pubDate>Sat, 18 Mar 2023 17:52:19 +0000</pubDate>
      <link>https://dev.to/rike/a-beginners-guide-to-smart-contracts-exploring-the-simple-storage-contract-on-ethereum-in-2023-21m0</link>
      <guid>https://dev.to/rike/a-beginners-guide-to-smart-contracts-exploring-the-simple-storage-contract-on-ethereum-in-2023-21m0</guid>
      <description>&lt;p&gt;&lt;em&gt;Dive into the world of Solidity and smart contracts with this beginner-friendly tutorial.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Ethereum has taken the world by storm, revolutionizing the way we interact with decentralized applications and giving birth to the concept of smart contracts. You might be eager to dive into the world of smart contract development, but contracts can be wildly complex. Taking a step back, I want to focus on dialing simple smart contracts to get familiar with syntax.  This article will guide you to writing a simple storage contract that demonstrates how to store and retrieve data on the Ethereum blockchain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;note: this smart contract does nothing of value lol&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing the Simple Storage Contract
&lt;/h2&gt;

&lt;p&gt;A Simple Storage contract is a basic Solidity contract that showcases the fundamentals of smart contracts by storing a value on the Ethereum blockchain and allowing users to retrieve it. This tutorial is perfect for those who are new to Ethereum development or looking to solidify their understanding of smart contracts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building the Simple Storage Contract
&lt;/h2&gt;

&lt;p&gt;Let's start by breaking down the Simple Storage contract code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;SimpleStorage&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;uint256&lt;/span&gt; &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="n"&gt;storedData&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint256&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;storedData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;view&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint256&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;storedData&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we've defined a contract named &lt;code&gt;SimpleStorage&lt;/code&gt; with a state variable &lt;code&gt;storedData&lt;/code&gt; to hold a &lt;code&gt;uint256&lt;/code&gt; value. The contract has two functions, &lt;code&gt;set&lt;/code&gt; and &lt;code&gt;get&lt;/code&gt;, which allow users to store and retrieve the value, respectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying and Interacting with the Simple Storage Contract
&lt;/h2&gt;

&lt;p&gt;To deploy and interact with the Simple Storage contract, I recommend using the Remix IDE, an online development environment for Ethereum smart contracts, but in the future I'll introduce you to deploying and testing locally!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Visit &lt;a href="https://remix.ethereum.org/"&gt;Remix IDE&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Create a new file named "SimpleStorage.sol" and paste the contract code.&lt;/li&gt;
&lt;li&gt;Compile the contract by navigating to the "Solidity Compiler" tab in the left panel and clicking "Compile SimpleStorage.sol."&lt;/li&gt;
&lt;li&gt;Switch to the "Deploy &amp;amp; Run Transactions" tab.&lt;/li&gt;
&lt;li&gt;Select the "Injected Web3" environment to connect Remix to your MetaMask wallet.&lt;/li&gt;
&lt;li&gt;Click "Deploy" to deploy the contract, and confirm the transaction in MetaMask.&lt;/li&gt;
&lt;li&gt;Once deployed, the contract will appear under "Deployed Contracts," and you can interact with the &lt;code&gt;set&lt;/code&gt; and &lt;code&gt;get&lt;/code&gt; functions.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Next Steps in Your Web3 Journey
&lt;/h2&gt;

&lt;p&gt;Congratulations on creating, deploying, and interacting with a simple storage contract on the Ethereum blockchain! This foundational knowledge will serve as a stepping stone for more complex smart contract development and interactions.&lt;/p&gt;

&lt;p&gt;As you continue your journey as a Web3 developer, explore more advanced contract functionality and experiment with different use cases. With a vast world of decentralized applications waiting to be built, the possibilities are endless. Keep learning, experimenting, and growing your skills, and soon you'll be creating your own innovative smart contracts and decentralized applications. Good luck, and happy coding!&lt;/p&gt;

</description>
      <category>smartcontract</category>
      <category>ethereum</category>
      <category>ethers</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Building a Full-Stack App With t3 [2023]</title>
      <dc:creator>rike</dc:creator>
      <pubDate>Mon, 09 Jan 2023 01:32:40 +0000</pubDate>
      <link>https://dev.to/rike/building-a-full-stack-app-with-t3-2023-2of5</link>
      <guid>https://dev.to/rike/building-a-full-stack-app-with-t3-2023-2of5</guid>
      <description>&lt;p&gt;Hi everyone! Recently I was recommended to look into full-stack t3 to bootstrap my next project. I've already been exposed to most of these tech individually but I figured it'd be good practice to stay fresh with what's trending. &lt;/p&gt;

&lt;p&gt;I decided to dive in and create a sample project by following some tutorials on dev.to only to notice that some tutorials created within the past year are already outdated. &lt;/p&gt;

&lt;p&gt;So let's get start the new year right and create a full-stack blog where this article can live.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;The t3 docs provide us npm, yarn, and pnpm installations, it doesn't matter which one you use but I'll be using &lt;code&gt;yarn create t3-app&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;titled: blog&lt;/li&gt;
&lt;li&gt;TypeScript&lt;/li&gt;
&lt;li&gt;nextAuth, prisma, tailwind, trpc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk29js90i1mbccas31qfz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk29js90i1mbccas31qfz.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We're given the next steps: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;cd blog&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;yarn prisma db push&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;yarn dev&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;but wait!&lt;/strong&gt; I plan on creating this project using postgresql, so I will be changing some settings first. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;change the provider to &lt;code&gt;postgresql&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;uncomment db.Text where listed (3 sections for next Auth)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// prisma/schema.prisma&lt;/span&gt;

&lt;span class="nx"&gt;datasource&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;postgresql&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="c1"&gt;// NOTE: When using postgresql, mysql or sqlserver, uncomment the @db.Text annotations in model Account below&lt;/span&gt;
    &lt;span class="c1"&gt;// Further reading:&lt;/span&gt;
    &lt;span class="c1"&gt;// https://next-auth.js.org/adapters/prisma#create-the-prisma-schema&lt;/span&gt;
    &lt;span class="c1"&gt;// https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string&lt;/span&gt;
    &lt;span class="nx"&gt;url&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DATABASE_URL&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;model&lt;/span&gt; &lt;span class="nx"&gt;Example&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;id&lt;/span&gt;        &lt;span class="nb"&gt;String&lt;/span&gt;   &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;id&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cuid&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="nx"&gt;createdAt&lt;/span&gt; &lt;span class="nx"&gt;DateTime&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="nx"&gt;updatedAt&lt;/span&gt; &lt;span class="nx"&gt;DateTime&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;updatedAt&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Necessary for Next auth&lt;/span&gt;
&lt;span class="nx"&gt;model&lt;/span&gt; &lt;span class="nx"&gt;Account&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;id&lt;/span&gt;                &lt;span class="nb"&gt;String&lt;/span&gt;  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;id&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cuid&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="nx"&gt;userId&lt;/span&gt;            &lt;span class="nb"&gt;String&lt;/span&gt;
    &lt;span class="nx"&gt;type&lt;/span&gt;              &lt;span class="nb"&gt;String&lt;/span&gt;
    &lt;span class="nx"&gt;provider&lt;/span&gt;          &lt;span class="nb"&gt;String&lt;/span&gt;
    &lt;span class="nx"&gt;providerAccountId&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;
    &lt;span class="nx"&gt;refresh_token&lt;/span&gt;     &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Text&lt;/span&gt;
    &lt;span class="nx"&gt;access_token&lt;/span&gt;      &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Text&lt;/span&gt;
    &lt;span class="nx"&gt;expires_at&lt;/span&gt;        &lt;span class="nx"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
    &lt;span class="nx"&gt;token_type&lt;/span&gt;        &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
    &lt;span class="nx"&gt;scope&lt;/span&gt;             &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
    &lt;span class="nx"&gt;id_token&lt;/span&gt;          &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Text&lt;/span&gt;
    &lt;span class="nx"&gt;session_state&lt;/span&gt;     &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
    &lt;span class="nx"&gt;user&lt;/span&gt;              &lt;span class="nx"&gt;User&lt;/span&gt;    &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;relation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;references&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;onDelete&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Cascade&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="p"&gt;@@&lt;/span&gt;&lt;span class="nd"&gt;unique&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;providerAccountId&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we want to determine whether we want to work on a local database or create one on something like Railway.&lt;/p&gt;

&lt;p&gt;For the sake of developing locally - I'll be creating a local db until it's time for deployment (Railway creation will be included at the bottom). &lt;/p&gt;

&lt;p&gt;The final step before we run &lt;code&gt;yarn prisma db push&lt;/code&gt; is to change our .env &lt;code&gt;DATABASE_URL=&lt;/code&gt; to our local postgres database.&lt;br&gt;
&lt;code&gt;DATABASE_URL=postgres://[USER]:[PASSWORD]@localhost:5432/blog&lt;/code&gt;&lt;br&gt;
(I created a database titled blog)&lt;/p&gt;

&lt;p&gt;Now we can finally run &lt;code&gt;yarn prisma db push&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furcym1sqfw40xw8t14lu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furcym1sqfw40xw8t14lu.png" alt="Image description" width="593" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Okay, that seemed like a lot, but there's a few more things we need to set up before we're able to get to the good stuff!&lt;/p&gt;

&lt;p&gt;I'm not sure when Discord became the standard for auth - but it seems like the default for NextAuth - and we'll be sticking to it for this tutorial. &lt;/p&gt;

&lt;p&gt;Navigate to &lt;a href="https://discord.com/developers/applications" rel="noopener noreferrer"&gt;Discord Developer Portal&lt;/a&gt; and create a new application. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgadnprk4hd854p4vraxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgadnprk4hd854p4vraxg.png" alt="Image description" width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Navigate to the newly created application and click OAuth2 on the left tab&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1bcgkejq3n4dko70oism.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1bcgkejq3n4dko70oism.png" alt="Image description" width="800" height="141"&gt;&lt;/a&gt;&lt;br&gt;
copy the Client Id and Client Secret (click on reset secret to show the secret key) into our .env &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq4iap9dfzyg38q5yk4qc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq4iap9dfzyg38q5yk4qc.png" alt="Image description" width="717" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4t84m7pzlygfqytnmq6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4t84m7pzlygfqytnmq6.png" alt="Image description" width="575" height="68"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the redirect link as so - this is to let Discord know where the login requests are coming from&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzwpwmx7ebqoahkejr9d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzwpwmx7ebqoahkejr9d.png" alt="Image description" width="696" height="206"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lastly, we'll need to set NEXT_AUTH_SECRET to a random string (I just followed the openssl command provided in the .env file).&lt;/p&gt;

&lt;p&gt;Alright, we're good to start coding now! 😅&lt;/p&gt;


&lt;h2&gt;
  
  
  Database Setup
&lt;/h2&gt;

&lt;p&gt;One of the tech I really wanted to get experience with was Prisma, so I wanted to approach this in the most thorough way possible. &lt;/p&gt;

&lt;p&gt;First thing I did was remove the example entry and include a Post entry for a blog &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67be0d2ro9jokm8ugttb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67be0d2ro9jokm8ugttb.png" alt="Image description" width="378" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For a blog post - the only thing I'll really need are the body and title, but we'll need to create a one-to-many relation where a user can have many posts&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0km8zymlugkwcaqduj41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0km8zymlugkwcaqduj41.png" alt="Image description" width="800" height="145"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We'll run &lt;code&gt;npx prisma migrate dev --name removeExampleAddPostField&lt;/code&gt; in order to create the migration file and apply it to our database. &lt;/p&gt;
&lt;h2&gt;
  
  
  Frontend
&lt;/h2&gt;

&lt;p&gt;The goal is to get a full-stack application working, not make it look beatiful, so I'm just going to focus on getting the app up and running. &lt;/p&gt;

&lt;p&gt;Let's get the application started by running &lt;code&gt;yarn dev&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I deleted the excess from /index.tsx and added some login tools
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;NextPage&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;signIn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signOut&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useSession&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next-auth/react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;NextPage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;session&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useSession&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;flex justify-center pt-10&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-xl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Rikes&lt;/span&gt; &lt;span class="nx"&gt;Blog&lt;/span&gt; &lt;span class="nx"&gt;Powered&lt;/span&gt; &lt;span class="nx"&gt;by&lt;/span&gt; &lt;span class="nx"&gt;t3&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;flex justify-end pr-10&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;session&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;signOut&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nx"&gt;Log&lt;/span&gt; &lt;span class="nx"&gt;Out&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;signIn&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Login&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;Discord&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="p"&gt;)}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/main&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now navigate to &lt;a href="http://localhost:3000/" rel="noopener noreferrer"&gt;http://localhost:3000/&lt;/a&gt; and check out our amazing website - go ahead and give it a shot and you should be able to login 😏&lt;/p&gt;

&lt;p&gt;If you want to see what the backend is doing - navigate to your terminal (make sure you're in your project directory) and in a new window enter &lt;code&gt;npx prisma studio&lt;/code&gt;. Click on user and you should be able to see your newly created account!&lt;/p&gt;
&lt;h2&gt;
  
  
  Routes
&lt;/h2&gt;

&lt;p&gt;Now that our frontend is working and we're able to login, let's start working with some route creation. For some basic CRUD operations, we need to be able to get all posts and create posts, so two major routes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new file called 'Post.ts' under the routers folder &lt;code&gt;/server/api/routers/Post.ts&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create an initial getAll function
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createTRPCRouter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;publicProcedure&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../trpc&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;postRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createTRPCRouter&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;publicProcedure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findMany&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Create a newPost function
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zod&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createTRPCRouter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;protectedProcedure&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;publicProcedure&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../trpc&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;postRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createTRPCRouter&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;publicProcedure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findMany&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;

  &lt;span class="na"&gt;newPost&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;protectedProcedure&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mutation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
          &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Note: we use zod as a validator so our data is clean :)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to root.ts &lt;code&gt;server/api/root.ts&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createTRPCRouter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./trpc&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;postRouter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./routers/Post&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * This is the primary router for your server.
 *
 * All routers added in /api/routers should be manually added here
 */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;appRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createTRPCRouter&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;post&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;postRouter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// export type definition of API&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;AppRouter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;appRouter&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And voila, we've created functions to get all posts and create new posts! Time to plug them in. &lt;/p&gt;

&lt;p&gt;Let's create some React components so that we're able to store and create new posts. Here's the simple way I did it to handle a text area, title input and submit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;NextPage&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;signIn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signOut&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useSession&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next-auth/react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;api&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../utils/api&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;NextPage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;session&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useSession&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;flex justify-center pt-10&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-xl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Rikes&lt;/span&gt; &lt;span class="nx"&gt;Blog&lt;/span&gt; &lt;span class="nx"&gt;Powered&lt;/span&gt; &lt;span class="nx"&gt;by&lt;/span&gt; &lt;span class="nx"&gt;t3&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;flex justify-end pr-10&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;session&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;signOut&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nx"&gt;Log&lt;/span&gt; &lt;span class="nx"&gt;Out&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;signIn&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Login&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;Discord&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="p"&gt;)}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Blog&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;session&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Entry&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Please&lt;/span&gt; &lt;span class="nx"&gt;Login&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;make&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;entry&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;)}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/main&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Blog&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;NextPage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;blogPosts&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;useQuery&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;p-20&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;blogPosts&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;indx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rounded-lg border p-10&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;indx&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;flex justify-center pb-10 font-bold&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;))}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;NextPage&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// const session = useSession()&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setPost&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setTitle&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newPost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;newPost&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;useMutation&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;form&lt;/span&gt;
        &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;flex gap-2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="nx"&gt;onSubmit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
          &lt;span class="c1"&gt;// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access&lt;/span&gt;
          &lt;span class="nx"&gt;newPost&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mutate&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;yo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
          &lt;span class="nf"&gt;setTitle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="nf"&gt;setPost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;
          &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="nx"&gt;placeholder&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;title..&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setTitle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
          &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rounded-md border-2 border-zinc-800 bg-neutral-900 px-4 py-2 focus:outline-none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;textarea&lt;/span&gt;
          &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="nx"&gt;placeholder&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Blog Here...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setPost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
          &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;w-full rounded-md border-2 border-zinc-800 bg-neutral-900 px-4 py-2 focus:outline-none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;
          &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;submit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rounded-md border-2 border-zinc-800 p-2 focus:outline-none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;Submit&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/form&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should have something like this and you're good to go!&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgmw7nhjpi5di1as470bn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgmw7nhjpi5di1as470bn.png" alt="Image description" width="800" height="162"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's pretty much it - thank you to the legend &lt;a class="mentioned-user" href="https://dev.to/nexxeln"&gt;@nexxeln&lt;/a&gt; for his initial tutorial as this was just modified for the most updated version of trpc/t3.&lt;/p&gt;

&lt;p&gt;I wanted to include how to connect to railway but you can check out &lt;a class="mentioned-user" href="https://dev.to/nexxeln"&gt;@nexxeln&lt;/a&gt; tutorial to plug in quicker.&lt;/p&gt;

&lt;p&gt;Leave any questions you may have below and I'll get around to them!&lt;/p&gt;

</description>
      <category>security</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Picking a New Language</title>
      <dc:creator>rike</dc:creator>
      <pubDate>Wed, 28 Sep 2022 05:00:03 +0000</pubDate>
      <link>https://dev.to/rike/picking-a-new-language-21ha</link>
      <guid>https://dev.to/rike/picking-a-new-language-21ha</guid>
      <description>&lt;p&gt;It's surreal that I've been working as a software developer for more than a year and that I've been working towards this goal for three. In that time span, I've gone through the typical semi-self taught cycle: basic Python tutorials, to tutorial hell, and ultimately (and regretfully) a bootcamp. The past two years have been strictly JavaScript/TypeScript (mixed in with light Solidity here and there) and I've finally reached the point where I'm comfortable with my skillsets and that I want more. So that leads me here, picking a new language to learn and ideally get really really good at.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Go (golang?)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://go.dev/"&gt;Go&lt;/a&gt; &lt;br&gt;
Everyone knows what Go is right? That's why until today I never really bothered looking into what the language is really capable of. Yes, I'm embarrassed, but I'm going to go ahead and blame my bootcamp for not putting me on. I was pretty much told that I could achieve everything with JS code but maybe they could've mentioned that things could be done with better efficiency through other means. But upon my 3 minute research, it seems like there are perks in using the language to create API's and I'm assuming servers... And to be fair, I've always enjoyed doing backend work. Idk, something about getting the connection through is like a shot of dopamine. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. Rust
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.rust-lang.org/"&gt;Rust&lt;/a&gt;&lt;br&gt;
(I honestly expected the Rust site to be futuristic looking but it's so meh)&lt;br&gt;
Okay, this one is kind of cheating since I've actually done deep dives into Rust previously. The biggest issue was that I was thrown into an established Rust repository and could never figure it out from there - so I bailed. But lo and behold, there's uses to Rust outside of blockchain (sarcasm, I promise). But to be fair, if I do go back to Rust, it's going to be for blockchain development - maybe sprinkle in some compiler code for funsies. &lt;/p&gt;

&lt;h2&gt;
  
  
  3. C++
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://cplusplus.com/"&gt;C++&lt;/a&gt;&lt;br&gt;
(I'm sure they don't need care, but you could really tell the age of this language through the site design)&lt;br&gt;
The only reason I'm considering this is because of how much video games I play. Well actually it's not like an unhealthy amount, but it definitely holds a share of my time. It's also such an old language that learning it could probably benefit my overall understanding of languages in general? I'm not sure. But do I really want to work for Riot? &lt;/p&gt;

&lt;h2&gt;
  
  
  4. CSS
&lt;/h2&gt;

&lt;p&gt;(Is there even an official CSS website?)&lt;br&gt;
Yes, this is a joke. Partially. I couldn't think of a fourth language so why not continue improving my skills in the areas I'm already working in. There's always room to try and become the next coming of Kevin Powell. And I hate it when I'm working right now and spamming a bunch of random things into my classes and praying that one of them works out.&lt;/p&gt;

&lt;p&gt;These are just my thoughts out loud. I promise I'll document whatever path I decide to go down and if I don't I'll pay you in my social token. &lt;/p&gt;

</description>
      <category>rust</category>
      <category>go</category>
      <category>cpp</category>
    </item>
    <item>
      <title>Solana Development Personal Roadmap</title>
      <dc:creator>rike</dc:creator>
      <pubDate>Wed, 23 Mar 2022 15:37:43 +0000</pubDate>
      <link>https://dev.to/rike/solana-development-personal-roadmap-587k</link>
      <guid>https://dev.to/rike/solana-development-personal-roadmap-587k</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Initially, I wanted to continue working on deploying an NFT project on an Ethereum Virtual Machine, but I was just informed that I would need to focus on building out smart contracts for the Solana Network for work. It's a given that I won't be able to provide a production-ready smart contract by next week or by this month, but I need to be able to be comfortable in that environment.&lt;/p&gt;

&lt;p&gt;One of the most daunting parts about learning Rust for Solana or any other Alternative Layer-1's is the lack of resources. The team at Solana has done a great job developing their environments, but it's not too welcoming just yet. I'm sure we're not far from having more resources, but the information is relatively scarce.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges
&lt;/h2&gt;

&lt;p&gt;There are a few challenges that a newbie like myself faces when trying to develop on Solana.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;From a &lt;strong&gt;JavaScript&lt;/strong&gt; background - learning TypeScript was the best preparation I did before learning Solidity, and it's looking like it'll pay dividends for Rust as well, but as a backstory, I never learned a language like C/C++, Go, Ruby, etc. I felt like learning Solidity wasn't too difficult since the language is relatively young, but learning Rust might be a different experience since it's not a language developed solely for Blockchain development.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Packages&lt;/strong&gt; - This goes back to the lack of resources, but with developing on Ethereum, you have packages like Truffle and Hardhat that make the development experience enjoyable. With Anchor CLI being so young, the onboarding experience has been difficult to grasp. This isn't meant to shade the team at Anchor whatsoever, this goes back to understanding how Solana programs operate in comparison to Ethereum Smart Contracts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leaders&lt;/strong&gt; - When picking up Solidity and Ethereum, there were clear influencers in the space that you could always look up if you wanted to learn something. With Solana being relatively young, it's not exactly easy finding information when you hit a roadblock.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Educational Materials&lt;/strong&gt; - A large contribution to my understanding of Solidity was crafted behind resources like &lt;a href="https://cryptozombies.io/"&gt;CryptoZombies&lt;/a&gt;, &lt;a href="https://ethernaut.openzeppelin.com/"&gt;Ethernaut&lt;/a&gt;, and &lt;a href="https://github.com/scaffold-eth/scaffold-eth"&gt;Scaffold-Eth&lt;/a&gt;, etc. I've yet to find anything anywhere near those for Solana development.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The next step(s)?
&lt;/h2&gt;

&lt;p&gt;So now that I've laid out all the challenges that I face, we can build out the steps to take to overcome them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learn Rust

&lt;ul&gt;
&lt;li&gt;Rust has some great resources to learn the languages, which is what I need to approach first. I plan on learning through &lt;a href="https://doc.rust-lang.org/book/"&gt;The Rust Programming Language Book&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Learn Solana

&lt;ul&gt;
&lt;li&gt;Coming from an EVM background, I need to understand how Solana works under the hood and the core differences between them and Ethereum.&lt;/li&gt;
&lt;li&gt;I plan on looking through their official docs and playing with their RPC API's.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Learn Anchor

&lt;ul&gt;
&lt;li&gt;Being a major tool in Solana app development, I need to understand how to use Anchor and start developing small programs and deploying them to the devnet.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it for now! I'll keep you updated during this journey!&lt;/p&gt;

</description>
      <category>solana</category>
      <category>web3</category>
      <category>rust</category>
      <category>anchor</category>
    </item>
    <item>
      <title>Building An NFT Project: Part 1 - Getting Started With Hardhat</title>
      <dc:creator>rike</dc:creator>
      <pubDate>Sun, 13 Mar 2022 00:56:55 +0000</pubDate>
      <link>https://dev.to/rike/building-an-nft-project-part-1-getting-started-with-hardhat-3b0p</link>
      <guid>https://dev.to/rike/building-an-nft-project-part-1-getting-started-with-hardhat-3b0p</guid>
      <description>&lt;p&gt;NOTE: we are not coding a smart contract just yet. We are getting familiar with the capabilities of Hardhat so I don’t overwhelm you when we began our full-stack dapp.&lt;/p&gt;

&lt;p&gt;If you’re looking to get started with building out Solidity Smart Contracts, I’m sure you’ve dealt with the countless environments that you can go through. From Hardhat to Truffle, to Brownie (although this is a python environment) it’s hard to find the “right” one - and rightfully so, there’s no clear cut winner - but I firmly believe that Hardhat is the most beginner-friendly one out there so we’ll be starting with that. &lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up
&lt;/h2&gt;

&lt;p&gt;Prerequisites: make sure you have NodeJS installed.&lt;/p&gt;

&lt;p&gt;Let’s get our environment set-up. Make a folder - this is going to be the sandbox that we’re working in - and cd into this folder (I’m assuming you’re using terminal).&lt;/p&gt;

&lt;p&gt;mkdir hardhat-sandbox&lt;br&gt;
cd hardhat-sandbox&lt;/p&gt;

&lt;p&gt;Initialize a package.json file and we’re going to  install hardhat as a dev dependency. (for our testing purposes, it doesn’t matter if we save it as a dev dependency or global, but it will matter later on when we’re actually publishing our work).&lt;/p&gt;

&lt;p&gt;npm install --save-dev hardhat&lt;/p&gt;

&lt;p&gt;Now we have hardhat downloaded! Our basic setup is almost complete.&lt;/p&gt;

&lt;p&gt;npx hardhat&lt;/p&gt;

&lt;p&gt;`&lt;br&gt;
888    888                      888 888               888&lt;br&gt;
888    888                      888 888               888&lt;br&gt;
888    888                      888 888               888&lt;br&gt;
8888888888  8888b.  888d888 .d88888 88888b.   8888b.  888888&lt;br&gt;
888    888     "88b 888P"  d88" 888 888 "88b     "88b 888&lt;br&gt;
888    888 .d888888 888    888  888 888  888 .d888888 888&lt;br&gt;
888    888 888  888 888    Y88b 888 888  888 888  888 Y88b.&lt;br&gt;
888    888 "Y888888 888     "Y88888 888  888 "Y888888  "Y888&lt;/p&gt;

&lt;p&gt;Welcome to Hardhat v2.9.1&lt;/p&gt;

&lt;p&gt;? What do you want to do? …&lt;br&gt;
▸ Create a basic sample project&lt;br&gt;
  Create an advanced sample project&lt;br&gt;
  Create an advanced sample project that uses TypeScript&lt;br&gt;
  Create an empty hardhat.config.js&lt;br&gt;
  Quit&lt;br&gt;
`&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We’ll be prompted with a few questions now: &lt;/li&gt;
&lt;li&gt;Create a basic sample project&lt;/li&gt;
&lt;li&gt;Leave the file path as is&lt;/li&gt;
&lt;li&gt;Do you want to add a .gitignore? Yes.&lt;/li&gt;
&lt;li&gt;Yes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;Do you want to install this sample project's dependencies with npm (hardhat @nomiclabs/hardhat-waffle Ethereum-waffle chai @nomiclabs/hardhat-ethers ethers)? Yes - these dependencies all play a role and we’ll go over their uses as we get familiar with our environment.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your file structure should look like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;├── README.md&lt;br&gt;
├── contracts&lt;br&gt;
├── hardhat.config.js&lt;br&gt;
├── node_modules&lt;br&gt;
├── package-lock.json&lt;br&gt;
├── package.json&lt;br&gt;
├── scripts&lt;br&gt;
└── test&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Congratulations! Our sandbox is officially set up and now we can really start messing around with what we can really do. &lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the file structure
&lt;/h2&gt;

&lt;p&gt;Depending on your developer level, the files in here can be a bit overwhelming (If you’ve been a dev on a team then this might seem relatively standard). The four main components that we need to understand are contracts, scripts, test and hardhat.config.js. &lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Configuration File
&lt;/h2&gt;

&lt;p&gt;If you’re anything like me, config files somehow always give you issues. Not to fear! I’m going to do my best to introduce it in it’s most digestible way. We’re not going to mess and edit our config just yet - we just want to see what we get from Hardhat. &lt;/p&gt;

&lt;p&gt;`task("accounts", "Prints the list of accounts", async (taskArgs, hre) =&amp;gt; {&lt;br&gt;
  const accounts = await hre.ethers.getSigners();&lt;/p&gt;

&lt;p&gt;for (const account of accounts) {&lt;br&gt;
    console.log(account.address);&lt;br&gt;
  }&lt;br&gt;
});&lt;br&gt;
`&lt;br&gt;
What are tasks you might be asking. Because I was asking the same question. In our terminal - if we type npx hardhat we’ll see a section representing global sections and tasks available. So in simplest terms. tasks are going to be these global functions that we can call from our terminal to check various things. The one provided to us provides a list of accounts that our local network will spin up (don’t worry if this doesn’t make sense yet). &lt;/p&gt;

&lt;p&gt;And remember when we spun up our initialization of hardhat? We installed a few dependencies that we didn’t really know. Well here we see our first example of it being use &lt;code&gt;require("@nomiclabs/hardhat-waffle");&lt;/code&gt;. Without getting into the nitty gritty, this is giving us access to the getSigners() function. (hre.ethers is already injected to this file).&lt;/p&gt;

&lt;h2&gt;
  
  
  Contracts
&lt;/h2&gt;

&lt;p&gt;This is where all our smart contract files will stay. We’re defaulted with a basic Greeter.sol contract but this folder can hold as many smart contracts as your dapp would need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scripts
&lt;/h2&gt;

&lt;p&gt;Okay no need to be overwhelmed when we’re looking at the sample-script.js file inside the scripts folder! So the main thing to understand is that this is going to be our script that deploys our smart contract. That may seem confusing for now, but once we look at our sample-script, it’ll began to make more sense. &lt;/p&gt;

&lt;p&gt;`async function main() {&lt;br&gt;
  const Greeter = await    hre.ethers.getContractFactory("Greeter");&lt;br&gt;
  const greeter = await Greeter.deploy("Hello, Hardhat!");&lt;/p&gt;

&lt;p&gt;await greeter.deployed();&lt;br&gt;
  console.log("Greeter deployed to:", greeter.address);&lt;br&gt;
}&lt;br&gt;
`&lt;br&gt;
I removed their comments so that we can observe a little more clearly:&lt;/p&gt;

&lt;p&gt;Calling getContractFactory(“Greeter”), let’s our script understand where to look for the compiled smart contract code.&lt;/p&gt;

&lt;p&gt;We call a built in function deploy to…deploy our contract(passing in “Hello, Hardhat” as the argument).&lt;/p&gt;

&lt;p&gt;await greeter.deployed() gives use the time needed to deploy the contract - this is a concept I’m sure you may be familiar with, but working on the Ethereum mainnet, transactions take some time to process. So we need to wait until they’re done. &lt;/p&gt;

&lt;p&gt;greeter.address will be some sort of 32 digit address indicating where we can find the smart contract. &lt;/p&gt;

&lt;h2&gt;
  
  
  Testing, testing, testing
&lt;/h2&gt;

&lt;p&gt;The best part, testing! Before we dive in, let’s run: npx hardhat test and see what happens. &lt;/p&gt;

&lt;p&gt;It’s like any other testing framework! So the magic happens through hardhats ability to understand where to find our test files and run them. The concept of what happens is nearly identical with our scripts file so I don’t think I need to go into much more detail on what the sample-test.js file is doing, but I do want to specify what happens when we call npx hardhat test. &lt;/p&gt;

&lt;p&gt;Hardhat will spin up a private local blockchain on your machine - deploy the contract - run whatever tests we give it - and then shut off the local blockchain. Neat huh?!&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Conclusion&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I hope I was able to give you an introduction to Hardhat in an easy and digestible way. I am going to go more into depth on how we are able to use Hardhat for our own development later, but don’t be shy and start messing around with it. If you have any questions, you can always find my on &lt;strong&gt;Twitter @yeeckin&lt;/strong&gt;. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Relearning Data Structures and Algorithms</title>
      <dc:creator>rike</dc:creator>
      <pubDate>Sun, 06 Mar 2022 06:40:31 +0000</pubDate>
      <link>https://dev.to/rike/relearning-data-structures-and-algorithms-jkf</link>
      <guid>https://dev.to/rike/relearning-data-structures-and-algorithms-jkf</guid>
      <description>&lt;p&gt;As a product of a bootcamp, my lectures on data structures and algorithms spanned two days - one day for lectures, one day for practice problems. A huge issue was that this was the first lesson that we had but instead of building on these fundamentals, we navigated towards web development which to be honest uses hardly any data structure (on the front-end). It wasn't till towards the end of the program where it dawned on all of us that we need to actually understand data structures a little bit more, not just for interview preparation but for building a strong foundation. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;It's really easy to complain about how tech interviews aren't really applicable to say a React developers day-to-day, but I'm a believer that having a strong basis in understanding how data flows can help you write more inefficient code. Or it'll at least help you think in a specific way.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now that we've addressed my issue of not having a strong foundation in computer science, it's become my priority to improve this, now I'm come to an intersection on how I need to approach this.&lt;/p&gt;

&lt;p&gt;Here are my options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read through Cracking the Coding Interview from front to back.&lt;/li&gt;
&lt;li&gt;Pay for AlgoExpert and take their crash course&lt;/li&gt;
&lt;li&gt;Sign up for a free tutorial on Coursera/Udemy and take that. (I've heard great things about Colt Steeles course)&lt;/li&gt;
&lt;li&gt;Idk...&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I'll continue to update this list as I approach this, but for the time being, I'll take these approaches one step at a time and document my thoughts. If you have any resources to share, be sure to let me know and I'll give my thoughts on those too!&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>javascript</category>
      <category>interview</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
