├── .env.example ├── .gitignore ├── .vscode └── settings.json ├── LICENSE.md ├── README.md ├── app ├── (dashboard) │ ├── actions.ts │ ├── customers │ │ └── page.tsx │ ├── error.tsx │ ├── layout.tsx │ ├── nav-item.tsx │ ├── page.tsx │ ├── product.tsx │ ├── products-table.tsx │ ├── providers.tsx │ ├── search.tsx │ └── user.tsx ├── api │ ├── auth │ │ └── [...nextauth] │ │ │ └── route.ts │ └── seed │ │ └── route.ts ├── favicon.ico ├── globals.css ├── layout.tsx └── login │ └── page.tsx ├── components.json ├── components ├── icons.tsx └── ui │ ├── badge.tsx │ ├── breadcrumb.tsx │ ├── button.tsx │ ├── card.tsx │ ├── dropdown-menu.tsx │ ├── input.tsx │ ├── sheet.tsx │ ├── table.tsx │ ├── tabs.tsx │ └── tooltip.tsx ├── lib ├── auth.ts ├── db.ts └── utils.ts ├── middleware.ts ├── next.config.ts ├── package.json ├── pnpm-lock.yaml ├── postcss.config.js ├── public ├── placeholder-user.jpg └── placeholder.svg ├── tailwind.config.ts └── tsconfig.json /.env.example: -------------------------------------------------------------------------------- 1 | # https://vercel.com/docs/storage/vercel-postgres 2 | POSTGRES_URL= 3 | 4 | NEXTAUTH_URL=http://localhost:3000 5 | AUTH_SECRET= # https://generate-secret.vercel.app/32 6 | 7 | # https://authjs.dev/getting-started/providers/github 8 | AUTH_GITHUB_ID= 9 | AUTH_GITHUB_SECRET= -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # env files 29 | .env* 30 | !.env.example 31 | 32 | # vercel 33 | .vercel 34 | 35 | # typescript 36 | *.tsbuildinfo 37 | next-env.d.ts 38 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib", 3 | "typescript.enablePromptUseWorkspaceTsdk": true 4 | } 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2025 Vercel, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
Next.js 15 Admin Dashboard Template
2 |
Built with the Next.js App Router
3 |
4 |
5 | Demo 6 | · 7 | Clone & Deploy 8 | 9 |
10 | 11 | ## Overview 12 | 13 | This is a starter template using the following stack: 14 | 15 | - Framework - [Next.js (App Router)](https://nextjs.org) 16 | - Language - [TypeScript](https://www.typescriptlang.org) 17 | - Auth - [Auth.js](https://authjs.dev) 18 | - Database - [Postgres](https://vercel.com/postgres) 19 | - Deployment - [Vercel](https://vercel.com/docs/concepts/next.js/overview) 20 | - Styling - [Tailwind CSS](https://tailwindcss.com) 21 | - Components - [Shadcn UI](https://ui.shadcn.com/) 22 | - Analytics - [Vercel Analytics](https://vercel.com/analytics) 23 | - Formatting - [Prettier](https://prettier.io) 24 | 25 | This template uses the new Next.js App Router. This includes support for enhanced layouts, colocation of components, tests, and styles, component-level data fetching, and more. 26 | 27 | ## Getting Started 28 | 29 | During the deployment, Vercel will prompt you to create a new Postgres database. This will add the necessary environment variables to your project. 30 | 31 | Inside the Vercel Postgres dashboard, create a table based on the schema defined in this repository. 32 | 33 | ``` 34 | CREATE TYPE status AS ENUM ('active', 'inactive', 'archived'); 35 | 36 | CREATE TABLE products ( 37 | id SERIAL PRIMARY KEY, 38 | image_url TEXT NOT NULL, 39 | name TEXT NOT NULL, 40 | status status NOT NULL, 41 | price NUMERIC(10, 2) NOT NULL, 42 | stock INTEGER NOT NULL, 43 | available_at TIMESTAMP NOT NULL 44 | ); 45 | ``` 46 | 47 | Then, uncomment `app/api/seed.ts` and hit `http://localhost:3000/api/seed` to seed the database with products. 48 | 49 | Next, copy the `.env.example` file to `.env` and update the values. Follow the instructions in the `.env.example` file to set up your GitHub OAuth application. 50 | 51 | ```bash 52 | npm i -g vercel 53 | vercel link 54 | vercel env pull 55 | ``` 56 | 57 | Finally, run the following commands to start the development server: 58 | 59 | ``` 60 | pnpm install 61 | pnpm dev 62 | ``` 63 | 64 | You should now be able to access the application at http://localhost:3000. 65 | -------------------------------------------------------------------------------- /app/(dashboard)/actions.ts: -------------------------------------------------------------------------------- 1 | 'use server'; 2 | 3 | import { deleteProductById } from '@/lib/db'; 4 | import { revalidatePath } from 'next/cache'; 5 | 6 | export async function deleteProduct(formData: FormData) { 7 | // let id = Number(formData.get('id')); 8 | // await deleteProductById(id); 9 | // revalidatePath('/'); 10 | } 11 | -------------------------------------------------------------------------------- /app/(dashboard)/customers/page.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | Card, 3 | CardContent, 4 | CardDescription, 5 | CardHeader, 6 | CardTitle 7 | } from '@/components/ui/card'; 8 | 9 | export default function CustomersPage() { 10 | return ( 11 | 12 | 13 | Customers 14 | View all customers and their orders. 15 | 16 | 17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /app/(dashboard)/error.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import { useEffect } from 'react'; 4 | 5 | export default function Error({ 6 | error, 7 | reset 8 | }: { 9 | error: Error & { digest?: string }; 10 | reset: () => void; 11 | }) { 12 | useEffect(() => { 13 | // Log the error to an error reporting service 14 | console.error(error); 15 | }, [error]); 16 | 17 | return ( 18 |
19 |
20 |

21 | Please complete setup 22 |

23 |

24 | Inside the Vercel Postgres dashboard, create a table based on the 25 | schema defined in this repository. 26 |

27 |
28 |           
29 |             {`CREATE TABLE users (
30 |   id SERIAL PRIMARY KEY,
31 |   email VARCHAR(255) NOT NULL,
32 |   name VARCHAR(255),
33 |   username VARCHAR(255)
34 | );`}
35 |           
36 |         
37 |

Insert a row for testing:

38 |
39 |           
40 |             {`INSERT INTO users (id, email, name, username) VALUES (1, 'me@site.com', 'Me', 'username');`}
41 |           
42 |         
43 |
44 |
45 | ); 46 | } 47 | -------------------------------------------------------------------------------- /app/(dashboard)/layout.tsx: -------------------------------------------------------------------------------- 1 | import Link from 'next/link'; 2 | import { 3 | Home, 4 | LineChart, 5 | Package, 6 | Package2, 7 | PanelLeft, 8 | Settings, 9 | ShoppingCart, 10 | Users2 11 | } from 'lucide-react'; 12 | 13 | import { 14 | Breadcrumb, 15 | BreadcrumbItem, 16 | BreadcrumbLink, 17 | BreadcrumbList, 18 | BreadcrumbPage, 19 | BreadcrumbSeparator 20 | } from '@/components/ui/breadcrumb'; 21 | import { Button } from '@/components/ui/button'; 22 | import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'; 23 | import { 24 | Tooltip, 25 | TooltipContent, 26 | TooltipTrigger 27 | } from '@/components/ui/tooltip'; 28 | import { Analytics } from '@vercel/analytics/react'; 29 | import { User } from './user'; 30 | import { VercelLogo } from '@/components/icons'; 31 | import Providers from './providers'; 32 | import { NavItem } from './nav-item'; 33 | import { SearchInput } from './search'; 34 | 35 | export default function DashboardLayout({ 36 | children 37 | }: { 38 | children: React.ReactNode; 39 | }) { 40 | return ( 41 | 42 |
43 | 44 |
45 |
46 | 47 | 48 | 49 | 50 |
51 |
52 | {children} 53 |
54 |
55 | 56 |
57 |
58 | ); 59 | } 60 | 61 | function DesktopNav() { 62 | return ( 63 | 108 | ); 109 | } 110 | 111 | function MobileNav() { 112 | return ( 113 | 114 | 115 | 119 | 120 | 121 | 165 | 166 | 167 | ); 168 | } 169 | 170 | function DashboardBreadcrumb() { 171 | return ( 172 | 173 | 174 | 175 | 176 | Dashboard 177 | 178 | 179 | 180 | 181 | 182 | Products 183 | 184 | 185 | 186 | 187 | All Products 188 | 189 | 190 | 191 | ); 192 | } 193 | -------------------------------------------------------------------------------- /app/(dashboard)/nav-item.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import { 4 | Tooltip, 5 | TooltipContent, 6 | TooltipTrigger 7 | } from '@/components/ui/tooltip'; 8 | import clsx from 'clsx'; 9 | import Link from 'next/link'; 10 | import { usePathname } from 'next/navigation'; 11 | 12 | export function NavItem({ 13 | href, 14 | label, 15 | children 16 | }: { 17 | href: string; 18 | label: string; 19 | children: React.ReactNode; 20 | }) { 21 | const pathname = usePathname(); 22 | 23 | return ( 24 | 25 | 26 | 35 | {children} 36 | {label} 37 | 38 | 39 | {label} 40 | 41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /app/(dashboard)/page.tsx: -------------------------------------------------------------------------------- 1 | import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; 2 | import { File, PlusCircle } from 'lucide-react'; 3 | import { Button } from '@/components/ui/button'; 4 | import { ProductsTable } from './products-table'; 5 | import { getProducts } from '@/lib/db'; 6 | 7 | export default async function ProductsPage( 8 | props: { 9 | searchParams: Promise<{ q: string; offset: string }>; 10 | } 11 | ) { 12 | const searchParams = await props.searchParams; 13 | const search = searchParams.q ?? ''; 14 | const offset = searchParams.offset ?? 0; 15 | const { products, newOffset, totalProducts } = await getProducts( 16 | search, 17 | Number(offset) 18 | ); 19 | 20 | return ( 21 | 22 |
23 | 24 | All 25 | Active 26 | Draft 27 | 28 | Archived 29 | 30 | 31 |
32 | 38 | 44 |
45 |
46 | 47 | 52 | 53 |
54 | ); 55 | } 56 | -------------------------------------------------------------------------------- /app/(dashboard)/product.tsx: -------------------------------------------------------------------------------- 1 | import Image from 'next/image'; 2 | import { Badge } from '@/components/ui/badge'; 3 | import { Button } from '@/components/ui/button'; 4 | import { 5 | DropdownMenu, 6 | DropdownMenuContent, 7 | DropdownMenuItem, 8 | DropdownMenuLabel, 9 | DropdownMenuTrigger 10 | } from '@/components/ui/dropdown-menu'; 11 | import { MoreHorizontal } from 'lucide-react'; 12 | import { TableCell, TableRow } from '@/components/ui/table'; 13 | import { SelectProduct } from '@/lib/db'; 14 | import { deleteProduct } from './actions'; 15 | 16 | export function Product({ product }: { product: SelectProduct }) { 17 | return ( 18 | 19 | 20 | Product image 27 | 28 | {product.name} 29 | 30 | 31 | {product.status} 32 | 33 | 34 | {`$${product.price}`} 35 | {product.stock} 36 | 37 | {product.availableAt.toLocaleDateString("en-US")} 38 | 39 | 40 | 41 | 42 | 46 | 47 | 48 | Actions 49 | Edit 50 | 51 |
52 | 53 |
54 |
55 |
56 |
57 |
58 |
59 | ); 60 | } 61 | -------------------------------------------------------------------------------- /app/(dashboard)/products-table.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import { 4 | TableHead, 5 | TableRow, 6 | TableHeader, 7 | TableBody, 8 | Table 9 | } from '@/components/ui/table'; 10 | import { 11 | Card, 12 | CardContent, 13 | CardDescription, 14 | CardFooter, 15 | CardHeader, 16 | CardTitle 17 | } from '@/components/ui/card'; 18 | import { Product } from './product'; 19 | import { SelectProduct } from '@/lib/db'; 20 | import { useRouter } from 'next/navigation'; 21 | import { ChevronLeft, ChevronRight } from 'lucide-react'; 22 | import { Button } from '@/components/ui/button'; 23 | 24 | export function ProductsTable({ 25 | products, 26 | offset, 27 | totalProducts 28 | }: { 29 | products: SelectProduct[]; 30 | offset: number; 31 | totalProducts: number; 32 | }) { 33 | let router = useRouter(); 34 | let productsPerPage = 5; 35 | 36 | function prevPage() { 37 | router.back(); 38 | } 39 | 40 | function nextPage() { 41 | router.push(`/?offset=${offset}`, { scroll: false }); 42 | } 43 | 44 | return ( 45 | 46 | 47 | Products 48 | 49 | Manage your products and view their sales performance. 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | Image 58 | 59 | Name 60 | Status 61 | Price 62 | 63 | Total Sales 64 | 65 | Created at 66 | 67 | Actions 68 | 69 | 70 | 71 | 72 | {products.map((product) => ( 73 | 74 | ))} 75 | 76 |
77 |
78 | 79 |
80 |
81 | Showing{' '} 82 | 83 | {Math.max(0, Math.min(offset - productsPerPage, totalProducts) + 1)}-{offset} 84 | {' '} 85 | of {totalProducts} products 86 |
87 |
88 | 98 | 108 |
109 |
110 |
111 |
112 | ); 113 | } 114 | -------------------------------------------------------------------------------- /app/(dashboard)/providers.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import { TooltipProvider } from '@/components/ui/tooltip'; 4 | 5 | export default function Providers({ children }: { children: React.ReactNode }) { 6 | return {children}; 7 | } 8 | -------------------------------------------------------------------------------- /app/(dashboard)/search.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import { useTransition } from 'react'; 4 | import { useRouter } from 'next/navigation'; 5 | import { Input } from '@/components/ui/input'; 6 | import { Spinner } from '@/components/icons'; 7 | import { Search } from 'lucide-react'; 8 | 9 | export function SearchInput() { 10 | const router = useRouter(); 11 | const [isPending, startTransition] = useTransition(); 12 | 13 | function searchAction(formData: FormData) { 14 | let value = formData.get('q') as string; 15 | let params = new URLSearchParams({ q: value }); 16 | startTransition(() => { 17 | router.replace(`/?${params.toString()}`); 18 | }); 19 | } 20 | 21 | return ( 22 |
23 | 24 | 30 | {isPending && } 31 | 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /app/(dashboard)/user.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from '@/components/ui/button'; 2 | import { auth, signOut } from '@/lib/auth'; 3 | import Image from 'next/image'; 4 | import { 5 | DropdownMenu, 6 | DropdownMenuContent, 7 | DropdownMenuItem, 8 | DropdownMenuLabel, 9 | DropdownMenuSeparator, 10 | DropdownMenuTrigger 11 | } from '@/components/ui/dropdown-menu'; 12 | import Link from 'next/link'; 13 | 14 | export async function User() { 15 | let session = await auth(); 16 | let user = session?.user; 17 | 18 | return ( 19 | 20 | 21 | 34 | 35 | 36 | My Account 37 | 38 | Settings 39 | Support 40 | 41 | {user ? ( 42 | 43 |
{ 45 | 'use server'; 46 | await signOut(); 47 | }} 48 | > 49 | 50 |
51 |
52 | ) : ( 53 | 54 | Sign In 55 | 56 | )} 57 |
58 |
59 | ); 60 | } 61 | -------------------------------------------------------------------------------- /app/api/auth/[...nextauth]/route.ts: -------------------------------------------------------------------------------- 1 | import { handlers } from '@/lib/auth'; 2 | export const { GET, POST } = handlers; 3 | -------------------------------------------------------------------------------- /app/api/seed/route.ts: -------------------------------------------------------------------------------- 1 | // import { db, products } from 'lib/db'; 2 | 3 | export const dynamic = 'force-dynamic'; 4 | 5 | export async function GET() { 6 | return Response.json({ 7 | message: 'Uncomment to seed data after DB is set up.' 8 | }); 9 | 10 | // await db.insert(products).values([ 11 | // { 12 | // id: 1, 13 | // imageUrl: 14 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/smartphone-gaPvyZW6aww0IhD3dOpaU6gBGILtcJ.webp', 15 | // name: 'Smartphone X Pro', 16 | // status: 'active', 17 | // price: '999.00', 18 | // stock: 150, 19 | // availableAt: new Date() 20 | // }, 21 | // { 22 | // id: 2, 23 | // imageUrl: 24 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/earbuds-3rew4JGdIK81KNlR8Edr8NBBhFTOtX.webp', 25 | // name: 'Wireless Earbuds Ultra', 26 | // status: 'active', 27 | // price: '199.00', 28 | // stock: 300, 29 | // availableAt: new Date() 30 | // }, 31 | // { 32 | // id: 3, 33 | // imageUrl: 34 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/home-iTeNnmKSMnrykOS9IYyJvnLFgap7Vw.webp', 35 | // name: 'Smart Home Hub', 36 | // status: 'active', 37 | // price: '149.00', 38 | // stock: 200, 39 | // availableAt: new Date() 40 | // }, 41 | // { 42 | // id: 4, 43 | // imageUrl: 44 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/tv-H4l26crxtm9EQHLWc0ddrsXZ0V0Ofw.webp', 45 | // name: '4K Ultra HD Smart TV', 46 | // status: 'active', 47 | // price: '799.00', 48 | // stock: 50, 49 | // availableAt: new Date() 50 | // }, 51 | // { 52 | // id: 5, 53 | // imageUrl: 54 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/laptop-9bgUhjY491hkxiMDeSgqb9R5I3lHNL.webp', 55 | // name: 'Gaming Laptop Pro', 56 | // status: 'active', 57 | // price: '1299.00', 58 | // stock: 75, 59 | // availableAt: new Date() 60 | // }, 61 | // { 62 | // id: 6, 63 | // imageUrl: 64 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/headset-lYnRnpjDbZkB78lS7nnqEJFYFAUDg6.webp', 65 | // name: 'VR Headset Plus', 66 | // status: 'active', 67 | // price: '349.00', 68 | // stock: 120, 69 | // availableAt: new Date() 70 | // }, 71 | // { 72 | // id: 7, 73 | // imageUrl: 74 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/watch-S2VeARK6sEM9QFg4yNQNjHFaHc3sXv.webp', 75 | // name: 'Smartwatch Elite', 76 | // status: 'active', 77 | // price: '249.00', 78 | // stock: 250, 79 | // availableAt: new Date() 80 | // }, 81 | // { 82 | // id: 8, 83 | // imageUrl: 84 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/speaker-4Zk0Ctx5AvxnwNNTFWVK4Gtpru4YEf.webp', 85 | // name: 'Bluetooth Speaker Max', 86 | // status: 'active', 87 | // price: '99.00', 88 | // stock: 400, 89 | // availableAt: new Date() 90 | // }, 91 | // { 92 | // id: 9, 93 | // imageUrl: 94 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/charger-GzRr0NSkCj0ZYWkTMvxXGZQu47w9r5.webp', 95 | // name: 'Portable Charger Super', 96 | // status: 'active', 97 | // price: '59.00', 98 | // stock: 500, 99 | // availableAt: new Date() 100 | // }, 101 | // { 102 | // id: 10, 103 | // imageUrl: 104 | // 'https://uwja77bygk2kgfqe.public.blob.vercel-storage.com/thermostat-8GnK2LDE3lZAjUVtiBk61RrSuqSTF7.webp', 105 | // name: 'Smart Thermostat Pro', 106 | // status: 'active', 107 | // price: '199.00', 108 | // stock: 175, 109 | // availableAt: new Date() 110 | // } 111 | // ]); 112 | } 113 | -------------------------------------------------------------------------------- /app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vercel/nextjs-postgres-nextauth-tailwindcss-template/0311ed573ba8dd6e78799ff68d3d113a377fe37a/app/favicon.ico -------------------------------------------------------------------------------- /app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @layer base { 6 | :root { 7 | --background: 0 0% 100%; 8 | --foreground: 222.2 84% 4.9%; 9 | 10 | --card: 0 0% 100%; 11 | --card-foreground: 222.2 84% 4.9%; 12 | 13 | --popover: 0 0% 100%; 14 | --popover-foreground: 222.2 84% 4.9%; 15 | 16 | --primary: 222.2 47.4% 11.2%; 17 | --primary-foreground: 210 40% 98%; 18 | 19 | --secondary: 210 40% 96.1%; 20 | --secondary-foreground: 222.2 47.4% 11.2%; 21 | 22 | --muted: 210 40% 96.1%; 23 | --muted-foreground: 215.4 16.3% 46.9%; 24 | 25 | --accent: 210 40% 96.1%; 26 | --accent-foreground: 222.2 47.4% 11.2%; 27 | 28 | --destructive: 0 84.2% 60.2%; 29 | --destructive-foreground: 210 40% 98%; 30 | 31 | --border: 214.3 31.8% 91.4%; 32 | --input: 214.3 31.8% 91.4%; 33 | --ring: 222.2 84% 4.9%; 34 | 35 | --radius: 0.5rem; 36 | } 37 | 38 | .dark { 39 | --background: 222.2 84% 4.9%; 40 | --foreground: 210 40% 98%; 41 | 42 | --card: 222.2 84% 4.9%; 43 | --card-foreground: 210 40% 98%; 44 | 45 | --popover: 222.2 84% 4.9%; 46 | --popover-foreground: 210 40% 98%; 47 | 48 | --primary: 210 40% 98%; 49 | --primary-foreground: 222.2 47.4% 11.2%; 50 | 51 | --secondary: 217.2 32.6% 17.5%; 52 | --secondary-foreground: 210 40% 98%; 53 | 54 | --muted: 217.2 32.6% 17.5%; 55 | --muted-foreground: 215 20.2% 65.1%; 56 | 57 | --accent: 217.2 32.6% 17.5%; 58 | --accent-foreground: 210 40% 98%; 59 | 60 | --destructive: 0 62.8% 30.6%; 61 | --destructive-foreground: 210 40% 98%; 62 | 63 | --border: 217.2 32.6% 17.5%; 64 | --input: 217.2 32.6% 17.5%; 65 | --ring: 212.7 26.8% 83.9%; 66 | } 67 | } 68 | 69 | @layer base { 70 | * { 71 | @apply border-border; 72 | } 73 | body { 74 | @apply bg-background text-foreground; 75 | } 76 | } 77 | 78 | /* Chrome, Safari, Edge, Opera */ 79 | input[type='search']::-webkit-search-cancel-button { 80 | -webkit-appearance: none; 81 | appearance: none; 82 | } 83 | 84 | /* Firefox */ 85 | input[type='search']::-moz-search-cancel-button { 86 | display: none; 87 | } 88 | 89 | /* Microsoft Edge */ 90 | input[type='search']::-ms-clear { 91 | display: none; 92 | } 93 | -------------------------------------------------------------------------------- /app/layout.tsx: -------------------------------------------------------------------------------- 1 | import './globals.css'; 2 | 3 | import { Analytics } from '@vercel/analytics/react'; 4 | 5 | export const metadata = { 6 | title: 'Next.js App Router + NextAuth + Tailwind CSS', 7 | description: 8 | 'A user admin dashboard configured with Next.js, Postgres, NextAuth, Tailwind CSS, TypeScript, and Prettier.' 9 | }; 10 | 11 | export default function RootLayout({ 12 | children 13 | }: { 14 | children: React.ReactNode; 15 | }) { 16 | return ( 17 | 18 | {children} 19 | 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /app/login/page.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from '@/components/ui/button'; 2 | import { 3 | Card, 4 | CardDescription, 5 | CardFooter, 6 | CardHeader, 7 | CardTitle 8 | } from '@/components/ui/card'; 9 | import { signIn } from '@/lib/auth'; 10 | 11 | export default function LoginPage() { 12 | return ( 13 |
14 | 15 | 16 | Login 17 | 18 | This demo uses GitHub for authentication. 19 | 20 | 21 | 22 |
{ 24 | 'use server'; 25 | await signIn('github', { 26 | redirectTo: '/' 27 | }); 28 | }} 29 | className="w-full" 30 | > 31 | 32 |
33 |
34 |
35 |
36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.js", 8 | "css": "app/globals.css", 9 | "baseColor": "slate", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils" 16 | } 17 | } -------------------------------------------------------------------------------- /components/icons.tsx: -------------------------------------------------------------------------------- 1 | export function UsersIcon(props: React.SVGProps) { 2 | return ( 3 | 15 | 16 | 17 | 18 | 19 | 20 | ); 21 | } 22 | 23 | export function SettingsIcon(props: React.SVGProps) { 24 | return ( 25 | 37 | 38 | 39 | 40 | ); 41 | } 42 | 43 | export function SearchIcon(props: React.SVGProps) { 44 | return ( 45 | 57 | 58 | 59 | 60 | ); 61 | } 62 | 63 | export function Spinner() { 64 | return ( 65 |
66 | 72 | 80 | 85 | 86 |
87 | ); 88 | } 89 | 90 | export function Logo() { 91 | return ( 92 | 100 | 101 | 107 | 108 | ); 109 | } 110 | 111 | export function VercelLogo(props: React.SVGProps) { 112 | return ( 113 | 120 | 124 | 125 | ); 126 | } 127 | -------------------------------------------------------------------------------- /components/ui/badge.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { cva, type VariantProps } from "class-variance-authority" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const badgeVariants = cva( 7 | "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", 8 | { 9 | variants: { 10 | variant: { 11 | default: 12 | "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", 13 | secondary: 14 | "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", 15 | destructive: 16 | "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", 17 | outline: "text-foreground", 18 | }, 19 | }, 20 | defaultVariants: { 21 | variant: "default", 22 | }, 23 | } 24 | ) 25 | 26 | export interface BadgeProps 27 | extends React.HTMLAttributes, 28 | VariantProps {} 29 | 30 | function Badge({ className, variant, ...props }: BadgeProps) { 31 | return ( 32 |
33 | ) 34 | } 35 | 36 | export { Badge, badgeVariants } 37 | -------------------------------------------------------------------------------- /components/ui/breadcrumb.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { Slot } from "@radix-ui/react-slot" 3 | import { ChevronRight, MoreHorizontal } from "lucide-react" 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const Breadcrumb = React.forwardRef< 8 | HTMLElement, 9 | React.ComponentPropsWithoutRef<"nav"> & { 10 | separator?: React.ReactNode 11 | } 12 | >(({ ...props }, ref) =>