Volver al ranking

sadmann7/shadcn-table

TypeScripttable.sadmn.com

Shadcn table with server-side sorting, filtering, and pagination.

drizzle-ormopen-sourceshadcn-uinextjstanstack-tabletable
Crecimiento de estrellas
Estrellas
4.2k
Forks
349
Crecimiento semanal
Issues
15
1k2k3k4k
may 2023oct 2023abr 2024oct 2024
Artefactosnpmnpm install shadcn-table
README

Shadcn Table

This is a shadcn table with server-side sorting, filtering, and pagination. It is bootstrapped with create-t3-app.

Shadcn Table

Warning This project is still in development and is not ready for production use.

It uses new technologies (ppr, react compiler) which are subject to change and may break your application.

Tech Stack

Features

  • Server-side pagination, sorting, and filtering (via useDataTable hook)
  • Customizable columns (dataTable and columns props)
  • Dynamic debounced search filters, and faceted filters (filterFields prop)
  • Dynamic Data-Table-Toolbar with search, filters, and actions
  • Optional Notion like advanced filtering (enableAdvancedFilter prop)
  • Optional Linear like floating bar on row selection (floatingBar prop)

Running Locally

  1. Clone the repository

    git clone https://github.com/sadmann7/shadcn-table
    
  2. Install dependencies using pnpm

    pnpm install
    
  3. Copy the .env.example to .env and update the variables.

    cp .env.example .env
    
  4. Start the development server

    pnpm run dev
    
  5. Push the database schema

    pnpm run db:push
    

Build your own Table

  1. Copy the following folders and files into your project (configured with ) at the exact specific locations

    • src/components/data-table
    • src/db/index.ts
    • src/hooks
    • src/lib
    • src/types

    Also install the required shadcn components and other required packages with the following commands:

    pnpm dlx shadcn@latest init
    
    pnpm dlx shadcn@latest add badge button calendar checkbox command dialog dropdown-menu form input label popover select separator skeleton sonner table toggle-group tooltip drawer
    
    pnpm add drizzle-orm postgres @tanstack/react-table zod @t3-oss/env-nextjs
    pnpm add -D drizzle-kit dotenv-cli pg tsx
    
  2. Configure your Environment Variables Then set up the Database URL, for this example, we're using PlanetScale MySQL2 Database. Our schemas will also be made using this.

  3. Database Actions: For this you can use any ORM of your choice, but for the sake of this particular example, we're using Drizzle ORM and Neon.

    As an example, lets use the tasks table.

    • Create the Table Schema at @/db/schema.ts
    • Create the associated zod validations @/lib/validations/tasks.ts file
  4. Setting up the Table

    • Create Files: Create page.tsx and, if needed, layout.tsx in your app directory.
    • Copy Directories: Copy ./_components and ./_lib directories into your project.
    • Update Queries/Mutations: Modify ./_lib/queries.ts, and ./_lib/actions.ts to match your database operations.
    • Update Floating Bar: Update ./_components/tasks-table-floating-bar.tsx to match your table's actions (optional).
    • Define Table Columns: Update ./_components/tasks-table-columns.tsx to define column headers, actions, searchable and filterable columns.
    • Setup Data Fetching: In ./page.tsx, define getTasksPromise, getTaskCountByStatus, and getTaskCountByPriority.
    • Fetch Data: In ./_components/tasks-table.tsx, consume the getTasksPromise promise using the React.use hook. The promise is passed to trigger the suspense boundary.
    • Memoize Table Columns: In ./_components/tasks-table.tsx, memoize columns defined in ./_components/tasks-table-columns.tsx using React.useMemo hook to prevent unnecessary re-renders.
    • Use Data Table Hook: In ./_components/tasks-table.tsx, call ./hooks/useTasksTable.tsx hook to handle server-side pagination, sorting, and filtering.
    • Remove Tasks Table Provider: Make sure to remove the provider from ./components/tasks-table-provider.tsx. The provider is used to showcase some additional features like floating bar and advanced filters.

Codebase Overview

Watch the codebase overview video on YouTube.

Consider subscribing to Kavin Desi Valli's YouTube channel for more videos.

How do I deploy this?

Follow the deployment guides for Vercel, Netlify and Docker for more information.

Repositorios relacionados
supermemoryai/supermemory

Memory and context engine + app that is extremely fast, scalable, and can be run fully locally. The Memory API for the AI era.

TypeScriptnpmMIT Licensecloudflare-pagescloudflare-workers
supermemory.ai/docs
28.5k2.5k
kriasoft/react-starter-kit

Modern React starter kit with Bun, TypeScript, Tailwind CSS, tRPC, Stripe, and Cloudflare Workers. Production-ready monorepo for building fast web apps.

TypeScriptnpmMIT Licensereactboilerplate
reactstarter.com
23.6k4.2k
noodle-run/noodle

Rethinking Student Productivity

TypeScriptnpmGNU Affero General Public License v3.0trpceslint
noodle.run
12.2k777
openstatusHQ/openstatus

🫖 Status page with uptime monitoring & API monitoring as code 🫖

TypeScriptnpmGNU Affero General Public License v3.0observabilityopen-source
openstatus.dev
8.9k707
AmanVarshney01/create-better-t-stack

A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations

TypeScriptnpmMIT Licensebetter-authbun
better-t-stack.dev
5.6k311
sadmann7/skateshop

An open source e-commerce skateshop build with everything new in Next.js.

TypeScriptnpmMIT Licensedrizzle-ormopen-source
skateshop.sadmn.com
5.5k776
kanbn/kan

The open source Trello alternative.

TypeScriptnpmGNU Affero General Public License v3.0drizzle-ormnextjs
kan.bn
5.2k419
crafter-station/petdex

The public gallery of animated pet for Codex, Claude Code, OpenCode y Gemini CLI

TypeScriptnpmMIT Licenseclaude-codeclerk
petdex.dev
3.5k151
reliverse/relivator

🏬 relivator: next.js 15 react 19 ecommerce template ▲ better-auth polar shadcn/ui tailwind drizzle orm typescript ts radix, postgres neon, app router saas commerce ecommerce shop pricing payments dark mode full stack free ⭐ more stars 👉 more features

TypeScriptnpmMIT Licensedrizzle-ormnextjs-boilerplate
relivator.com
1.6k277
alan345/AI-Fullstack-SaaS-Boilerplate

Fullstack SaaS Boilerplate built with tRPC, Fastify and React

TypeScriptnpmMIT Licensereacttailwind
alan345.github.io/AI-Fullstack-SaaS-Boilerplate/
1.4k219
blefnk/relivator-nextjs-template

✨ Relivator: Next.js 15 React 19 eCommerce Template ▲ Better-Auth Polar Shadcn/UI Tailwind Drizzle ORM TypeScript TS Radix, Postgres Neon, App Router SaaS Commerce eCommerce Shop Pricing Payments Dark Mode Full Stack Free ⭐ more stars 👉 more features

TypeScriptnpmdrizzle-ormnextjs-boilerplate
relivator.com
1.2k227
blefnk/relivator

✨ Relivator 1.3.0 RC.1 is Here 🚀 Next.js 15.1 React 19 eCommerce Template ▲ i18n Stripe Shadcn UI Tailwind Drizzle ORM Zod TypeScript TS Clerk Radix, Responsive Server Components, Postgres Neon, Intl App Router Docs User Actions Kit, SaaS Commerce eCommerce Shop Pricing Payments Dark Mode Full Stack Free ⭐ more stars 👉 more features

TypeScriptnpmdrizzle-ormnextjs-boilerplate
relivator.com/en
1.1k223