AI Usage Dashboard — A fast React + TypeScript app (Vite) with Tailwind CSS v4 that shows AI usage metrics using interactive Chart.js charts, smooth framer-motion animations, and a fully responsive design.
- Overview
- Live Demo
- Stack
- Project Structure
- Getting Started
- Scripts
- CI / CD
- Tailwind CSS v4 Setup
- Features
- Troubleshooting
- Vite for tooling and HMR (
vite) - React 19 (
react,react-dom) - Tailwind CSS v4 with PostCSS plugin (
@tailwindcss/postcss) - ESLint baseline config
- PNPM as the package manager
ai-usage-dashboard/
.github/
workflows/
ci.yml
gh-pages.yml
deploy.yml (optional; if using official Pages action)
.gitattributes
.gitignore
README.md
eslint.config.js
index.html
package.json
pnpm-lock.yaml
postcss.config.cjs
public/
src/
App.css
index.css
main.tsx
App.tsx
vite-env.d.ts
core/
data/
usage-data.ts
hooks/
use-theme.ts
state/
use-usage-store.ts
design-system/
interactive-card.tsx
partials/
cards/
summary-card.tsx
charts/
usage-line-chart.tsx
model-pie-chart.tsx
table/
prompt-log-table.tsx
vite.config.js
tsconfig.json
- Install dependencies
pnpm install
- Start the dev server
pnpm dev
- Build for production
pnpm build
- Preview the build locally
pnpm preview
- Dev:
pnpm dev - Build:
pnpm build - Preview:
pnpm preview - Lint:
pnpm lint
The workflow at /.github/workflows/ci.yml runs on pushes and pull requests targeting main.
- Install: Uses PNPM with lockfile for reproducible installs
- Lint: Executes
pnpm lint - Build: Executes
pnpm buildto ensure the app compiles
You can monitor status via the badge at the top of this README or from the Actions tab in GitHub. Update the badge URL to your actual OWNER/REPO once pushed.
Deployed to GitHub Pages via /.github/workflows/gh-pages.yml on push to main.
- Base path:
vite.config.jssetsbase: '/ai-usage-dashboard/' - Publish:
peaceiris/actions-gh-pagespushesdist/togh-pages - Enable Pages: Settings → Pages → “Deploy from a branch” → Branch:
gh-pages→ Folder:/ (root)
Tailwind v4 is enabled via a single import in the main stylesheet and a PostCSS plugin.
src/index.cssmust begin with:
@import "tailwindcss";- PostCSS config uses the v4 plugin:
// postcss.config.cjs
module.exports = {
plugins: {
'@tailwindcss/postcss': {},
autoprefixer: {},
},
};No tailwind.config.js is required unless you need custom tokens/theme.
- Responsive UI: Mobile-first layout with Tailwind
- Charts: Line + Doughnut (Chart.js via react-chartjs-2)
- Animations: Framer Motion micro-interactions and
InteractiveCard - Theme Toggle: Light/Dark with
useTheme()and localStorage persistence - Mock Data:
src/core/data/usage-data.tsfor fast iteration
- If you see an error about using
tailwindcssdirectly as a PostCSS plugin, install and use@tailwindcss/postcssand restart dev server:pnpm add -D @tailwindcss/postcss pnpm dev
- Ensure
src/main.jsximports./index.cssand thatindex.cssstarts with@import "tailwindcss";. - Hard refresh the browser after changes to PostCSS/Tailwind config.