<?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: Sasidharan</title>
    <description>The latest articles on DEV Community by Sasidharan (@sasicodes).</description>
    <link>https://dev.to/sasicodes</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%2F403747%2Feb133d02-74c1-4d19-81b5-0fe896ad0edc.png</url>
      <title>DEV Community: Sasidharan</title>
      <link>https://dev.to/sasicodes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sasicodes"/>
    <language>en</language>
    <item>
      <title>Android 11 with TailwindCSS</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Tue, 20 Jul 2021 16:48:03 +0000</pubDate>
      <link>https://dev.to/sasicodes/android-11-with-tailwindcss-kgg</link>
      <guid>https://dev.to/sasicodes/android-11-with-tailwindcss-kgg</guid>
      <description>&lt;p&gt;In this blog, we gonna recreate the Android 11 model UI with &lt;a href="https://tailwindcss.com/?ref=lagandlog.com" rel="noopener noreferrer"&gt;TailwindCSS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you are interested in using TailwindCSS in React Native, check out &lt;a href="https://lagandlog.com/logs/how-to-use-tailwind-css-in-react-native" rel="noopener noreferrer"&gt;TailwindCSS and React native&lt;/a&gt; log.&lt;/p&gt;

&lt;p&gt;Let's get right into it,&lt;/p&gt;

&lt;p&gt;We are gonna take an image from the official page and try to replicate the same, follow along for more.&lt;/p&gt;

&lt;h4&gt;
  
  
  Image to replicate:
&lt;/h4&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%2Flagandlog-uploads.s3.amazonaws.com%2FANDROID_11_079b0813aa.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%2Flagandlog-uploads.s3.amazonaws.com%2FANDROID_11_079b0813aa.png" alt="ANDROID11.png" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
Image source - &lt;a href="https://www.android.com/intl/en_in/android-11/" rel="noopener noreferrer"&gt;https://www.android.com/intl/en_in/android-11/&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Final output 😍:
&lt;/h4&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%2Flagandlog-uploads.s3.amazonaws.com%2Fandroid11output_4e54645242.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%2Flagandlog-uploads.s3.amazonaws.com%2Fandroid11output_4e54645242.png" alt="android11output.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Find source code here -  &lt;a href="https://lagandlog.com/logs/rebuild-android-11-with-tailwindcss" rel="noopener noreferrer"&gt;Complete source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/sasiKdharan/embed/LYyjOZM?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Feel free to add your comments below &amp;amp; follow me on Twitter for more - &lt;a href="https://twitter.com/sasiKdharan" rel="noopener noreferrer"&gt;sasiKdharan&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Happy Designing 💅
&lt;/h3&gt;

</description>
      <category>tailwindcss</category>
      <category>webdev</category>
      <category>design</category>
    </item>
    <item>
      <title>How to use Tailwind CSS in React Native</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Sun, 18 Jul 2021 08:30:00 +0000</pubDate>
      <link>https://dev.to/sasicodes/how-to-use-tailwind-css-in-react-native-2k87</link>
      <guid>https://dev.to/sasicodes/how-to-use-tailwind-css-in-react-native-2k87</guid>
      <description>&lt;p&gt;Styling in React Native is pretty simple at the initial stage when we are developing a new application. React Native's &lt;a href="https://reactnative.dev/docs/stylesheet/?ref=lagandlog.com" rel="noopener noreferrer"&gt;Stylesheet&lt;/a&gt; helps us to add styles to our elements. When the codebase increases, stylesheets (both external/internal) will be increased, and so maintaining the uniform class names, reusing styles is a nightmare.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tailwindcss.com/?ref=lagandlog.com" rel="noopener noreferrer"&gt;Tailwind CSS&lt;/a&gt; is an open-source utility-first CSS framework. It redefines the way you style applications by providing a variety of CSS classes by default and we can customize to any extend. Without writing custom styles for each element back and forth, we can use tailwind to write inline styles effectively. It gives a solid design system by default and helps writing &lt;strong&gt;conditional&lt;/strong&gt; , &lt;strong&gt;device-specific&lt;/strong&gt; styles are the major advantages. By this approach, bulk stylesheets will be reduced and can reuse tailwind styles to other components.&lt;/p&gt;

&lt;p&gt;Personally, am not a big fan of writing complete CSS on my own, this [lagandlog.com] is completely built using &lt;code&gt;tailwindcss&lt;/code&gt; and I had a great experience and it came out really well. The bundle size of the tailwind is &amp;lt;10KB and it is super ok✌️&lt;/p&gt;

&lt;h3&gt;
  
  
  Where to start?
&lt;/h3&gt;

&lt;p&gt;Many packages out there were mainly created to use TailwindCSS in React Native. Every package has its own way of usage and we are not gonna learn each of them. Listing few useful dependencies below for reference,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/tailwind-react-native-classnames/?ref=lagandlog.com" rel="noopener noreferrer"&gt;tailwind-react-native-classnames&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/react-native-tailwindcss/?ref=lagandlog.com" rel="noopener noreferrer"&gt;react-native-tailwindcss&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/tailwind-rn/ref=lagandlog.com" rel="noopener noreferrer"&gt;tailwind-rn&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These packages were simple to use and will not replace any native components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which one to use?
&lt;/h3&gt;

&lt;p&gt;Each one of them is similar and has its own advantages, please refer to the official documentation and find the one that suits you.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: TailwindCSS is not created specifically to React Native, so some of the class names will not be supported.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We are trying something more useful, device-specific customizable package &lt;a href="https://www.npmjs.com/package/tailwind-react-native-classnames" rel="noopener noreferrer"&gt;&lt;code&gt;tailwind-react-native-classnames&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Installation
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install tailwind-react-native-classnames
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Usage
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { View, Text } from 'react-native';
import tw from 'tailwind-react-native-classnames';

const MyComponent = () =&amp;gt; (
  &amp;lt;View style={tw`p-4 android:pt-2 bg-red-300 flex-row`}&amp;gt;
    &amp;lt;Text style={tw`text-md tracking-wide`}&amp;gt;Hey there!&amp;lt;/Text&amp;gt;
  &amp;lt;/View&amp;gt;
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Platform-specific styles
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// 😎 styles only added if platform matches
tw`ios:pt-4 android:pt-2`;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can learn more about customizing, overwriting, configurations of the package &lt;a href="https://www.npmjs.com/package/tailwind-react-native-classnames" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Sample Design
&lt;/h4&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%2Flagandlog-uploads.s3.amazonaws.com%2Ftailwind_rn_7e8cfa258a.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%2Flagandlog-uploads.s3.amazonaws.com%2Ftailwind_rn_7e8cfa258a.png" alt="tailwind-rn.png" width="800" height="400"&gt;&lt;/a&gt;Image Source - &lt;a href="https://github.com/vadimdemedes/tailwind-rn" rel="noopener noreferrer"&gt;tailwind-rn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this log is useful for you, feel free to add your thoughts in the comments.&lt;/p&gt;

&lt;p&gt;TailwindCSS Cheatsheet - &lt;a href="https://nerdcave.com/tailwind-cheat-sheet" rel="noopener noreferrer"&gt;https://nerdcave.com/tailwind-cheat-sheet&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://twitter.com/sasiKdharan" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Happy Coding!
&lt;/h3&gt;

</description>
      <category>css</category>
      <category>reactnative</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>Free icons for your next project</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Tue, 13 Jul 2021 14:30:21 +0000</pubDate>
      <link>https://dev.to/lagandlog/free-icons-for-your-next-project-4736</link>
      <guid>https://dev.to/lagandlog/free-icons-for-your-next-project-4736</guid>
      <description>&lt;p&gt;Here some of the free icons we can use in any library for our next projects and do wish to credit the creator.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Hero Icons - &lt;a href="https://heroicons.com/?ref=lagandlog.com" rel="noopener noreferrer"&gt;Visit&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Beautiful hand-crafted SVG icons, by the makers of Tailwind CSS. Simple to use.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Flaticon - &lt;a href="https://www.flaticon.com/icons/?ref=lagandlog.com" rel="noopener noreferrer"&gt;Visit&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;The largest database of free icons available in PNG, SVG, EPS, PSD, and BASE 64 formats. More variants so more to choose from.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. The Noun Project - &lt;a href="https://thenounproject.com/?ref=lagandlog.com" rel="noopener noreferrer"&gt;Visit&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;The World’s Most Diverse and Extensive Icon Collection. Over 3 million unique and simple icons.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. TablerIcons - &lt;a href="https://tablericons.com/?ref=lagandlog.com" rel="noopener noreferrer"&gt;Visit&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Open source, fully customizable 1000+ icons.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Icons8 - &lt;a href="https://icons8.com/?ref=lagandlog.com" rel="noopener noreferrer"&gt;Visit&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;The modern, unique set of icons in both SVG and png formats. Available in various styles.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://lagandlog.com/logs/free-icons-for-your-next-project" rel="noopener noreferrer"&gt;View all&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are the various icon sets that I came across, feel free to add your favorite and go-to icons library in the comments below.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Go through the website to learn about free licensing on illustrations that you use.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Happy coding!
&lt;/h3&gt;

</description>
      <category>webdev</category>
      <category>icons</category>
    </item>
    <item>
      <title>Passwordless Email login in NextJs using NextAuth</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Sun, 02 May 2021 06:46:57 +0000</pubDate>
      <link>https://dev.to/sasicodes/passwordless-email-login-in-nextjs-using-nextauth-5hko</link>
      <guid>https://dev.to/sasicodes/passwordless-email-login-in-nextjs-using-nextauth-5hko</guid>
      <description>&lt;p&gt;&lt;a href="http://nextjs.org/" rel="noopener noreferrer"&gt;Next.js&lt;/a&gt; is an open-source React front-end development web framework that enables functionality such as server-side rendering and generating static websites for React-based web applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NextAuth&lt;/strong&gt;  - NextAuth.js is a complete open-source authentication solution for &lt;a href="http://nextjs.org/" rel="noopener noreferrer"&gt;Next.js&lt;/a&gt; applications. It is designed from the ground up to support Next.js and Serverless.&lt;/p&gt;

&lt;p&gt;Learn more about NextJs and NextAuth here - &lt;/p&gt;

&lt;h2&gt;
  
  
  What is Passwordless login?
&lt;/h2&gt;

&lt;p&gt;At a basic level, passwordless authentication is any method of verifying a user without requiring the user to provide a password.&lt;/p&gt;

&lt;p&gt;To increase user experience, most of the popular applications using passwordless authentication flow. This helps users to log in without entering a password in their application.&lt;/p&gt;

&lt;p&gt;In this following log, we are creating a passwordless email login in our NextJs application using the NextAuth.js library.&lt;/p&gt;

&lt;h2&gt;
  
  
  Initialization
&lt;/h2&gt;

&lt;p&gt;Create your NextJs project using these &lt;a href="https://nextjs.org/docs/getting-started" rel="noopener noreferrer"&gt;steps&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating your project, your folder structure will look like this,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
    .
    .
    \pages
    --\api
    --\index.jsx
    .
    \package.json

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

&lt;/div&gt;



&lt;p&gt;Install the next-auth dependency using,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add next-auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a folder called &lt;code&gt;auth&lt;/code&gt; inside &lt;code&gt;/pages/api/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To add NextAuth.js to a project create a file called &lt;strong&gt;[...nextauth].js&lt;/strong&gt; in &lt;code&gt;pages/api/auth&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Login using a link
&lt;/h2&gt;

&lt;p&gt;In this example, we are exploring how to create authentication flow using the magic link that is sent to the user's email register/log in.&lt;/p&gt;

&lt;p&gt;Inside your &lt;strong&gt;[...nextauth].js&lt;/strong&gt; file paste the following lines,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    import NextAuth from "next-auth";
    import Providers from "next-auth/providers";
    import Adapters from "next-auth/adapters";
    import prisma from "../../../lib/prisma";
    import { isDevelopment } from "../../../helpers/functions";

    export default NextAuth({
      providers: [
        Providers.Email({
          server: {
            host: process.env.EMAIL_SERVER_HOST,
            port: process.env.EMAIL_SERVER_PORT,
            auth: {
              user: process.env.EMAIL_SERVER_USER,
              pass: process.env.EMAIL_SERVER_PASSWORD,
            },
          },
          from: process.env.EMAIL_FROM,
          maxAge: 24 * 60 * 60,
        }),
      ],
      session: {
        jwt: true,
        maxAge: 30 * 24 * 60 * 60, // 30 days
      },
      debug: isDevelopment,
      jwt: {
        // signingKey: process.env.NEXTAUTH_JWT_SIGNING_PRIVATE_KEY,
      },
      adapter: Adapters.Prisma.Adapter({ prisma }),
      database: process.env.DATABASE_URL,
      pages: {
        signIn: "/",
        signOut: "/",
        error: "/", // Error code passed in query string as ?error=
        verifyRequest: "/", // (used for check email message)
    // If set, new users will be directed here on first sign in
        newUser: '/dashboard' , 
      },
    });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have used &lt;a href="https://www.prisma.io/" rel="noopener noreferrer"&gt;Prisma&lt;/a&gt; as database ORM.&lt;/p&gt;

&lt;p&gt;Learn more about databases - &lt;a href="https://next-auth.js.org/configuration/databases" rel="noopener noreferrer"&gt;https://next-auth.js.org/configuration/databases&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;On the initial sign-in, a  &lt;strong&gt;Verification Token&lt;/strong&gt;  is sent to the email address provided. By default, this token is valid for 24 hours. If the Verification Token is used with that time (i.e. by clicking on the link in the email) an account is created for the user and they are signed in.&lt;/p&gt;

&lt;p&gt;If someone provides the email address of an &lt;em&gt;existing account&lt;/em&gt; when signing in, an email is sent and they are signed into the account associated with that email address when they follow the link in the email.&lt;/p&gt;

&lt;p&gt;Follow Email provider documentation &lt;a href="https://next-auth.js.org/providers/email" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Client-Side
&lt;/h2&gt;

&lt;p&gt;NextAuth provides a default interface to log in. You can now sign in with an email address at &lt;code&gt;{{host}}/api/auth/signin&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom login form
&lt;/h2&gt;

&lt;p&gt;You can have your own login component and using  &lt;strong&gt;next-auth/client&lt;/strong&gt; , we can log in easily as,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { signIn } from "next-auth/client";

const onLogin = async() =&amp;gt; {
   let response = await signIn("email", {
      email: "user@example.com"
   });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the successful response, an email will be sent to the respective user email with a login link button.&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%2Flagandlog-uploads.s3.amazonaws.com%2FScreenshot_from_2021_04_16_12_51_43_1f49ba6b0b.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%2Flagandlog-uploads.s3.amazonaws.com%2FScreenshot_from_2021_04_16_12_51_43_1f49ba6b0b.png" alt="Email Received" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also customize your email - Refer to the &lt;a href="https://next-auth.js.org/providers/email#customising-emails" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow the link to log in as an authenticated user into your application. Use default APIs to validate and process user sessions,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// server-side
 import { getSession } from 'next-auth/client'

// client side hook
import { useSession } from 'next-auth/client'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this will return the current user of the session.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
      user: {
        name: string,
        email: string,
        image: uri
      },
      accessToken: string,
      expires: "YYYY-MM-DDTHH:mm:ss.SSSZ"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Hopefully, it'll be useful. If you wish, follow me on &lt;a href="https://twitter.com/sasiKdharan" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Happy Coding☕💻
&lt;/h3&gt;

</description>
      <category>nextjs</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to dockerize React App</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Sun, 02 May 2021 06:41:09 +0000</pubDate>
      <link>https://dev.to/lagandlog/how-to-dockerize-react-app-34df</link>
      <guid>https://dev.to/lagandlog/how-to-dockerize-react-app-34df</guid>
      <description>&lt;p&gt;Developing apps today requires so much more than writing code. Multiple languages, frameworks, architectures, and discontinuous interfaces between tools for each lifecycle stage create enormous complexity. It helps to speed up the development and deployment processes. If you’re working with microservices, Docker makes it much easier to link together small, independent services.&lt;/p&gt;

&lt;p&gt;React is an open-source, front-end, JavaScript library for building user interfaces or UI components. React can be used as a base in the development of single-page or mobile applications. &lt;/p&gt;

&lt;p&gt;I recently came up with a situation to containerize my React application, so learned the steps to containerize  &lt;strong&gt;production-ready&lt;/strong&gt;  applications and I'm sharing the same in this log,&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1
&lt;/h2&gt;

&lt;p&gt;To create react application via the command line, you should have  &lt;strong&gt;Node&lt;/strong&gt;  installed on your computer. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;Node Download&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app my-app
cd my-app
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Open &lt;a href="http://localhost:3000/" rel="noopener noreferrer"&gt;http://localhost:3000/&lt;/a&gt; to see your app.&lt;/p&gt;

&lt;p&gt;The folder structure will look like this,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; my-app/
      README.md
      node_modules/
      package.json
      public/
        index.html
        favicon.ico
      src/
        App.css
        App.js
        App.test.js
        index.css
        index.js
        logo.svg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2
&lt;/h2&gt;

&lt;p&gt;Before we containerize our application, we should create a special file that Docker understands, i.e, &lt;em&gt;Dockerfile&lt;/em&gt; in the root of your application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-app/
      Dockerfile &amp;lt;-
      README.md
      node_modules/
      package.json
      public/
        index.html
        favicon.ico
      src/
        App.css
        App.js
        App.test.js
        index.css
        index.js
        logo.svg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Docker builds images automatically by reading the instructions from a &lt;code&gt;Dockerfile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A Docker image consists of read-only layers each of which represents a Dockerfile instruction. The layers are stacked and each one is a delta of the changes from the previous layer.&lt;/p&gt;

&lt;p&gt;Without further ado, let's write into our Dockerfile,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:13.12.0-alpine as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json ./
RUN npm i --silent
COPY . ./
RUN npm run build

FROM nginx:stable-alpine
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each instruction creates one layer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;FROM&lt;/code&gt; creates a layer from the &lt;code&gt;node:13.12.0-alpine&lt;/code&gt; Docker image.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;COPY&lt;/code&gt; adds files from your Docker client’s current directory.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;RUN&lt;/code&gt; builds your application with &lt;code&gt;make&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CMD&lt;/code&gt; specifies what command to run within the container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you run an image and generate a container, you add a new &lt;em&gt;writable layer&lt;/em&gt; (the “container layer”) on top of the underlying layers. All changes made to the running container, such as writing new files, modifying existing files, and deleting files, are written to this thin writable container layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3
&lt;/h2&gt;

&lt;p&gt;Now, let's build our Dockerfile,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -f Dockerfile -t my_react_app:prod .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  In the first 7 lines of the Dockerfile,
&lt;/h3&gt;

&lt;p&gt;it pulls the image that we specified in FROM and starts executes all our commands, and generates a single page react build.&lt;/p&gt;

&lt;h3&gt;
  
  
  the rest,
&lt;/h3&gt;

&lt;p&gt;takes that build folder, pulls Nginx image from Dockerhub, and copies our build to the &lt;code&gt;/html&lt;/code&gt; folder we specified. Now Nginx serves our React application inside  &lt;strong&gt;port 80&lt;/strong&gt;  inside the container.&lt;/p&gt;

&lt;p&gt;After all the steps/layers in Dockerfile are completed successfully, we can spin up the image using the following command,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -it --rm -p 5000:80 my_react_app:prod
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in this, the port 80 from container listens in 5000 in our machine, which means we can view our application on &lt;a href="http://localhost:5000/" rel="noopener noreferrer"&gt;http://localhost:5000&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this, now you can able to containerize your application in a docker. The steps will be similar to all large react projects.&lt;/p&gt;

&lt;p&gt;Follow me on twitter - &lt;a href="https://twitter.com/sasiKdharan" rel="noopener noreferrer"&gt;https://twitter.com/sasiKdharan&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Happy Coding 🤖
&lt;/h3&gt;

</description>
      <category>react</category>
      <category>docker</category>
    </item>
    <item>
      <title>Blog using Gatsby and Strapi</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Sun, 02 May 2021 06:38:24 +0000</pubDate>
      <link>https://dev.to/lagandlog/blog-using-gatsby-and-strapi-5c00</link>
      <guid>https://dev.to/lagandlog/blog-using-gatsby-and-strapi-5c00</guid>
      <description>&lt;p&gt;Gatsby is a React-based framework, popular for performance, static site generation, and scalability. We have covered everything you need to &lt;a href="https://lagandlog.com/logs/get-started-with-gatsby" rel="noopener noreferrer"&gt;Get Started with Gatsby&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because it is based on React, the website pages are never reloaded which makes the generated website super fast. A large set of plugins is available to allow developers to save time coding.&lt;/p&gt;

&lt;p&gt;Strapi is the leading open-source headless CMS. It’s 100% Javascript, fully customizable, and developer-first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You need to have node v.12 installed.&lt;/li&gt;
&lt;li&gt;Basic knowledge of ReactJs and Javascript.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Checkout  &lt;strong&gt;Get Started&lt;/strong&gt;  logs for Gatsby and Strapi,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://lagandlog.com/logs/get-started-with-gatsby" rel="noopener noreferrer"&gt;Get Started with Gatsby&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://lagandlog.com/logs/backend-made-easy-with-strapi" rel="noopener noreferrer"&gt;Backend made easy with Strapi&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am using the same sample application that was created in the above logs. After completing the Gatsby project setup, and start editing the index.js file in /pages folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect Gatsby with Strapi
&lt;/h2&gt;

&lt;p&gt;Strapi built a plugin for gatsby called &lt;code&gt;gatsby-source-strapi&lt;/code&gt; , install the plugin in our Gatsby application using the command,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add gatsby-source-strapi

(or)

npm install gatsby-source-strapi`

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

&lt;/div&gt;



&lt;p&gt;This plugin needs to be configured, so inside plugins array add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
{
 resolve: "gatsby-source-strapi",
 options: {
 apiURL: process.env.API_URL || "http://localhost:1337",
 contentTypes: ["blog"],
 queryLimit: 1000,
 },
}

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

&lt;/div&gt;



&lt;p&gt;This will allow Gatsby to fetch all our blogs on build time.&lt;/p&gt;

&lt;p&gt;Now you can start creating components and layouts for our blog. To get list of all blog posts inside our component refer to the following  &lt;strong&gt;Graphql&lt;/strong&gt;  query,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { graphql, useStaticQuery } from "gatsby";
import PostComponent from "../components/posts";

const IndexPage = () =&amp;gt; {
  const data = useStaticQuery(query);

  return (
      &amp;lt;div&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;h1&amp;gt;Posts&amp;lt;/h1&amp;gt;
          &amp;lt;PostComponent articles={data.allStrapiPost.edges} /&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
  );
};

const query = graphql`
  query {
    allStrapiBlog(filter: { status: { eq: "published" } }) {
      edges {
        node {
          strapiId
          slug
          title
          }
        }
      }
    }
  }
`;

export default IndexPage;

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

&lt;/div&gt;



&lt;p&gt;This will query all the posts and the data is passed via  &lt;strong&gt;data&lt;/strong&gt;  props to the component.&lt;/p&gt;

&lt;p&gt;Use the list of posts to render your blog posts on the page. Make your own styles.&lt;/p&gt;

&lt;p&gt;Image Source - &lt;a href="https://strapi.io/blog/build-a-static-blog-with-gatsby-and-strapi" rel="noopener noreferrer"&gt;Strapi Blog&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%2Fassets.strapi.io%2Fuploads%2FCapture-d-e-cran-2020-01-29-a--16.53.48--1-.png_8a775dfc1a.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%2Fassets.strapi.io%2Fuploads%2FCapture-d-e-cran-2020-01-29-a--16.53.48--1-.png_8a775dfc1a.png" alt="Gatsby blog" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also use Javascript fetch() to list all posts via a REST API call to localhost:1337/blogs and render it on the screen.&lt;/p&gt;

&lt;p&gt;To create pages dynamically for all posts during build time, we have gatsby.node.js file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exports.createPages = async ({ graphql, actions }) =&amp;gt; {
  const { createPage } = actions;
  const result = await graphql(
    `
      {
        posts: allStrapiPost {
          edges {
            node {
              strapiId
              slug
            }
          }
        }
      }
    `
  );

  if (result.errors) {
    throw result.errors;
  }

  // Create blog pages.
  const posts = result.data.articles.edges;

  const PostTemplate = require.resolve("./src/templates/post.js");

  posts.forEach((post, index) =&amp;gt; {
    createPage({
      path: `/post/${post.node.slug}`,
      component: PostTemplate,
      context: {
        slug: post.node.slug,
      },
    });
  });
};

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

&lt;/div&gt;



&lt;p&gt;It will create pages for all your slugs dynamically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/post/my-first-post
/post/another-post
/post/my-second-post

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

&lt;/div&gt;



&lt;p&gt;using any markdown packages to render your markdown as HTML in Gatsby frontend.&lt;/p&gt;

&lt;p&gt;For more details, visit the documentation&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.gatsbyjs.com/docs/" rel="noopener noreferrer"&gt;Gatsby&lt;/a&gt; and &lt;a href="https://strapi.io/documentation/developer-docs/latest/getting-started/introduction.html" rel="noopener noreferrer"&gt;Strapi&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Happy Coding 👾
&lt;/h2&gt;

&lt;p&gt;AMA on &lt;a href="https://twitter.com/sasiKdharan" rel="noopener noreferrer"&gt;https://twitter.com/sasiKdharan&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>strapi</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Git - Staging and Snapshoting</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Sun, 02 May 2021 06:26:02 +0000</pubDate>
      <link>https://dev.to/sasicodes/git-staging-and-snapshoting-3ngi</link>
      <guid>https://dev.to/sasicodes/git-staging-and-snapshoting-3ngi</guid>
      <description>&lt;p&gt;Staging and snapshotting are important topics because these commands will be used by us daily.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation and setup were covered in the previous log.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://lagandlog.com/logs/git-local-setup" rel="noopener noreferrer"&gt;Local Setup&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows. Let's have look at only commands that required to stage and commit to your working branch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working with Git stage and commit
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;show modified files in the working directory.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git add [file] (or) git add . 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;you can add the file one by one to the stage or use ( . ) to add all your files at once to the stage.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git reset [file] (or) git reset . 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;unstage a file while retaining the changes in the working directory or reset all files using ( . ) at the end.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git diff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;check the changes made compared with the previous commit for the unstaged files.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git diff --staged
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;check the changes made in stages files before commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Commit your code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git commit -m "[descriptive message]" 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;this command commits your staged files with changes to the repository, you should give a descriptive message about the commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Happy Coding 👾
&lt;/h2&gt;

&lt;p&gt;AMA on &lt;a href="https://twitter.com/sasiKdharan" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>Next.js and NextAuth.js</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Fri, 16 Apr 2021 07:47:54 +0000</pubDate>
      <link>https://dev.to/sasicodes/next-js-and-nextauth-js-3ip5</link>
      <guid>https://dev.to/sasicodes/next-js-and-nextauth-js-3ip5</guid>
      <description>&lt;p&gt;Passwordless Email login using the link in NextJs - &lt;a href="https://lagandlog.com/logs/passwordless-email-login-in-nextjs-using-nextauth" rel="noopener noreferrer"&gt;https://lagandlog.com/logs/passwordless-email-login-in-nextjs-using-nextauth&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NextAuth.js is a complete open-source authentication solution for Next.js applications.&lt;/p&gt;

&lt;p&gt;It has built-in support for all sign-in options out there (such as Google, Github, Twitter, etc)&lt;/p&gt;

&lt;p&gt;Supports both JSON Web Tokens and database sessions.&lt;/p&gt;

&lt;h1&gt;
  
  
  Initialization
&lt;/h1&gt;

&lt;p&gt;Create your NextJs project using,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn create next-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The project will be created and the folder structure will looks like,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
.
.
\pages
--\api
--\index.jsx
.
\package.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the next-auth dependency using,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add next-auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a folder called &lt;code&gt;auth&lt;/code&gt; inside &lt;code&gt;/pages/api&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To add NextAuth.js to a project create a file called [...nextauth].js in &lt;code&gt;pages/api/auth&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import NextAuth from 'next-auth'
import Providers from 'next-auth/providers'

export default NextAuth({
  // Configure one or more authentication providers
  providers: [
    Providers.GitHub({
      clientId: process.env.GITHUB_ID,
      clientSecret: process.env.GITHUB_SECRET
    }),
    // ...add more providers here
  ],

  // A database is optional, but required to persist accounts in a database
  database: process.env.DATABASE_URL,
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List of &lt;a href="https://next-auth.js.org/configuration/providers" rel="noopener noreferrer"&gt;other providers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it you have integrated Github authentication in your nextjs application.&lt;/p&gt;

&lt;h1&gt;
  
  
  Default APIs
&lt;/h1&gt;

&lt;p&gt;NextAuth provides various APIs inside the library by default,&lt;/p&gt;

&lt;p&gt;You can handle the current session of the user effectively using &lt;code&gt;next-auth/client&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// server side
import { getSession } from 'next-auth/client'

// client side hook
import { useSession } from 'next-auth/client'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More about &lt;a href="https://next-auth.js.org/getting-started/client" rel="noopener noreferrer"&gt;&lt;code&gt;next-auth/client&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  REST APIs
&lt;/h1&gt;

&lt;p&gt;NextAuth also provides REST APIs out of the box for,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GET /api/auth/signin&lt;/li&gt;
&lt;li&gt;POST /api/auth/signin/:provider&lt;/li&gt;
&lt;li&gt;GET /api/auth/signout&lt;/li&gt;
&lt;li&gt;and &lt;a href="https://next-auth.js.org/getting-started/rest-api" rel="noopener noreferrer"&gt;more&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Includes TypeScript support.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add -D @types/next-auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Works well with and without a database. You can also connect to database ORMs like Prisma.&lt;/p&gt;

&lt;p&gt;Prisma ORM Adaptor - &lt;a href="https://next-auth.js.org/schemas/adapters#prisma-adapter" rel="noopener noreferrer"&gt;view&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learn more at &lt;a href="https://next-auth.js.org" rel="noopener noreferrer"&gt;next-auth.js.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Passwordless Email login using the link in NextJs - &lt;a href="https://lagandlog.com/logs/passwordless-email-login-in-nextjs-using-nextauth" rel="noopener noreferrer"&gt;https://lagandlog.com/logs/passwordless-email-login-in-nextjs-using-nextauth&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it. Hopefully, it'll be useful. If you wish, follow me on &lt;a href="https://twitter.com/sasiKdharan" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>nextauth</category>
    </item>
    <item>
      <title>Flask and .env</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Tue, 09 Mar 2021 14:00:43 +0000</pubDate>
      <link>https://dev.to/sasicodes/flask-and-env-22am</link>
      <guid>https://dev.to/sasicodes/flask-and-env-22am</guid>
      <description>&lt;p&gt;To learn how to dockerize react application visit - &lt;a href="https://lagandlog.com/logs/how-to-dockerize-react-app" rel="noopener noreferrer"&gt;https://lagandlog.com/logs/how-to-dockerize-react-app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;env files allow you to put your environment variables inside a file. It actually looks like,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REDIS_ADDRESS=localhost:6379
MEANING_OF_LIFE=42
MY_SECRET="helloworld"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Creating .env files in your projects help you to manage all secrets or variable in a file and in a secret place. It's not recommended to push the env file to the git repository.&lt;/p&gt;

&lt;p&gt;In our post, we are using the .env file inside the Python Flask application.&lt;/p&gt;

&lt;p&gt;Inside your virtual environment of the project,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install python-dotenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reads the key-value pair from the .env file and adds them to the environment variable. It is great for managing app settings during development and in production using &lt;a href="http://12factor.net/" rel="noopener noreferrer"&gt;12-factor&lt;/a&gt; principles.&lt;/p&gt;

&lt;p&gt;The most common usage consists of calling load_dotenv when the application starts, which will load environment variables from a file named .env in the current directory.&lt;/p&gt;

&lt;p&gt;Create your &lt;strong&gt;.env&lt;/strong&gt; file along-side your settings/config file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── .env
└── config.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside your config file, enter the following lines,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from dotenv import load_dotenv
load_dotenv()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now all your key=value pairs will be loaded into your application. You can use the variable as,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os
SECRET_KEY = os.getenv("MY_SECRET")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it you can now create .env file and use it across the flask application.&lt;/p&gt;

&lt;p&gt;To learn how to dockerize react application visit - &lt;a href="https://lagandlog.com/logs/how-to-dockerize-react-app" rel="noopener noreferrer"&gt;https://lagandlog.com/logs/how-to-dockerize-react-app&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Happy coding 👾
&lt;/h1&gt;

</description>
      <category>flask</category>
      <category>python</category>
      <category>env</category>
    </item>
    <item>
      <title>Grow yourself by writing!</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Thu, 25 Feb 2021 06:23:51 +0000</pubDate>
      <link>https://dev.to/sasicodes/grow-yourself-by-writing-a71</link>
      <guid>https://dev.to/sasicodes/grow-yourself-by-writing-a71</guid>
      <description>&lt;p&gt;Building an online portfolio is always a tricky part, and having a blog section in it takes a long work.&lt;/p&gt;

&lt;p&gt;Rather than building your own portfolio to promote your articles, only focus on creating quality content, and alongside a beautiful portfolio with all your blogs, works, and contact information that you want to share with the public will be auto built for you. &lt;/p&gt;

&lt;p&gt;Checkout - &lt;a href="https://lagandlog.com/about" rel="noopener noreferrer"&gt;LagandLog&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Write and share your thoughts seamlessly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a collection of your own articles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Share your upcoming articles using a bucket list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow interests and topics.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Grow with your community.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get noticed for promising content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get your own portfolio. (ex - &lt;a href="https://sudo.lglg.me" rel="noopener noreferrer"&gt;https://sudo.lglg.me&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use your own domain for your site.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Completely free to use.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Signup today - &lt;a href="https://lagandlog.com/user/onboard" rel="noopener noreferrer"&gt;https://lagandlog.com/user/onboard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Twitter - &lt;a href="https://twitter.com/lagandlog" rel="noopener noreferrer"&gt;https://twitter.com/lagandlog&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Building in public. Feedbacks appreciated.
&lt;/h3&gt;

</description>
      <category>portfolio</category>
      <category>writing</category>
      <category>bloggers</category>
    </item>
    <item>
      <title>LL Beta is out🎉</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Mon, 15 Feb 2021 18:39:54 +0000</pubDate>
      <link>https://dev.to/lagandlog/ll-beta-is-out-2e72</link>
      <guid>https://dev.to/lagandlog/ll-beta-is-out-2e72</guid>
      <description>&lt;h1&gt;
  
  
  Knowledge sharing needs a simple platform!
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://lagandlog.com" rel="noopener noreferrer"&gt;https://lagandlog.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The easiest way to share knowledge and keep building your portfolio online.&lt;/p&gt;

&lt;p&gt;Rebuild your personal growth with Lag and Log and make use of the following features,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Write and share your thoughts seamlessly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow interests and topics.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Grow with your community.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get noticed for promising content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get your own portfolio. (ex - &lt;a href="https://sudo.lglg.me" rel="noopener noreferrer"&gt;https://sudo.lglg.me&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use your own domain for your site.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Completely free to use.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Start using &lt;a href="https://lagandlog.com/user/onboard" rel="noopener noreferrer"&gt;https://lagandlog.com/user/onboard&lt;/a&gt; and grow yourself by writing.&lt;/p&gt;

</description>
      <category>portfolio</category>
      <category>logs</category>
      <category>articles</category>
      <category>bloggers</category>
    </item>
    <item>
      <title>What is Micro Frontends?</title>
      <dc:creator>Sasidharan</dc:creator>
      <pubDate>Thu, 10 Sep 2020 19:15:12 +0000</pubDate>
      <link>https://dev.to/sasicodes/what-is-micro-frontends-2onb</link>
      <guid>https://dev.to/sasicodes/what-is-micro-frontends-2onb</guid>
      <description>&lt;h2&gt;
  
  
  What is Front End?
&lt;/h2&gt;

&lt;p&gt;A frontend is a software or program that interacts with the application user and delivers the contents and experience based on various logics.&lt;/p&gt;

&lt;p&gt;For any software or application requires a kind of frontend to interact with the business logic and easy to use.&lt;/p&gt;

&lt;p&gt;These applications can be bundled and can be served as a monolithic (single) application for the users.&lt;/p&gt;

&lt;p&gt;Let's move on to the topic:&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Micro Front End?
&lt;/h2&gt;

&lt;p&gt;A micro frontend is an approach of splitting the whole frontend application into loosely coupled "micro apps" which is similar to microservices in the backend.&lt;/p&gt;

&lt;p&gt;The main advantage of using micro-frontends is,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to manage&lt;/li&gt;
&lt;li&gt;Teams with different frontend technologies can work seamlessly.&lt;/li&gt;
&lt;li&gt;It can communicate to any microservice backend with a different database.&lt;/li&gt;
&lt;li&gt;Scale specific micro app based on the need.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These micro apps can communicate with each other by custom events and we can also dynamically inject any micro app into others.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Else?
&lt;/h2&gt;

&lt;p&gt;The deployment of these micro apps may be a little harder and the continuous deployment process should be taken care of.&lt;/p&gt;

&lt;p&gt;Testing individual applications make things harder.&lt;/p&gt;

&lt;p&gt;Creating micro-frontends should be done based on the necessity of the application and not because of your team knows various technologies.&lt;/p&gt;

&lt;p&gt;Thanks. Comment your thoughts below.&lt;/p&gt;

&lt;p&gt;Twitter - &lt;a href="https://twitter.com/sasiKdharan" rel="noopener noreferrer"&gt;https://twitter.com/sasiKdharan&lt;/a&gt;&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>webdev</category>
      <category>sideprojects</category>
    </item>
  </channel>
</rss>
