A full-stack metrics tracking application that enables users to create, monitor, and visualize key performance indicators in real-time.
This project is a monorepo built with modern TypeScript tooling (Next.js, Hono, Prisma, TailwindCSS, shadcn/ui). It uses Turborepo for monorepo orchestration and pnpm workspaces for efficient dependency management. Users can create custom metrics, log timestamped data points, and visualize trends with interactive charts powered by Recharts.
-
Frontend (
apps/web):
Built with Next.js, using React Query for async state management and React Hook Form for form state. Communicates with the backend via a shared API client for type-safe data fetching. -
Backend (
apps/api):
Built with Hono and Prisma, using PostgreSQL database.
Exposes REST endpoints for:- Creating and retrieving metrics
- Adding timestamped entries
- Enforcing data validation with Zod schemas
-
Database:
PostgreSQL with Prisma ORM, designed for flexible metric tracking with categorization.
Includes comprehensive seed data with realistic business, user engagement, and performance metrics.
- pnpm (recommended version: 10.x or above)
- Node.js (18+)
- PostgreSQL database
pnpm installThis project uses PostgreSQL with Prisma. You can either use a local PostgreSQL instance or create a cloud database:
Quick setup with Neon
- Create a new PostgreSQL database at neon.new/db (You don't need to create an account)
- Copy the connection string and set it in the
.envfile in theapps/apidirectory:
Setup:
- Create a
.envfile in theapps/apidirectory:cd apps/api echo "DATABASE_URL=\"your_postgresql_connection_string_here\"" > .env
- Generate the Prisma client and push the schema:
pnpm db:push
- Seed the database with sample data (optional but recommended):
pnpm db:seed
- Return to the root and start the development servers:
cd ../.. pnpm dev
- Web app: http://localhost:3001
- API: http://localhost:3000
metrifacts/
├── apps/
│ ├── web/ # Frontend (Next.js)
│ │ └── src/
│ │ ├── app/ # App Router pages & layouts
│ │ ├── components/ # React components
│ │ │ ├── ui/ # Reusable UI components (shadcn/ui)
│ │ │ ├── dashboard.tsx
│ │ │ ├── metric-card.tsx
│ │ │ ├── metric-form.tsx
│ │ │ └── add-entry-form.tsx
│ │ ├── hooks/ # Custom React hooks
│ │ └── lib/ # Utilities & API client
│ └── api/ # Backend (Hono, Prisma)
│ ├── src/
│ │ ├── routes/ # API route handlers
│ │ ├── middlewares/ # Express-style middleware
│ │ └── lib/ # Utilities & error handling
│ └── prisma/
│ ├── schema/ # Database schema
│ ├── seed.ts # Sample data generator
│ └── generated/ # Generated Prisma client