36 | ├── .env.example ├── ss.png ├── public └── shuttle.png ├── youtubeThumbnail.png ├── .github └── FUNDING.yml ├── package.json ├── .gitignore ├── pages ├── api │ └── generate.js ├── index.module.css └── index.js └── README.md /.env.example: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY= 2 | -------------------------------------------------------------------------------- /ss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alisolanki/openai-startup-name-generator/HEAD/ss.png -------------------------------------------------------------------------------- /public/shuttle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alisolanki/openai-startup-name-generator/HEAD/public/shuttle.png -------------------------------------------------------------------------------- /youtubeThumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alisolanki/openai-startup-name-generator/HEAD/youtubeThumbnail.png -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [alisolanki] 4 | custom: [https://www.youtube.com/channel/UCgzz4Kd1YpzxJOkrhf5U_7A/join] 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "openai-quickstart-node", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start" 9 | }, 10 | "dependencies": { 11 | "next": "^12.1.6", 12 | "openai": "^4.26.1", 13 | "react": "17.0.2", 14 | "react-dom": "17.0.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | 21 | # debug 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | # env files 27 | .env 28 | .env.local 29 | .env.development.local 30 | .env.test.local 31 | .env.production.local 32 | -------------------------------------------------------------------------------- /pages/api/generate.js: -------------------------------------------------------------------------------- 1 | import { OpenAI } from "openai"; 2 | 3 | const openai = new OpenAI({ 4 | apiKey: process.env.OPENAI_API_KEY, 5 | }); 6 | 7 | export default async function (req, res) { 8 | if (req.body.openaiApiKey) { 9 | configuration.apiKey = req.body.openaiApiKey; 10 | console.log(configuration.apiKey); 11 | return; 12 | } 13 | const completion = await openai.chat.completions.create({ 14 | model: "gpt-3.5-turbo", 15 | messages: [{ role: 'user', content: generatePrompt(req.body.startup) }], 16 | temperature: 0.6, 17 | }); 18 | console.log(completion.choices[0].message.content); 19 | res.status(200).json({ result: completion.choices[0].message.content }); 20 | } 21 | 22 | function generatePrompt(startup) { 23 | const capitalizedStartup = 24 | startup[0].toUpperCase() + startup.slice(1).toLowerCase(); 25 | return `Suggest three names for an Indian tech startup domain that is run by Genz. 26 | 27 | Domain: Payment gateway 28 | Names: Zoomer Pay, Slay Pay, No Cap Payment 29 | Domain: Clothing brands 30 | Names: Drip Check, Bussin Wear, Boujee Clothes 31 | Domain: ${capitalizedStartup} 32 | Names:`; 33 | } 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Open AI Startup Name Generator 2 | 3 | [](https://youtu.be/3K1a4quAD7w) 4 | 5 | [](https://youtu.be/3K1a4quAD7w) 6 | 7 | ### Share 8 | - Share your project by mentioning me on: 9 | - Twitter (https://twitter.com/alisolankii) 10 | - LinkedIn (https://linkedin.com/in/alisolanki) 11 | - Instagram (https://instagram.com/alisolankii) 12 | - I'll repost 🍉 13 | 14 | ## Setup 15 | 16 | 1. If you don’t have Node.js installed, [install it from here](https://nodejs.org/en/) 17 | 18 | 2. Clone this repository 19 | 20 | 3. Navigate into the project directory 21 | 22 | ```bash 23 | $ cd openai-quickstart-node 24 | ``` 25 | 26 | 4. Install the requirements 27 | 28 | ```bash 29 | $ npm install 30 | ``` 31 | 32 | 5. Make a copy of the example environment variables file 33 | 34 | ```bash 35 | $ cp .env.example .env 36 | ``` 37 | 38 | 6. Add your [API key](https://beta.openai.com/account/api-keys) to the newly created `.env` file 39 | 40 | 7. Run the app 41 | 42 | ```bash 43 | $ npm run dev 44 | ``` 45 | 46 | You should now be able to access the app at [http://localhost:3000](http://localhost:3000)! For the full context behind this example app, check out the [tutorial](https://beta.openai.com/docs/quickstart). 47 | -------------------------------------------------------------------------------- /pages/index.module.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: "ColfaxAI"; 3 | src: url(https://cdn.openai.com/API/fonts/ColfaxAIRegular.woff2) 4 | format("woff2"), 5 | url(https://cdn.openai.com/API/fonts/ColfaxAIRegular.woff) format("woff"); 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | @font-face { 10 | font-family: "ColfaxAI"; 11 | src: url(https://cdn.openai.com/API/fonts/ColfaxAIBold.woff2) format("woff2"), 12 | url(https://cdn.openai.com/API/fonts/ColfaxAIBold.woff) format("woff"); 13 | font-weight: bold; 14 | font-style: normal; 15 | } 16 | .main, 17 | .main input { 18 | font-size: 16px; 19 | line-height: 24px; 20 | color: #353740; 21 | font-family: "ColfaxAI", Helvetica, sans-serif; 22 | } 23 | .main { 24 | display: flex; 25 | flex-direction: column; 26 | align-items: center; 27 | padding-top: 60px; 28 | } 29 | .main .icon { 30 | width: 34px; 31 | } 32 | .main h3 { 33 | font-size: 32px; 34 | line-height: 40px; 35 | font-weight: bold; 36 | color: #202123; 37 | margin: 16px 0 40px; 38 | } 39 | .main form { 40 | display: flex; 41 | flex-direction: column; 42 | width: 320px; 43 | } 44 | .main input[type="text"] { 45 | padding: 12px 16px; 46 | border: 1px solid #10a37f; 47 | border-radius: 4px; 48 | margin-bottom: 24px; 49 | } 50 | .main ::placeholder { 51 | color: #8e8ea0; 52 | opacity: 1; 53 | } 54 | .main input[type="submit"] { 55 | padding: 12px 0; 56 | color: #fff; 57 | background-color: #10a37f; 58 | border: none; 59 | border-radius: 4px; 60 | text-align: center; 61 | cursor: pointer; 62 | } 63 | .main .result { 64 | font-weight: bold; 65 | margin-top: 40px; 66 | } 67 | 68 | .footer { 69 | padding-top: 2em; 70 | align-items: center; 71 | text-align: center; 72 | } 73 | 74 | .footer a { 75 | color: rgb(157, 0, 255); 76 | text-decoration: none; 77 | } 78 | -------------------------------------------------------------------------------- /pages/index.js: -------------------------------------------------------------------------------- 1 | import Head from "next/head"; 2 | import { useState } from "react"; 3 | import styles from "./index.module.css"; 4 | 5 | export default function Home() { 6 | const [startupInput, setStartupInput] = useState(""); 7 | const [openaiApiKey, setOpenaiApiKey] = useState(""); 8 | const [result, setResult] = useState(); 9 | 10 | async function onSubmit(event) { 11 | event.preventDefault(); 12 | const response = await fetch("/api/generate", { 13 | method: "POST", 14 | headers: { 15 | "Content-Type": "application/json", 16 | }, 17 | body: JSON.stringify({ 18 | startup: startupInput, 19 | openaiApiKey: openaiApiKey, 20 | }), 21 | }); 22 | const data = await response.json(); 23 | setResult(data.result); 24 | setStartupInput(""); 25 | } 26 | 27 | return ( 28 |
36 |