lesenelir / next-gpt

The ChatGPT project built with Next.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

next-GPT

If this project has been helpful to you, I would sincerely appreciate it if you could star it. Your small gesture would mean a lot to me and serve as a great source of encouragement, letting me know I'm on the right track. 🤩

This is a Next.js project that utilizes GPT for text generation, with a focus on learning and educational purposes.

If you want to learn more about the implementation of typewriter and home page animations, please refer to the Type repository. 🍭

Introduction

This project serves as a valuable learning experience for me, specifically focusing on mastering Next.js Pages Router instead of Next.js App Router. Additionally, I am utilizing this project to gain proficiency in building applications with Next.js and Tailwind CSS. Furthermore, the entire project uses TypeScript to enhance code quality and maintainability.

Tech Stack: Next.js (Pages Router) + React + TypeScript + Tailwind CSS + Prisma + MySQL

project gif

Features

  • Website UI/UX accomplished with Tailwindcss

    • Website components (Menu, Chat, etc.)
    • Dark mode and Light mode
    • Mobile support
    • I18n Internationalization
    • Home page animation
      • To see the most accurate animation implementation, visit the Type repository. Highly recommended :)
    • Markdown converted to html string and styled it
  • GPT-3 API integration

  • Database integration

    • MySQL
    • Database tables
    • Backend APIs for data persistence
  • Login authentication

( In this project, I use an OpenAI API Key as a user. )

Run

  • Get the repository code
git clone git@github.com:lesenelir/next-gpt.git
  • Installing dependencies
npm i
  • Create a .env file in the root directory and add the following code

If you don't have an OpenAI API key, you can get one here.

OPENAI_API_KEY=Your_OpenAI_API_Key
DATABASE_URL='mysql://root:Your_Local_MySQL_PassWord@localhost:3306/(Your_Local_Database)'
  • Prisma Migrate

Once you are connected to the local database, please proceed with the database migration to create tables.

npx prisma migrate dev
  • Run
npm run dev

Deploy

This project will be deployed on Vercel and utilize PlanetScale to store relevant data.

You can also run this project in your local environment. The data will be stored in the local database.

Screenshots

  • Home Page

home page pc

  • Chat Page

chat page pc

  • Chat with code

chat with code

Browser Support

Chrome is the recommended browser for local development

Modern browsers are supported, IE not supported

IEIE  EdgeEdge FirefoxFirefox ChromeChrome SafariSafari
not support last 2 versions last 2 versions last 2 versions last 2 versions

MIT License

MIT License

Copyright (c) 2023 Lesenelir <hi@lesenelir.me>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

The ChatGPT project built with Next.js

License:MIT License


Languages

Language:TypeScript 94.6%Language:JavaScript 3.3%Language:CSS 2.1%