create-next-with-query-starter
v1.1.0
Published
CLI that scaffolds a Next.js project pre-wired with TanStack Query, Axios, Zod, React Hook Form, idb-keyval, sonner, shadcn/ui. with other helper hooks and functions
Maintainers
Readme
create-next-with-query-starter
A CLI that scaffolds a production-ready Next.js project pre-wired with the stack you actually use — no boilerplate hunting, no manual wiring.
Usage
npx create-next-with-query-starter my-appOr pick a package manager upfront:
npx create-next-with-query-starter my-app --pm pnpm
npx create-next-with-query-starter my-app --pm npm
npx create-next-with-query-starter my-app --pm yarn
npx create-next-with-query-starter my-app --pm bunWhat you get
Stack
| Category | Package | | ------------- | --------------------------------------------- | | Framework | Next.js (App Router, TypeScript, Tailwind v4) | | Data fetching | TanStack Query v5 + Axios | | Forms | React Hook Form + Zod | | UI | shadcn/ui (new-york style) | | Toasts | Sonner | | Auth storage | Cookies / idb-keyval (IndexedDB) |
Generated project structure
my-app/
├── app/
│ ├── layout.tsx # QueryProvider + Toaster wired in
│ ├── globals.css # Tailwind v4 + shadcn CSS variables
│ └── login/
│ └── page.tsx # Working login form (RHF + Zod)
├── api/
│ └── auth.api.ts # Login, logout, reset password hooks
├── services/
│ └── auth.service.ts # Service layer with toast feedback
├── schema/
│ └── auth.validation.ts # Zod schemas for auth forms
├── hooks/
│ ├── useDebounce.ts
│ └── useCreateQueryString.ts
├── helpers/
│ └── index.ts # Token storage, formatters, extractErrorMsg
├── query/
│ ├── api.ts # Axios instance (auth headers + token refresh)
│ ├── queryClient.ts
│ └── QueryProvider.tsx
├── constants/
│ ├── apiRoutes.ts
│ └── config.ts
├── components/
│ ├── ui/
│ │ └── button.tsx # shadcn Button + loading spinner prop
│ └── molecules/
│ └── TextInput.tsx # Label + password toggle input wrapper
├── types/
│ └── global.d.ts
└── .env.local # NEXT_PUBLIC_BASE_URL placeholderAxios instance features
- Attaches cookies with the
withCredentials: trueflag orAuthorization: Bearer <token>to every non-public request - Silent token refresh on 401 using the refresh token
- Auto-redirects to
/loginon failed token refresh
After scaffolding
cd my-app
# Set your API base URL
echo "NEXT_PUBLIC_BASE_URL=https://api.yourapp.com/v1/" > .env.local
# Start dev server
pnpm devLicense
MIT
