Skip to content

andersonkaiti/devroast

Repository files navigation

πŸ”₯ DevRoast

Paste your code. Get roasted.

A code review platform that scores submitted snippets, returns detailed findings and a suggested diff β€” with an optional full-sarcasm roast mode.


Next.js React TypeScript Tailwind CSS tRPC Drizzle PostgreSQL Biome


πŸ“‹ Table of Contents


✨ Features

Feature Description
🎨 Syntax Highlighting Real-time highlighting in the code editor, powered by Shiki with auto-detection via highlight.js
πŸ”₯ Roast Mode Toggle between honest analysis and maximum-sarcasm mode
πŸ“Š Scored Feedback Every submission receives a score from 0 to 10 alongside categorized findings (critical, warning, good)
πŸ”€ Suggested Diff Each result includes a before/after diff of the recommended fix
πŸ† Shame Leaderboard Publicly ranks submissions by score with a live code preview
πŸ“ˆ Animated Stats Homepage metrics animate from zero on load via NumberFlow

βš™οΈ How It Works

flowchart LR
    A["πŸ“ Paste Code\n(editor)"] --> B["πŸŽ› Choose Mode\n(honest / πŸ”₯ roast)"]
    B --> C["πŸš€ Submit\n(tRPC mutation)"]
    C --> D["πŸ€– AI Analyzes\nthe snippet"]
    D --> E["πŸ“Š Score + Findings\n+ Suggested Diff"]
    E --> F["πŸ“„ Result Page"]
    F --> G["πŸ† Shame Leaderboard\n(if public)"]
Loading

πŸ›  Tech Stack

Layer Technology
Framework Next.js 16 β€” App Router, React Compiler, Turbopack
UI React 19, Tailwind CSS v4, Shiki, NumberFlow
API tRPC v11, TanStack React Query v5
Database Drizzle ORM, PostgreSQL (Neon)
Validation Zod v4
Linter / Formatter Biome 2
Package Manager pnpm

πŸ— Architecture

graph TD
    User["User"]

    subgraph Frontend["Next.js 16 β€” App Router"]
        Page["page.tsx Β· Server Component"]
        Editor["CodeInput Β· Client Component"]
        Stats["StatsHint Β· Client Component"]
        Result["roast/[id] Β· Server Component"]
        LB["Leaderboard Β· Server Component"]
    end

    subgraph API["tRPC v11"]
        Router["AppRouter"]
        LBRouter["leaderboard\nstats Β· list"]
        SubRouter["submissions\ngetById Β· create"]
    end

    subgraph DB["Drizzle ORM Β· Neon PostgreSQL"]
        Submissions[("submissions")]
        Findings[("analysis_findings")]
    end

    User --> Page
    Page --> Editor
    Page --> Stats
    User --> Result
    User --> LB

    Stats -->|"useQuery"| Router
    Editor -->|"useMutation"| Router
    Result -->|"caller.getById"| Router
    LB -->|"prefetch"| Router

    Router --> LBRouter
    Router --> SubRouter

    LBRouter --> Submissions
    SubRouter --> Submissions
    SubRouter --> Findings
    Submissions -->|"cascade delete"| Findings
Loading

πŸ—„ Database Schema

erDiagram
    submissions {
        uuid id PK
        text code
        varchar code_preview
        text lang
        enum roast_mode
        numeric score
        text roast_text
        boolean is_public
        timestamptz created_at
    }

    analysis_findings {
        uuid id PK
        uuid submission_id FK
        enum severity
        text title
        text description
        integer sort_order
    }

    submissions ||--o{ analysis_findings : "has"
Loading

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • pnpm 9+
  • A PostgreSQL database β€” either a Neon cloud instance or a local container via Docker Compose

Installation

1. Clone the repository

git clone https://github.com/andersonkaiti/devroast.git
cd devroast

2. Install dependencies

pnpm install

3. Set up the database

Choose one of the options below and set DATABASE_URL in your .env:

cp .env.example .env

Option A β€” Neon (cloud)

DATABASE_URL=postgresql://<user>:<password>@<host>.neon.tech/<db>?sslmode=require

Option B β€” Docker Compose (local)

docker compose up -d
DATABASE_URL=postgresql://devroast:devroast@localhost:5432/devroast

4. Apply the database schema

pnpm db:push

5. Seed sample data (optional)

pnpm db:seed

6. Start the development server

pnpm dev

Open http://localhost:3000 in your browser.


πŸ” Environment Variables

Variable Description Required
DATABASE_URL PostgreSQL connection string (Neon or local Docker) βœ…

Copy .env.example to .env and fill in the values before starting the server.