mmarinovic/tailwindsql
mmarinovic/tailwindsql has 1,303 GitHub stars and 52 forks. GitHot measured -1 in 7 days. Last checked 2026-11-10 20:14 UTC. Last push 2025-12-16.
TailwindSQL lets you write SQL queries using Tailwind-style class names.
What you can do
- 🎨 Tailwind-style syntax - Write SQL queries using familiar class names
- ⚡ React Server Components - Zero client-side JavaScript for queries
- 🔒 SQLite - Built on better-sqlite3 for fast, local database access
- 🎯 Zero Runtime - Queries are parsed and executed at build/render time
측정된 스타 증가
- in 24h
- 업데이트 지연
- in 7 days
- -1
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalTailwindSQL 🎨
Like TailwindCSS, but for SQL queries in React Server Components.
What is this?
TailwindSQL lets you write SQL queries using Tailwind-style class names. Just use className to query your database directly in React Server Components!
// Fetch and render a user's name
<DB className="db-users-name-where-id-1" />
// Renders: "Ada Lovelace"
// Render products as a list
<DB className="db-products-title-limit-5" as="ul" />
// Renders: <ul><li>Mechanical Keyboard</li>...</ul>
// Order by price and show as table
<DB className="db-products-orderby-price-desc" as="table" />
Features
- 🎨 Tailwind-style syntax - Write SQL queries using familiar class names
- ⚡ React Server Components - Zero client-side JavaScript for queries
- 🔒 SQLite - Built on better-sqlite3 for fast, local database access
- 🎯 Zero Runtime - Queries are parsed and executed at build/render time
- 🎭 Multiple Render Modes - Render as text, lists, tables, or JSON
Syntax
db-{table}-{column}-where-{field}-{value}-limit-{n}-orderby-{field}-{asc|desc}
Examples
| Class Name | SQL Query |
|---|---|
db-users |
SELECT * FROM users |
db-users-name |
SELECT name FROM users |
db-users-where-id-1 |
SELECT * FROM users WHERE id = 1 |
db-posts-title-limit-10 |
SELECT title FROM posts LIMIT 10 |
db-products-orderby-price-desc |
SELECT * FROM products ORDER BY price DESC |
Getting Started
Prerequisites
- Node.js 18+
- npm or yarn
Installation
# Clone the repository
git clone https://github.com/mmarinovic/tailwindsql.git
cd tailwindsql
# Install dependencies
npm install
# Seed the database with demo data
npm run seed
# Start the development server
npm run dev
Open http://localhost:3000 to see the demo and interactive playground!
How It Works
- Parser (
src/lib/parser.ts) - Parses class names into query configurations - Query Builder (
src/lib/query-builder.ts) - Transforms configs into safe SQL queries - DB Component (
src/components/DB.tsx) - React Server Component that executes queries and renders results
Render Modes
The as prop controls how results are rendered:
| Value | Description |
|---|---|
span |
Inline text (default) |
div |
Block element |
ul |
Unordered list |
ol |
Ordered list |
table |
HTML table |
json |
JSON code block |
Project Structure
tailwindsql/
├── src/
│ ├── app/ # Next.js app directory
│ │ ├── page.tsx # Landing page
│ │ └── api/ # API routes
│ ├── components/ # React components
│ │ ├── DB.tsx # Main DB component
│ │ ├── Example.tsx # Example components
│ │ └── Playground.tsx # Interactive playground
│ └── lib/ # Core logic
│ ├── parser.ts # Class name parser
│ ├── query-builder.ts # SQL query builder
│ └── db.ts # Database connection
└── README.md
Why?
This project was built to explore css-driven database queries.
License
MIT - Do whatever you want with it (except deploy to production 😅)
Built with 💜 using Next.js, SQLite, and questionable decisions
관련 프로젝트 살펴보기
Asabeneh/30-Days-Of-Python
30 Days of Python 프로그래밍 챌린지는 Python 프로그래밍 언어를 30일 동안 배우기 위한 단계별 가이드입니다. 이 챌린지는 100일 이상 걸릴 수 있습니다. 자신의 속도에 맞춰 진행하세요. 다음 동영상도 도움이 될 수 있습니다: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,486 스타grafana/grafana
개방적이고 조합 가능한 옵저버빌리티 및 데이터 시각화 플랫폼입니다. Prometheus, Loki, Elasticsearch, InfluxDB, Postgres 등 여러 소스의 메트릭, 로그, 트레이스를 시각화합니다.
77,790 스타redis/redis
실시간 데이터 기반 애플리케이션을 구축하는 개발자에게 Redis는 가장 선호되고, 가장 빠르며, 기능이 가장 풍부한 캐시, 데이터 구조 서버이자 문서 및 벡터 쿼리 엔진입니다.
77,332 스타apache/superset
Apache Superset는 데이터 시각화 및 데이터 탐색 플랫폼입니다.
75,455 스타