Skip to content

CalamityAdam/openai-express-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI Express Boilerplate 🚀

A simple Express.js server integrated with the OpenAI API.

Getting Started 🏁

  1. Clone the repository
  2. Install dependencies with npm install
  3. Set up your .env file with your OpenAI API key and port number
    • note: add .env to .gitignore immediately as to not compromise your private API keys
  4. Start the development server with npm run dev

Features ✨

  • Express.js server with logging middleware
  • OpenAI API integration for text completion
  • Static file serving for a simple front-end
  • Tailwind CSS for styling
  • Nodemon and Tailwind watch mode for development

Project Structure 🏗️

  • server.js: The Express server
  • public: The directory for static files
    • index.html: The front-end HTML
    • index.js: The front-end JavaScript
    • index.css: The CSS (just initializing TailwindCSS)

ChatGPT Prompt 🤖

Generate the boilerplate for a Node.js Express.js server integrated with the OpenAI API. The server includes morgan as a logging middleware, serves static files, and exposes a JSON API for text completion. The project uses vanilla HTML, JavaScript, and Tailwind CSS, with scripts for development and production in package.json. The front-end includes a form to submit prompts to the API, and the server's responses are displayed on the page. The project uses a public directory for static files and dotenv for environment variables. Also, remember to include a README with detailed instructions

About

GPT-4 chat bot boilerplate w/ express.js node server serving static files with an openai integration

Resources

Stars

Watchers

Forks

Contributors