Opinionated starter using the Next.js App Router, shadcn/ui primitives, React Query, and a demo auth flow with persistent sessions.
- Next.js 15 (App Router) with React 19 and TypeScript
- Tailwind CSS 4 (
@tailwindcss/postcss) withtw-animate-css - shadcn/ui (New York style) with
class-variance-authorityandtailwind-merge - React Query (
@tanstack/react-query) for data fetching/caching - React Hook Form + Zod +
@hookform/resolversfor form handling/validation - Axios-based API client with auth header injection and param cleaning
- Icons via
lucide-react
src/app– App Router entries.authroutes useAuthLayoutto redirect authenticated users away;(dashboard)group usesDashboardLayoutto guard access and redirect to login.src/store/index.tsx– wraps the app withQueryClientProviderandAuthProvider.src/store/AuthProvider.tsx– client-side auth state with encrypted localStorage persistence and login/logout helpers exposed throughuseAuth.src/lib/api-client.ts– shared Axios client that injects the stored token and normalizes request params.src/utils– environment helpers and a small XOR-basedLocalStoreencryption wrapper.src/features– page-level features (auth flows, dashboard UI).src/components– shadcn/ui button plus shared form primitives used across features.
- Email/password login powered by React Hook Form + Zod, using React Query mutation to simulate an API call before storing a token/user in localStorage.
- Signup page that provisions a demo token, persists the session, and redirects into the dashboard.
- Protected dashboard that reads the stored user, shows basic session info, and supports logout.
- Gradient-backed auth and dashboard screens styled with Tailwind CSS 4 and Geist fonts.
src/components/ui/button.tsx– shadcn-style button with variants and sizes.src/components/shared/form/TextInput.tsx– text input with label, helper, and error states.src/components/shared/form/PasswordInput.tsx– password field with show/hide toggle.src/components/shared/form/PhoneInput.tsx– tel-optimized input.src/components/shared/form/TextAreaInput.tsx– textarea with label and validation messaging.
Set these in .env (or pass them at runtime):
NEXT_PUBLIC_API_BASE_URL– base URL for the Axios client.NEXT_PUBLIC_ENCRYPTION_KEY– key used byLocalStoreto encrypt auth data (defaults toxanadu-lms-encryption-keyfor local development).
yarn install
yarn dev
# open http://localhost:3000Available scripts:
yarn dev– start the Next.js dev serveryarn build– production buildyarn start– run the built appyarn lint– lint with ESLintyarn format/yarn format:check– format with Prettier
Build and run the production image:
docker build -t nextjs-shadcn .
docker run -p 3000:3000 --env-file .env nextjs-shadcn
# open http://localhost:3000The image uses a multi-stage build (Dockerfile) on node:20-alpine, installs dependencies with Yarn, builds the Next.js app, installs production dependencies in the final stage, and serves with yarn start.