Skip to content

Next.js starter with Tailwind, shadcn/ui, Vitest, React Testing Library and Playwright. Ideal for your next hackathon or billion-dollar startup. πŸš€ Aiming for 100% test coverage too.

Notifications You must be signed in to change notification settings

IgorKrupenja/nextjs-starter

Repository files navigation

Next.js

⚠️ Warning: This tool is a work in progress, there are a couple of issues that will be addressed in the nearest future.

Next.js starter/boilerplate project with the following:

The project has a few example pages and route handlers with tests, including a simple AI chat bot example, made with OpenAI Node API Library and Vercel AI SDK. You can delete these if you don't need them.

Installation

  1. Make sure you have Node.js 20 installed.

  2. Install pnpm.

    corepack enable
    corepack prepare pnpm@latest --activate
  3. Create a new project from this template.

    pnpm dlx degit IgorKrupenja/nextjs-starter my-billion-dollar-startup
  4. Install dependencies.

    cd my-billion-dollar-startup
    pnpm install
  5. If you want to use the chat bot example, create .env.local file and add your OpenAI API key to that file.

    touch .env.local
    echo "OPENAI_API_KEY=your-api-key" >> .env.local

Running

pnpm dev

Testing

The starter project aims to have near-100% test coverage. Note that components inside src/components/ui are created by the external shadcn-ui library and are thus not in scope for testing. You can run unit tests with:

pnpm test

And to check coverage:

pnpm test:coverage

The project also has Playwright set up for end-to-end tests, run with:

pnpm test:e2e

CI

The project has GitHub Actions set up to run linter, formatter and tests. It runs on pushes to the main branch and pull requests that are not in draft status.

Deployment

The easiest way would be to deploy to Vercel. No special configuration is needed except adding your OpenAI API key as a variable there.

Structure

Inside the src folder:

src
β”œβ”€β”€ app # App layout and homepage with chat bot example
β”‚   β”œβ”€β”€ api
β”‚   β”‚   β”œβ”€β”€ chat # Sample route handler for chat bot
β”‚   β”‚   └── feedback # Sample route handler for form
β”‚   └── feedback # Sample page with form
β”œβ”€β”€ components # Components grouped by pages
β”‚   β”œβ”€β”€ chat
β”‚   β”œβ”€β”€ common
β”‚   β”œβ”€β”€ feedback
β”‚   └── ui # Re-usable components from shadcn-ui
β”œβ”€β”€ declarations # TypeScript declarations, add types for .env variables here
β”œβ”€β”€ e2e # Playwright end-to-end tests
β”œβ”€β”€ interfaces
β”œβ”€β”€ lib # Misc utilities
β”œβ”€β”€ schemas # Zod schemas used for form and API validation
β”œβ”€β”€ styles # shadcn-ui base config
└── test # Vitest setup and utils

To do

About

Next.js starter with Tailwind, shadcn/ui, Vitest, React Testing Library and Playwright. Ideal for your next hackathon or billion-dollar startup. πŸš€ Aiming for 100% test coverage too.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published