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.
๐ 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
Option 1: Create with CLI (Recommended)
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:
Project Name: Enter a name for your project (e.g.,
my-awesome-app
)Package Manager: Choose your preferred package manager:
bun
(Recommended for speed)npm
(Most common)yarn
(Alternative to npm)pnpm
(Fast, disk-space efficient)
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). Forpnpm
oryarn
, 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:
- Removes the
.next
directory - Reinstalls dependencies without using cache
- 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
Click Use this template on GitHub.
Name your new repository.
Click
Create repository
.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 GitHub | LinkedIn | Email |
![]() Eyachir Arafat GitHub | LinkedIn | Portfolio |
![]() Md Amzad Hossain GitHub | LinkedIn | Email |
![]() 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.