A feature-rich starter template combining Next.js, Shadcn UI, TanStack Table, and more.
- ⚡️ Next.js 14 with App Router
- ⚛️ React 18
- 🎨 Shadcn UI Components
- 📊 TanStack Table v8
- 🎯 TypeScript
- 💨 Tailwind CSS 3
- 🌙 Dark Mode Support
- 🔒 AWS Amplify Authentication
- 📱 Fully Responsive Design
- 🔐 AWS Amplify Integration
- User Registration & Login
- Social Sign-in Options
- Password Reset Flow
- Protected Routes
- Session Management
- JWT Token Handling
-
🎯 Pre-built Shadcn UI Components
- Buttons, Inputs, Cards
- Modals, Sheets, Dropdowns
- Forms, Alerts, Badges
- Calendar, OTP Input
- And many more...
-
📊 Advanced Data Table
- Sorting & Filtering
- Pagination
- Column Visibility Toggle
- Search Functionality
- Custom Cell Rendering
- Responsive Design
- 📏 ESLint & Prettier Configuration
- 🃏 Jest Testing Setup
- 📈 Absolute Imports
- 🐶 Husky & Lint Staged
- 🤖 Conventional Commits
- 👷 GitHub Actions
- 🗺 Automatic Sitemap Generation
# Clone the repository
git clone [your-repo-url]
# Install dependencies
pnpm install
# Start development server
pnpm dev
├── src/
│ ├── app/ # Next.js App Router
│ ├── components/
│ │ ├── ui/ # Shadcn UI Components
│ │ │ ├── data-table/ # TanStack Table Components
│ │ │ └── ... # Other UI Components
│ ├── lib/ # Utility Functions
│ └── styles/ # Global Styles
├── public/ # Static Files
└── ...
pnpm dev
: Start development serverpnpm build
: Build for productionpnpm start
: Start production serverpnpm lint
: Run ESLintpnpm test
: Run tests
The data table component is built on top of TanStack Table and provides:
- Sorting: Click column headers to sort
- Filtering: Use the search box to filter records
- Pagination: Navigate through large datasets
- Column Management: Toggle column visibility
- Responsive: Works on all screen sizes
Example usage:
import { DataTable } from '@/components/ui/data-table/data-table';
// Define your columns
const columns = [
{
accessorKey: 'id',
header: 'ID',
},
// ... more columns
];
// Your data
const data = [
{
id: 1,
// ... more fields
},
];
// Use the component
<DataTable columns={columns} data={data} searchKey='email' />;
The template includes a built-in theme system with light and dark mode support:
- Automatic system preference detection
- Manual theme switching
- Persistent theme selection
- 🚀 Apollo Client Setup
- Server-side Operations
- Client-side Operations
- Automatic Auth Token Handling
- Role-based Access Control
The project uses a dual-client architecture for GraphQL operations:
-
Server-side Client (
lib/apollo/server-graphql-client.ts
)- Used in server components and server actions
- Automatically includes auth tokens from middleware
- Handles secure mutations and queries
- Example usage:
import { serverClient } from '@/lib/apollo/server-graphql-client'; export async function serverAction() { const result = await serverClient.query({ query: YOUR_QUERY, variables: { ... } }); }
-
Client-side Client (
lib/graphql-client.ts
)- Used in React components with Apollo hooks
- Fetches auth tokens via secure API endpoint
- Supports real-time updates and caching
- Example usage:
import { useQuery } from '@apollo/client'; export function Component() { const { data, loading } = useQuery(YOUR_QUERY); }
- Middleware validates requests and sets auth headers
- Server-side: Headers are directly accessed
- Client-side: Auth tokens fetched via
/api/auth/token
- GraphQL requests include proper Hasura headers
Required environment variables for Hasura:
NEXT_PUBLIC_HASURA_GRAPHQL_URL=your-hasura-endpoint
NEXT_PUBLIC_HASURA_ADMIN_SECRET=your-hasura-admin-secret
- Add Form Validation Examples
- Add API Route Examples
- Add E2E Testing
- Add More Complex Table Examples
- Add Dashboard Layout
- Add Chart Components
- Add More Documentation
This template was originally forked from ts-nextjs-tailwind-starter by Theodorus Clarence. We've built upon his excellent foundation to create this enhanced version with Shadcn UI and TanStack Table integration.