This project is a boilerplate for creating AI-powered applications using Next.js, Shadcn/ui, OpenAI API, and modern web technologies. It provides a structured foundation for building interactive AI applications.
- TypeScript for static typing
- Next.js 14 for server-side rendering and routing
- Tailwind CSS for styling
- Shadcn/ui for UI components
- OpenAI API for AI-powered features
app/
: Contains the main application codeapi/openai/route.ts
: Handles OpenAI API integration, processes requests, and manages API calls to OpenAIpage.tsx
: Main page component rendering the PetNameGenerator
components/
: Contains reusable React componentsui/
: Contains shadcn/ui componentspetNameGenerator.tsx
: Core component for the Pet Name Generator application
hooks/
:useOpenAI.ts
: Custom hook for OpenAI API interactions
prompts/
:petNamePrompt.ts
: Configuration for pet name generation prompts with structured outputs should use model gpt-4o-2024-08-06 or later
git clone https://github.com/moritzfelipe/next-openai-shadcn-boilerplate.git
cd next-openai-shadcn-boilerplate
npm install
# or
yarn install
# or
pnpm install
# or
bun install
3.3.2 Get your OpenAI API key here
OPENAI_API_KEY=your_openai_api_key
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
3.4.2 Open http://localhost:3000 with your browser to see the result.
4.1.1 Go to v0 and create a UI in the chat until you are happy.
4.1.3 Follow the terminal command provided to add the components to your project. The components are now installed into your project.
4.2.1 Install Cursor from here
"I want to transform this petname generator boilerplate into a recipe app. You need to change and implement the recipe app file @recipe-app.tsx and create a new prompt file for it."
Make sure to use claude-3.5-sonnet and click on the "ctrl+enter codebase" button. It is important to implement the new components and to create a new prompt file for it. Check the promptfile if it is structured correctly. This often causes errors.
4.2.4 Follow the instructions from Cursor. You can click on "Apply" on the top right if you are in the file that cursor wants you to change to directly apply the changes to it.
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
To learn more about the technologies used in this boilerplate:
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out the Next.js deployment documentation for more details.