<?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>Forem: Chima Ogudoro</title>
    <description>The latest articles on Forem by Chima Ogudoro (@orlando70).</description>
    <link>https://forem.com/orlando70</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%2F1003273%2F584a77a8-949f-475c-bedc-ff8dde40b830.jpg</url>
      <title>Forem: Chima Ogudoro</title>
      <link>https://forem.com/orlando70</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/orlando70"/>
    <language>en</language>
    <item>
      <title>Unlock Faster Performance: A Beginner's Guide to Using Redis for Database Caching</title>
      <dc:creator>Chima Ogudoro</dc:creator>
      <pubDate>Sun, 15 Jan 2023 18:38:14 +0000</pubDate>
      <link>https://forem.com/orlando70/unlock-faster-performance-a-beginners-guide-to-using-redis-for-database-caching-4bci</link>
      <guid>https://forem.com/orlando70/unlock-faster-performance-a-beginners-guide-to-using-redis-for-database-caching-4bci</guid>
      <description>&lt;p&gt;When it comes to web development, speed and scalability are crucial for providing a seamless user experience. One way to improve the performance of a web application is by implementing a caching system. Caching stores frequently accessed data in a fast storage system, allowing for quick retrieval the next time the data is needed, without having to hit the database. &lt;/p&gt;

&lt;p&gt;In this article, we will dive into Redis, an in-memory data structure store that can be used as a cache, database, and message broker. We will explore the benefits of using Redis for database caching, including setup and integration with a web application. By the end of this article, you will have the knowledge and tools to unlock lightning-fast performance for your website.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-requisite
&lt;/h2&gt;

&lt;p&gt;Before diving into the world of Redis and its benefits for database caching, it's important to note that this guide assumes that you already have Node.js, Redis, and MySQL installed on your computer. If you don't have these software programs installed, please follow these links to download and install them:&lt;br&gt;
-&lt;a href="https://nodejs.org/en/download/"&gt;Node.js&lt;/a&gt;&lt;br&gt;
-&lt;a href="https://redis.io/download"&gt;Redis&lt;/a&gt;&lt;br&gt;
-&lt;a href="https://dev.mysql.com/downloads/mysql/"&gt;MySQL&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once these prerequisites are installed, you're ready to follow along with the rest of the article.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Redis is not currently compatible with Windows operating systems. To use Redis on Windows, you must install Windows Subsystem for Linux (WSL) either by downloading it from Microsoft Store or following the instructions &lt;a href="https://learn.microsoft.com/en-us/windows/wsl/install"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  What we’ll learn
&lt;/h2&gt;

&lt;p&gt;Database caching is effective when dealing with data that is frequently accessed. In this example, we would use caching to make our API calls faster. We'll achieve this by saving the user's information to Redis when they log in and use that saved information for subsequent API calls instead of getting it again. &lt;/p&gt;

&lt;p&gt;To simplify the process, we will not be implementing a full authentication system. Instead, we would hardcode the ID of an existing user record in a &lt;code&gt;users&lt;/code&gt; table I have previously created.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;To start a new Node.js project using npm, you can use the &lt;code&gt;npm init&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Open a terminal or command prompt in the directory where you want to create your project.&lt;/p&gt;

&lt;p&gt;Run the command below to start the initialization process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will prompt you to enter information about your project, such as the name, version, and description. You can press enter to accept the default values or enter your own.&lt;/p&gt;

&lt;p&gt;Once you have entered all of the required information, npm will create a package.json file in your project directory. This file contains all of the information you entered, as well as the dependencies and scripts for your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Redis setup
&lt;/h2&gt;

&lt;p&gt;Before starting this tutorial, you need to have Redis installed on your local environment. You can follow the installation guides for your specific platform to do this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://phoenixnap.com/kb/install-redis-on-mac"&gt;Installation for Mac&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04"&gt;Installation for Ubuntu&lt;/a&gt;&lt;br&gt;
&lt;a href="https://redis.com/blog/redis-on-windows-10/"&gt;Installation for Windows&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we add a start script in the &lt;code&gt;package.json&lt;/code&gt; file to start running our server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"start": "node src/index.js"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Installing Dependencies
&lt;/h2&gt;

&lt;p&gt;Next, we will install the necessary dependencies needed for our API. To achieve this, on your command line run the code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install express dotenv ioredis mysql2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, we create a directory &lt;code&gt;/src&lt;/code&gt; in our root folder and a file &lt;code&gt;redis.js&lt;/code&gt; in the directory. Inside this file, we add the code below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Redis from 'ioredis';
import mysql from 'mysql2';

export default class DataCache {
    constructor() {
        this.redis = new Redis();
        this.connection = mysql.createConnection({
            host: process.env.DB_HOST,
            user: process.env.DB_USER,
            password: process.env.DB_PASSWORD,
            database: process.env.DB_DATABASE,
        });
    }

    async getUserFromDB(id) {
        return new Promise((resolve, reject) =&amp;gt; {
            this.connection.query(`SELECT * FROM users WHERE id = ${id}`, function (err, results) {
                if (err) {
                    reject(err);
                }
                resolve(results);
            });
        });
    }

    async getUser(id) {
        // session found in cache, send back to caller;
        let data = JSON.parse(await this.redis.get(`data:${id}`));
        if (!data) {
            // session not found in cache, fetch from the database
            data = await this.getUserFromDB(id);
            this.redis.setex(`data:${id}`, 60 * 60 * 1, JSON.stringify(data));
        }
        return data;
    }
}

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

&lt;/div&gt;



&lt;p&gt;Here, we define a class called &lt;code&gt;DataCache&lt;/code&gt;. The class has a constructor that creates a connection to a Redis server and a MySQL server using the database credentials. The class has one method called &lt;code&gt;getUser()&lt;/code&gt;, this method first checks if the data exist in the Redis server and returns it, if it does not exist, it retrieves the data from the MySQL server and store it in the Redis server for one hour before returning it.&lt;/p&gt;

&lt;p&gt;Next, we create another file &lt;code&gt;index.js&lt;/code&gt; in the &lt;code&gt;/src&lt;/code&gt; directory. This would be the entry file of our API&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import express from 'express';
import DataCache from './redis.js';
import env from 'dotenv';

env.config({path: process.env.ENV_FILE_PATH});
const app = express();

app.use(express.urlencoded({ extended: false }));
app.use(express.json());


// A middleware function to check if the user's session is cached in Redis
async function sessionMiddleware(req, res, next) {
    const dataCache = new DataCache();
    let id = "4";
    try {
        const userData = await dataCache.getUser(id);
        req.session = userData[0];
        next();
    } catch (err) {
        console.log(err);
        res.status(500).send("Error while trying to retrieve session from cache");
    }
}

// Use the middleware in a route
app.use("/login", sessionMiddleware, function (req, res) {
    // console.log(req.session);
    res.send(req.session.email + " Logged in");
});

app.listen(5000, console.log('Server is running...'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we would create a middleware function called &lt;code&gt;sessionMiddleware&lt;/code&gt;. The function creates a new DataCache instance and uses its getUser method to get the user data by passing the user's id, which is hardcoded as 4 in this case. Typically, this id can be gotten by decoding the jwt token sent with in the authorization header.&lt;/p&gt;

&lt;p&gt;Next, we run start server by running&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should get a &lt;code&gt;Server is running…&lt;/code&gt; message logged on your console&lt;/p&gt;

&lt;p&gt;Now, to test our application, we would make a GET request to the &lt;code&gt;/login&lt;/code&gt; endpoint.&lt;/p&gt;

&lt;p&gt;A comparison of the initial request, which queries the database for user information, shows a response time of 382 milliseconds..&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mKgZeBx_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n84ikptyv15c1lfsmzb7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mKgZeBx_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n84ikptyv15c1lfsmzb7.png" alt="database response time" width="880" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, when the same request is sent again, the response time is significantly reduced to 22 milliseconds! This is a 17X improvement in speed!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lTgRz_YD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y5sxkqee9s9mvi34vsig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lTgRz_YD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y5sxkqee9s9mvi34vsig.png" alt="redis response time" width="880" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By including the &lt;code&gt;sessionMiddleware&lt;/code&gt; function in subsequent authenticated requests, user data will be retrieved from cache, which will make our API faster. &lt;/p&gt;

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

&lt;p&gt;Redis is a powerful tool that can improve the performance of your application by caching frequently accessed data. This article provided a beginner's guide on how to use Redis for database caching, including how it works, benefits, and implementation steps. Redis should be used to complement your main data storage, not replace it. With the right approach, Redis can help to improve the performance of your application and user experience.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>redis</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>NextJS + GPT-3: Build a cover letter generator</title>
      <dc:creator>Chima Ogudoro</dc:creator>
      <pubDate>Sat, 07 Jan 2023 07:29:02 +0000</pubDate>
      <link>https://forem.com/orlando70/nextjs-gpt-3-build-a-cover-letter-generator-28gc</link>
      <guid>https://forem.com/orlando70/nextjs-gpt-3-build-a-cover-letter-generator-28gc</guid>
      <description>&lt;p&gt;Learn how to build a cover letter generator. This app would generate a cover letter based on your skills and experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;In this article, we will learn how to use GPT-3 (short for "Generative Pre-trained Transformer 3") in a simple way to create cover letters. OpenAI has developed a powerful language processing tool. It can be used to generate human-like text by predicting the next word in a sequence based on the context of the input.&lt;br&gt;
To use GPT-3 for cover letter generation, you will need to provide it with some input. This can include information about the job you are applying for, your experience and skills, and any other information you want to include. Based on this input, the GPT-3 model will generate a cover letter.&lt;br&gt;
One benefit of GPT-3 for cover letter generation is that it can save you time and effort. Instead of spending hours writing the perfect cover letter, you can use GPT-3 and let it do the work for you. Additionally, GPT-3 can produce highly personalized and professional-sounding cover letters that are tailored to the specific job you are applying for.&lt;br&gt;
Overall, using GPT-3 for cover letter generation can be a valuable tool to increase your chances of landing an interview and streamline the job application.&lt;/p&gt;
&lt;h3&gt;
  
  
  What we’ll cover
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Creating the NextJs app.&lt;/li&gt;
&lt;li&gt;Getting GPT-3 API keys from OpenAI&lt;/li&gt;
&lt;li&gt;Adding GPT-3 API functionality on our React app&lt;/li&gt;
&lt;li&gt;Writing optimal GPT-3 prompts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The source code for the final version can be found &lt;a href="https://github.com/orlando70/cover-letter-generator" rel="noopener noreferrer"&gt;here&lt;/a&gt;. You can also check out the live &lt;a href="https://cover-letter-generator-alpha.vercel.app/" rel="noopener noreferrer"&gt;demo&lt;/a&gt;!&lt;/p&gt;
&lt;h3&gt;
  
  
  Setup
&lt;/h3&gt;

&lt;p&gt;The easiest way to get started with a NextJS project is to use the create-next-app template. It allows you to start building a new NextJS app quickly, without having to set up a build configuration yourself.&lt;/p&gt;

&lt;p&gt;To get started, open your command line and run the code below&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-next-app cover-letter-generator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;cover-letter-generator&lt;/em&gt; in the command above is the folder name of our project. You can choose any name of your choice.&lt;/p&gt;

&lt;p&gt;Alternatively, You can use yarn by running&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;This will create a modern structure for a NextJS application and install all necessary dependencies to get your simple app ready.&lt;/p&gt;

&lt;p&gt;After the setup is complete, you will navigate to the newly created folder by running&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd cover-letter-generator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ensure you replace &lt;em&gt;cover-letter-generator&lt;/em&gt; with the folder name you used.&lt;/p&gt;

&lt;p&gt;Now you have to run the command below to check if the setup is successful&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your app should start on a URL in this form &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open it with your browser and you will see a page similar to this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6g03x7ilk1n2904xc1t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6g03x7ilk1n2904xc1t.png" alt="NextJs project home page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Get your API key from OpenAI
&lt;/h3&gt;

&lt;p&gt;To build an app powered by GPT-3, you need access to an API Key from OpenAI.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To get started with OpenAI, open this &lt;a href="https://openai.com/api/" rel="noopener noreferrer"&gt;link&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Click on _Signup _and complete the signup process.&lt;/li&gt;
&lt;li&gt;Next, you will be redirected to the dashboard.&lt;/li&gt;
&lt;li&gt;Click on &lt;em&gt;Personal _and then _View API Keys&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;On the API Keys section, click on &lt;em&gt;Create new secret key&lt;/em&gt; and copy it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To prevent the secret key for calling the OpenAI GPT-3 API from being exposed in the browser, we will create our own API endpoint which will make the actual call to the GPT-3 endpoint.&lt;/p&gt;

&lt;p&gt;To use your OpenAI API key in your project:&lt;/p&gt;

&lt;p&gt;Create a file called &lt;code&gt;.env&lt;/code&gt; in the project directory&lt;/p&gt;

&lt;p&gt;Add the following line to the file, replacing "your-api-key" with your actual API key this way&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OPEN_AI_KEY=your-api-key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure to include &lt;code&gt;.env&lt;/code&gt; in your &lt;code&gt;.gitignore&lt;/code&gt; file before committing your code to a git repository. This will prevent your API key from being publicly exposed, which could lead to misuse and potentially result in your API key being suspended by OpenAI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add dependencies
&lt;/h3&gt;

&lt;p&gt;To continue, you must install the dependencies required for this app. This can be done 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;npm i openai axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we create a file called &lt;code&gt;generate.js&lt;/code&gt; in the pages/api directory. Then, add the following code to the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import { Configuration, OpenAIApi } from 'openai';

export default async function handler(req, res) {
  const { company, experience, skills, name, position } = req.body;

  const configuration = new Configuration({
    apiKey: process.env.OPEN_AI_KEY,
  });

  const openai = new OpenAIApi(configuration);

  const prompt = `Hello, AI! I'm a cover letter writer and I need your help crafting a perfect letter for a job seeker named ${name}. They're applying to work at ${company} as a ${position}, and they have ${experience} years of experience and the following skills: ${skills}. Can you please write a cover letter that highlights their relevant experience and skills, and explains why they're a great fit for the position? Make it engaging and persuasive, but keep it professional. Thanks!`

    const response = await openai.createCompletion({
      prompt,
      temperature: 0.7,
      max_tokens: 1024,
      top_p: 1,
      frequency_penalty: 0,
      presence_penalty: 0,
      model: 'text-davinci-003',
    });

    res.status(200).send(response.data.choices[0].text)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a step by step explanation of the code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We start by importing the Configuration and OpenAIApi components from the openai library.&lt;/li&gt;
&lt;li&gt;Next, we create a new Configuration object and pass in an object containing the API key from our &lt;code&gt;.env&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;We use the Configuration object to create a new instance of the OpenAIApi class.&lt;/li&gt;
&lt;li&gt;We define a prompt string that includes placeholders for the name, company, position, experience, and skills variables. This prompt is a request for the AI to write a cover letter for a job seeker with the provided information.&lt;/li&gt;
&lt;li&gt;We use the createCompletion method from the OpenAIApi instance to generate a response based on the prompt. We pass in an object containing various configuration options such as temperature, max_tokens, and model.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then, we include code in the user interface that will call this API when necessary. The API's output will be displayed to the user through the interface.&lt;/p&gt;

&lt;p&gt;Replace the code from the &lt;code&gt;pages/index.js&lt;/code&gt; with this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import { useState, React } from 'react';
import axios from 'axios';
import Head from 'next/Head';
import styles from "../styles/Home.module.css";

const App = () =&amp;gt; {
  const [formData, setFormData] = useState({
    company: '',
    name: '',
    skills: '',
    position: '',
    experience: ''
  });
  const [result, setResult] = useState('');
  const [isLoading, setIsLoading] = useState(false);
  const [error, setError] = useState(null);

  const handleChange = (e) =&amp;gt; {
    setFormData({
      ...formData,
      [e.target.name]: e.target.value
    });
  }

  const handleSubmit = async (e) =&amp;gt; {
    e.preventDefault();
    setIsLoading(true);
    try {
      const result = await axios.post('/api/generate', formData);
      setResult(result.data);
    } catch (err) {
      setError(err);
    }
    setIsLoading(false);
  }

  const handleCopy = () =&amp;gt; {
    navigator.clipboard.writeText(result);
  }
  return (
    &amp;lt;&amp;gt;
      &amp;lt;Head&amp;gt;
        &amp;lt;title&amp;gt;Generate Cover Letter&amp;lt;/title&amp;gt;
        &amp;lt;meta name="description" content="Generated by create next app" /&amp;gt;
        &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1" /&amp;gt;
      &amp;lt;/Head&amp;gt;
      &amp;lt;div className={styles.container}&amp;gt;
        &amp;lt;div className={styles.wrapper}&amp;gt;
          &amp;lt;header className={styles.header}&amp;gt;
            &amp;lt;p&amp;gt;Generate a &amp;lt;span&amp;gt;Cover Letter&amp;lt;/span&amp;gt; in seconds.&amp;lt;/p&amp;gt;
          &amp;lt;/header&amp;gt;
          &amp;lt;form className={styles.form} onSubmit={handleSubmit}&amp;gt;
            &amp;lt;label&amp;gt;
              Company:
              &amp;lt;input type="text" name="company" value={formData.company} onChange={handleChange} /&amp;gt;
            &amp;lt;/label&amp;gt;
            &amp;lt;br /&amp;gt;
            &amp;lt;label&amp;gt;
              Name:
              &amp;lt;input type="text" name="name" value={formData.name} onChange={handleChange} /&amp;gt;
            &amp;lt;/label&amp;gt;
            &amp;lt;br /&amp;gt;
            &amp;lt;label&amp;gt;
              Position:
              &amp;lt;input type="text" name="position" value={formData.position} onChange={handleChange} /&amp;gt;
            &amp;lt;/label&amp;gt;
            &amp;lt;br /&amp;gt;
            &amp;lt;label&amp;gt;
              Skills:
              &amp;lt;textarea name="skills" value={formData.skills} onChange={handleChange} /&amp;gt;
            &amp;lt;/label&amp;gt;
            &amp;lt;br /&amp;gt;
            &amp;lt;label&amp;gt;
              Years of Experience:
              &amp;lt;input type="number" name="experience" value={formData.experience} onChange={handleChange} /&amp;gt;
            &amp;lt;/label&amp;gt;
            &amp;lt;br /&amp;gt;
            &amp;lt;button className={styles.button} type="submit"&amp;gt;Generate Cover Letter&amp;lt;/button&amp;gt;
            {result &amp;amp;&amp;amp; &amp;lt;button className={styles.button} onClick={handleCopy}&amp;gt;Copy to Clipboard&amp;lt;/button&amp;gt;}
            {isLoading &amp;amp;&amp;amp; &amp;lt;p&amp;gt;Generating cover letter...&amp;lt;/p&amp;gt;}
            {error &amp;amp;&amp;amp; &amp;lt;p&amp;gt;An error occurred: {error.message}&amp;lt;/p&amp;gt;}
            &amp;lt;br /&amp;gt;
            &amp;lt;br /&amp;gt;
            {result &amp;amp;&amp;amp; &amp;lt;p className={styles.result}&amp;gt; {result}&amp;lt;/p&amp;gt;}
          &amp;lt;/form&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/&amp;gt;
  )
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start the development server by running &lt;em&gt;npm run dev&lt;/em&gt; and this would appear&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Figesjx750b799ndgq54y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Figesjx750b799ndgq54y.png" alt="Homepage of cover-letter-generator"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Checkout the complete code on &lt;a href="https://github.com/orlando70/cover-letter-generator" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To quickly generate a cover letter, fill up the form appropriately and click &lt;em&gt;Generate Cover Letter&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;In this article, we have learnt how the integration of Next.js and GPT-3 has resulted in a powerful and user-friendly cover letter generator. By leveraging the advanced language generation capabilities of GPT-3, this tool is able to provide highly personalized cover letter suggestions that can help job seekers stand out in a competitive job market. Overall, this innovative solution has the potential to revolutionize the way that job seekers approach the cover letter writing process, making it easier than ever before to craft a compelling and effective document.&lt;/p&gt;

</description>
      <category>gpt3</category>
      <category>nextjs</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
