JSPM

  • Created
  • Published
  • Downloads 216
  • Score
    100M100P100Q92824F
  • License MIT

A CLI tool to create Next.js TypeScript projects

Package Exports

  • next-ts-app
  • next-ts-app/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (next-ts-app) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Next.js TypeScript Starter Template

A production-ready, scalable, and actively maintained starter template for building high-quality web apps with Next.js, TypeScript, and Tailwind CSS.


next-ts-app version License MIT

Nextjs TypeScript Tailwind CSS ESLint Prettier Husky


๐Ÿš€ Why Use This Template?

This starter template is designed for developers of all levels โ€” from beginners starting their journey to advanced engineers building scalable applications.

Key Features

  • โšก๏ธ Next.js 15+ with App Router
  • โœ… TypeScript โ€“ full type safety and custom config
  • ๐ŸŽจ Tailwind CSS โ€“ preconfigured and responsive
  • ๐Ÿงน ESLint + Prettier โ€“ clean, consistent code
  • ๐Ÿ” Husky + lint-staged โ€“ prevent bad commits
  • ๐ŸŒฟ Scalable folder structure โ€“ production standard
  • ๐Ÿ“ฆ Alias support โ€“ easy path management
  • ๐Ÿงช Ready for unit & integration testing
  • โ˜๏ธ Vercel ready โ€“ just push and deploy

How to Start

Quickly set up your Next.js + TypeScript + TailwindCSS project using the CLI tool:

  • ๐Ÿ“ฆ using npm
    npx next-ts-app my-awesome-app
  • Replace my-awesome-app with your desired project name.
  • The CLI will scaffold a fully configured Next.js + TypeScript + TailwindCSS starter for you.

โœ… Fast | ๐Ÿ”ง Pre-configured | ๐Ÿงช Ready for development


CLI Options

During project creation, you'll be prompted to:

  1. Project Name: Enter a name for your project (e.g., my-awesome-app)

  2. Package Manager: Choose your preferred package manager:

    • bun (Recommended for speed)
    • npm (Most common)
    • yarn (Alternative to npm)
    • pnpm (Fast, disk-space efficient)
  3. Follow the steps shown: For example, if you choose bun:

    cd my-awesome-project
    bun install
    bun run dev

    Note: If you pick bun, make sure Bun is installed (npm install -g bun or visit bun.sh). For pnpm or yarn, install them first if needed.

Available Scripts

The project includes several useful scripts:

# Development
bun run dev          # Start development server with Turbopack
bun run build        # Create production build
bun run start        # Start production server
bun run lint         # Run ESLint
bun run lint:fix     # Fix ESLint errors
bun run format       # Format code with Prettier
bun run format:check # Check code formatting
bun run clear-cache  # Clear Next.js cache, reinstall dependencies, and restart dev server

The clear-cache script is particularly useful when you encounter build issues or need to reset your development environment. It:

  1. Removes the .next directory
  2. Reinstalls dependencies without using cache
  3. Restarts the development server

Prerequisites

  • For Bun: Install via npm install -g bun
  • For pnpm: Install via npm install -g pnpm
  • For Yarn: Install via npm install -g yarn
  • For npm: Comes with Node.js

What's Included

After installation, you'll get:

  • โœ… Next.js 15 with App Router
  • โœ… TypeScript configuration
  • โœ… Tailwind CSS setup
  • โœ… ESLint & Prettier
  • โœ… Git hooks with Husky
  • โœ… Project structure ready to go

Option 2: Use GitHub Template

  1. Click Use this template on GitHub.

  2. Name your new repository.

  3. Click Create repository.

  4. Set up locally:

    git clone https://github.com/[your-username]/[your-repo].git
    cd [your-repo]
    bun install
    bun run dev

Project Structure

public/                      # Public static assets that are served directly
โ”œโ”€โ”€ assets/                  # Static assets directory
โ”‚   โ”œโ”€โ”€ images/             # Image files (png, jpg, svg, etc.)
โ”‚   โ””โ”€โ”€ data/               # Static JSON data files
โ”‚
src/                        # Source code directory
โ”œโ”€โ”€ app/                    # Next.js 13+ App Router directory
โ”‚   โ”œโ”€โ”€ (landing)/         # Landing page route group (optional)
โ”‚   โ”‚   โ”œโ”€โ”€ _components/    # Page-specific components
โ”‚   โ”‚   โ”œโ”€โ”€ error.tsx      # Error boundary for landing page
โ”‚   โ”‚   โ”œโ”€โ”€ loading.tsx    # Loading state for landing page
โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # Landing page entry point
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ (dashboard)/       # Dashboard route group
โ”‚   โ”‚   โ”œโ”€โ”€ _components/    # Dashboard-specific components
โ”‚   โ”‚   โ”œโ”€โ”€ error.tsx      # Error boundary for dashboard
โ”‚   โ”‚   โ”œโ”€โ”€ loading.tsx    # Loading state for dashboard
โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # Dashboard page entry
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout (shared across all pages)
โ”‚   โ”œโ”€โ”€ template.tsx       # Template for per-page layouts
โ”‚   โ””โ”€โ”€ providers.tsx      # Global context providers (Theme, Auth, etc.)
โ”‚
โ”œโ”€โ”€ components/            # Reusable components directory
โ”‚   โ”œโ”€โ”€ ui/               # UI primitives (buttons, inputs, cards)
โ”‚   โ”‚   โ”œโ”€โ”€ button.tsx    # Button component
โ”‚   โ”‚   โ”œโ”€โ”€ input.tsx     # Input component
โ”‚   โ”‚   โ””โ”€โ”€ card.tsx      # Card component
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ layout/           # Layout components
โ”‚   โ”‚   โ”œโ”€โ”€ header.tsx    # Header component
โ”‚   โ”‚   โ”œโ”€โ”€ footer.tsx    # Footer component
โ”‚   โ”‚   โ””โ”€โ”€ sidebar.tsx   # Sidebar component
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ shared/           # Shared components across features
โ”‚   โ”‚   โ”œโ”€โ”€ ThemeToggle.tsx  # Theme toggle component
โ”‚   โ”‚   โ””โ”€โ”€ Analytics.tsx    # Analytics component
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ forms/            # Form-related components
โ”‚   โ”‚   โ”œโ”€โ”€ FormInput.tsx    # Form input component
โ”‚   โ”‚   โ””โ”€โ”€ FormSelect.tsx   # Form select component
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ icons/            # SVG icon components
โ”‚       โ”œโ”€โ”€ index.tsx     # Icon exports
โ”‚       โ””โ”€โ”€ SocialIcons/  # Social media icons
โ”‚
โ”œโ”€โ”€ config/               # Application configuration
โ”‚   โ”œโ”€โ”€ site.ts          # Site metadata and configuration
โ”‚   โ”œโ”€โ”€ routes.ts        # Route definitions and constants
โ”‚   โ””โ”€โ”€ theme.ts         # Theme configuration and tokens
โ”‚
โ”œโ”€โ”€ hooks/               # Custom React hooks
โ”‚   โ”œโ”€โ”€ useAuth.ts       # Authentication hook
โ”‚   โ”œโ”€โ”€ useAnalytics.ts  # Analytics hook
โ”‚   โ”œโ”€โ”€ useDebounce.ts   # Debounce utility hook
โ”‚   โ””โ”€โ”€ useLocalStorage.ts # Local storage hook
โ”‚
โ”œโ”€โ”€ lib/                 # Utility libraries and helpers
โ”‚   โ”œโ”€โ”€ api/            # API client configurations
โ”‚   โ”‚   โ”œโ”€โ”€ axios.ts    # Axios instance and interceptors
โ”‚   โ”‚   โ””โ”€โ”€ trpc/       # tRPC client setup
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ utils/          # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ formatter.ts # Data formatting utilities
โ”‚   โ”‚   โ””โ”€โ”€ validators.ts # Validation utilities
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ constants.ts    # Application constants
โ”‚
โ”œโ”€โ”€ styles/             # Global styles and CSS
โ”‚   โ”œโ”€โ”€ globals.css     # Global CSS styles
โ”‚   โ”œโ”€โ”€ theme/          # Theme variables and tokens
โ”‚   โ””โ”€โ”€ components/     # Component-specific styles
โ”‚
โ”œโ”€โ”€ types/              # TypeScript type definitions
โ”‚   โ”œโ”€โ”€ index.d.ts      # Global type declarations
โ”‚   โ”œโ”€โ”€ next.d.ts       # Next.js type extensions
โ”‚   โ””โ”€โ”€ custom-types.ts # Custom type definitions
โ”‚
โ”œโ”€โ”€ services/           # Business logic and services
โ”‚   โ”œโ”€โ”€ auth.service.ts    # Authentication service
โ”‚   โ””โ”€โ”€ analytics.service.ts # Analytics service
โ”‚
โ”œโ”€โ”€ contexts/           # React Context providers
โ”‚   โ”œโ”€โ”€ ThemeContext.tsx  # Theme context
โ”‚   โ””โ”€โ”€ AuthContext.tsx   # Authentication context
โ”‚
โ””โ”€โ”€ __tests__/         # Test files directory
    โ”œโ”€โ”€ components/     # Component tests
    โ”œโ”€โ”€ hooks/         # Hook tests
    โ”œโ”€โ”€ services/      # Service tests
    โ””โ”€โ”€ utils/         # Utility function tests

Code Quality Tools

These tools keep your code neat:

  • ESLint: Finds code mistakes.
  • Prettier: Formats code nicely.
  • Tailwind CSS: Organizes styles.
  • Husky: Checks code before commits.
  • lint-staged: Runs checks on changed files.

Example rule for imports:

"import/order": [
  "error",
  {
    "groups": ["builtin", "external", "internal"],
    "alphabetize": { "order": "asc" }
  }
]

Deployment

This template works with:

  • Vercel
  • Netlify
  • AWS
  • Docker

Copy .env.example to .env for production settings.

Developer & Contributor

Salman Ahamed
Salman Ahamed
GitHub | LinkedIn | Email
Eyachir Arafat
Eyachir Arafat
GitHub | LinkedIn | Portfolio
Md Amzad Hossain Omor
Md Amzad Hossain
GitHub | LinkedIn | Email
Hasibul Alam
Hasibul Alam
GitHub | LinkedIn | Email

Want to Help?

Check our CONTRIBUTING GUIDE to contribute.

License

Free to use under MIT License. See the LICENSE file for details.