Code-AI
CodeAI helps developers understand code faster with clear AI explanations, social sign-in, and saved analysis history.

Overview
CodeAI is an authenticated AI code-explainer built with Next.js, React, Prisma, PostgreSQL, Better Auth, and the OpenAI Responses API. A signed-in user pastes a code snippet into the editor, the backend generates a structured explanation with an LLM, and the result is normalized into relational tables so it can be queried later from a per-user history view. This repository is more than a simple prompt-to-text demo. It combines: authenticated multi-user access Google and GitHub OAuth sign-in through Better Auth server-side session checks in the App Router application-layer row ownership enforcement structured model outputs validated with Zod normalized persistence of explanation steps idempotent deduplication using a normalized code hash theming and syntax-highlighted result rendering What The Project Does At a high level, CodeAI turns raw source code into a stored, queryable explanation artifact. The generated artifact contains: a generated title detected programming language a complexity classification a short summary a long-form summary an optimization tip a performance impact statement a step-by-step explanation broken down by line range model metadata and token usage The application persists both the high-level explanation and its individual explanation steps. This is important because it means the AI output is not treated as an opaque blob; it is decomposed into fields that can be rendered, indexed, reused, and extended later.
Gallery
