CodeSpotlight

The Developer Proof-Of-Work Platform

Visit Repo
CodeSpotlight banner

About

## Challenges we ran into

### ๐Ÿงฉ The Challenge: AI Non-Determinism & Frontend Crashes

One of the most complex hurdles we faced was reliably rendering the AI-generated architecture diagrams without crashing the frontend.

We integrated **Gemini 2.5 Flash** to analyze repositories and output `Mermaid.js` flowchart syntax. However, Large Language Models are inherently non-deterministic. Even with strict prompt engineering, the AI would occasionally return slightly invalid syntax, such as: * Injecting unexpected Markdown code fences (e.g., ` ```mermaid `). * Using parentheses inside node definitions.

When our Flutter frontend attempted to parse these edge cases inside the iframe, the Mermaid renderer would throw a fatal syntax error, causing the UI component to crash completely.

### ๐Ÿ› ๏ธ The Solution: A Robust Middleware Sanitizer

We quickly realized that prompt engineering alone wasn't enough to guarantee stability. To solve this, we built a **regex-based middleware sanitizer** directly into our Node.js backend.

Before saving any AI output to MongoDB, this custom data pipeline intercepts the response and performs aggressive cleaning: 1. **Strips rogue markdown fences** to ensure raw text execution. 2. **Enforces correct graph directives** (e.g., defaulting to `graph TD`). 3. **Automatically converts invalid characters** (like nested parentheses) into safe, quoted string labels using Regex.

**The Impact:** By implementing this middle-layer sanitizer, we transformed an unpredictable AI output into a **100% deterministic, crash-proof data source**, allowing our UI to render complex architecture diagrams flawlessly every single time.

## The problem it solves

# CodeSpotlight โœจ

**The Developer Proof-of-Work Platform** *Transform any public GitHub repository into a beautifully rendered, AI-powered case study.*

**Live Application / Deployment Link:** https://codespotlight-hm.web.app

**Watch Demo:** https://youtu.be/BZO2LhEN5AU

---

## ๐Ÿ“– Overview

Many developers build great projects but lose them in scattered GitHub repositories. **CodeSpotlight** is a centralized showcase directory where developers can host their deployed projects, generate AI-powered technical deep-dives, and present their work to recruiters through a polished, read-only portfolio interface.

Paste a GitHub URL, and CodeSpotlight's integration with Gemini AI and the GitHub API instantly generates architecture diagrams, commit heatmaps, language visualizations, and a fully formatted Markdown README.

---

## โœจ Features

  • **๐Ÿค– AI Technical Deep Dive:** Gemini 2.5 Flash generates a comprehensive case study explaining the project's purpose, the hardest problems solved, and the architectural decisions made.
  • **๐Ÿ“„ Auto-Generated READMEs:** Export your AI-generated project analysis to beautiful, fully-formatted Markdown, ready to be pushed directly to your GitHub repository.
  • **๐Ÿ—๏ธ Architecture Diagrams:** Auto-generated Mermaid.js flowcharts visualize components, data flow, and system interactions in a secure sandboxed iframe.
  • **๐Ÿ”ฅ Commit Heatmap:** A real 52-week ร— 7-day contribution grid pulled live from GitHub to showcase consistent effort.
  • **๐ŸŒ Public Discoverability:** A global "Discover" feed where developers can browse top projects filtered by tech stack (MERN, Web3, AI, etc.).
  • **๐Ÿ” Secure Portfolio Sharing:** Share a read-only link to your portfolio with recruiters without exposing edit/delete controls. Includes customizable social links (LinkedIn, Twitter, Portfolio).

---

## ๐Ÿ› ๏ธ Tech Stack

### Frontend

- **Framework:** Flutter Web (Canvas Kit) - **Routing:** `go_router` for shareable deep links - **Markdown:** `flutter_markdown` - **Hosting:** Firebase Hosting

### Backend

- **Framework:** Node.js + Express - **Authentication:** JWT (JSON Web Tokens) - **Database:** MongoDB Atlas (Mongoose) - **AI Integration:** `@google/generative-ai` (Gemini 2.5 Flash) - **Hosting:** Render.com

---

## ๐ŸŒ Deployment Information

This project is fully deployed and accessible live for the hackathon judging process: - **Frontend (Flutter Web):** Deployed on **Firebase Hosting** - **Backend (Node.js/Express):** Deployed on **Render.com** - **Database (MongoDB):** Hosted on **MongoDB Atlas** - **Live URL:** https://codespotlight-hm.web.app

---

## ๐Ÿš€ Getting Started

Follow these instructions to set up the project locally. ### Prerequisites

  • [Node.js](https://nodejs.org/en/) (v18 or higher)
  • [Flutter SDK](https://docs.flutter.dev/get-started/install) (3.x with Web target enabled)
  • A [MongoDB Atlas](https://www.mongodb.com/cloud/atlas/register) cluster URI
  • A Google [Gemini API Key](https://aistudio.google.com/)
  • A [GitHub Personal Access Token (PAT)](https://github.com/settings/tokens)

### 1. Backend Setup

```bash

# Navigate to the backend directory cd backend

# Copy the environment template

cp .env.example .env ```

**Configure Environment Variables (`backend/.env`):** | Variable | Description | |---|---| | `PORT` | API port (default: `3000`) | | `MONGODB_URI` | MongoDB Atlas connection string | | `JWT_SECRET` | Secret key for signing authentication tokens | | `GITHUB_PAT` | GitHub Personal Access Token (public repo scope) | | `GEMINI_API_KEY` | Google AI Studio key | | `CLIENT_URL` | Frontend URL for CORS (e.g., `http://localhost:52870`) |

```bash

# Install dependencies npm install

# Start the development server

npm run dev ```

### 2. Frontend Setup

```bash

# Open a new terminal and navigate to the frontend directory cd frontend

# Get dependencies

flutter pub get

# Run the Flutter web app (Chrome)

flutter run -d chrome ``` *Note: The frontend is configured to communicate with `http://localhost:3000/api` by default.*

---

## ๐Ÿ“‚ Project Structure

```text CodeSpotlight/ โ”œโ”€โ”€ backend/ โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”‚ โ”œโ”€โ”€ controllers/ # Route logic โ”‚ โ”‚ โ”œโ”€โ”€ models/ # Mongoose schemas (User, Project) โ”‚ โ”‚ โ”œโ”€โ”€ routes/ # Express routes (auth.js, projects.js) โ”‚ โ”‚ โ””โ”€โ”€ services/ # Integrations (geminiService.js, githubService.js) โ”‚ โ””โ”€โ”€ index.js # Server entry point โ”‚ โ”œโ”€โ”€ frontend/ โ”‚ โ”œโ”€โ”€ lib/ โ”‚ โ”‚ โ”œโ”€โ”€ models/ # Dart data models โ”‚ โ”‚ โ”œโ”€โ”€ pages/ # UI Screens (Dashboard, Discover, Detail) โ”‚ โ”‚ โ”œโ”€โ”€ services/ # API & Auth clients โ”‚ โ”‚ โ”œโ”€โ”€ theme/ # Global AppTheme and styling โ”‚ โ”‚ โ””โ”€โ”€ widgets/ # Reusable UI (Cards, Heatmap, Mermaid) โ”‚ โ””โ”€โ”€ web/ # Web-specific assets (index.html) โ”‚ โ””โ”€โ”€ deploy.sh # Deployment automation script ```

Prizes

  • 2nd Runner Up

Team

From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.

Code 2 Architecture

This tool converts codebase into a flow diagram using gemini API,mermaid j, and lizard parser