Skip to content

devincog/Hackfest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฆ Mr. Clarke's Automated Briefing Generator

"Mr. Clarke, Hawkins' beloved science teacher, has mysteriously disappeared โ€” leaving behind a collection of dense physics books, radio manuals, and research notes. The AV Club needs to brief the town sheriff on the strange signals appearing around Hawkins, but reading through hundreds of pages would take too long. So they built this."

An AI-powered presentation generator that ingests your documents (PDF/TXT), retrieves the most relevant information using RAG (Retrieval-Augmented Generation), and automatically generates beautiful, animated slide decks โ€” all with a Stranger Things theme.

Theme: Stranger Things Backend: Django AI: Groq + LlamaIndex DB: MongoDB Atlas


โœจ What It Does

  1. Upload your PDF or TXT documents
  2. Ask a question or describe what your presentation should cover
  3. The AI reads your documents, finds the most relevant sections, and generates a complete animated slide deck
  4. Navigate through slides with animations that replay on every slide transition
  5. View fullscreen for a presentation-ready experience

๐Ÿ—๏ธ Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  FRONTEND (React)                    โ”‚
โ”‚   CDN React 18 + Babel Standalone + Tailwind CSS     โ”‚
โ”‚   No Node.js needed! Served via Python HTTP server   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚ REST API calls
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚               BACKEND (Django + DRF)                 โ”‚
โ”‚                                                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ Views   โ”‚โ†’ โ”‚ RAG      โ”‚โ†’ โ”‚ Groq LLM           โ”‚  โ”‚
โ”‚  โ”‚ (API)   โ”‚  โ”‚ Service  โ”‚  โ”‚ (Slide Generation)  โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                    โ”‚                                  โ”‚
โ”‚              โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚              โ”‚ LlamaIndex โ”‚   โ”‚ HTML Exporter     โ”‚   โ”‚
โ”‚              โ”‚ (Retrieval)โ”‚   โ”‚ (Tailwind + Anim) โ”‚   โ”‚
โ”‚              โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                    โ”‚                                  โ”‚
โ”‚              โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”‚
โ”‚              โ”‚  MongoDB Atlas          โ”‚               โ”‚
โ”‚              โ”‚  (Vector Search Store)  โ”‚               โ”‚
โ”‚              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ Project Structure

Hackfest/
โ”œโ”€โ”€ .env                          # Environment variables (API keys)
โ”œโ”€โ”€ README.md                     # You are here!
โ”‚
โ”œโ”€โ”€ frontend-react/               # ๐Ÿ–ฅ๏ธ React Frontend (CDN-based, no Node.js)
โ”‚   โ”œโ”€โ”€ index.html                # HTML shell โ€” loads React, Babel, Tailwind from CDN
โ”‚   โ”œโ”€โ”€ app.jsx                   # Main React app (components + API calls)
โ”‚   โ”œโ”€โ”€ style.css                 # Stranger Things theme + animation keyframes
โ”‚   โ””โ”€โ”€ particles.js              # Floating "Upside Down" spore particles effect
โ”‚
โ”œโ”€โ”€ hackfest_project/             # ๐Ÿ Django Backend
โ”‚   โ”œโ”€โ”€ manage.py                 # Django management script
โ”‚   โ”œโ”€โ”€ hackfest_project/         # Django project settings
โ”‚   โ”‚   โ”œโ”€โ”€ settings.py           # Config (DB, CORS, API keys, etc.)
โ”‚   โ”‚   โ””โ”€โ”€ urls.py               # Root URL routing
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ api/                      # ๐Ÿ”Œ REST API app
โ”‚       โ”œโ”€โ”€ models.py             # Project & Document database models
โ”‚       โ”œโ”€โ”€ views.py              # API endpoints (upload, generate, render)
โ”‚       โ”œโ”€โ”€ urls.py               # API URL routing
โ”‚       โ”œโ”€โ”€ serializers.py        # DRF request validation
โ”‚       โ”œโ”€โ”€ prompts.py            # LLM system prompts (Stranger Things themed)
โ”‚       โ”œโ”€โ”€ llm_client.py         # Groq LLM client wrapper
โ”‚       โ”œโ”€โ”€ document_loaders.py   # PDF/TXT parsing utilities
โ”‚       โ”œโ”€โ”€ schemas.py            # Pydantic data schemas
โ”‚       โ”‚
โ”‚       โ”œโ”€โ”€ services/             # Business logic layer
โ”‚       โ”‚   โ”œโ”€โ”€ ingest_service.py # Document parsing โ†’ chunking โ†’ embedding โ†’ MongoDB
โ”‚       โ”‚   โ””โ”€โ”€ rag_service.py    # RAG pipeline: retrieve context โ†’ LLM โ†’ HTML slides
โ”‚       โ”‚
โ”‚       โ””โ”€โ”€ exporters/            # Output formatters
โ”‚           โ””โ”€โ”€ html_exporter.py  # Wraps slides in Tailwind + animations for fullscreen
โ”‚
โ”œโ”€โ”€ frontend/                     # (Legacy) Original vanilla HTML/CSS/JS frontend
โ”œโ”€โ”€ test_data/                    # Sample documents for testing
โ””โ”€โ”€ env/                          # Python virtual environment

๐Ÿš€ Getting Started

Prerequisites

1. Clone & Set Up the Virtual Environment

git clone <your-repo-url>
cd Hackfest

# Create virtual environment
python -m venv env

# Activate it
# Windows:
.\env\Scripts\activate
# macOS/Linux:
source env/bin/activate

2. Install Dependencies

pip install django djangorestframework django-cors-headers
pip install python-dotenv pymongo
pip install llama-index llama-index-vector-stores-mongodb llama-index-llms-groq llama-index-embeddings-huggingface
pip install sentence-transformers PyMuPDF

3. Configure Environment Variables

Create a .env file in the project root:

MONGO_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<dbname>?retryWrites=true&w=majority
GROQ_API_KEY=gsk_your_groq_api_key_here

4. Set Up MongoDB Atlas Vector Search

  1. Go to your MongoDB Atlas cluster
  2. Create a database (e.g., hackfest_db)
  3. Create a collection (e.g., document_chunks)
  4. Go to Atlas Search โ†’ Create Index โ†’ choose JSON Editor and use:
{
  "fields": [
    {
      "type": "vector",
      "path": "embedding",
      "numDimensions": 384,
      "similarity": "cosine"
    }
  ]
}

5. Run Database Migrations

python hackfest_project/manage.py migrate

6. Start the Backend

python hackfest_project/manage.py runserver

The Django API will start at http://127.0.0.1:8000/.

7. Start the Frontend

Open a new terminal, activate the environment, and:

cd frontend-react
python -m http.server 8080

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


๐ŸŽฎ How to Use

  1. Open http://localhost:8080 in your browser
  2. Drag & drop (or browse) your PDF/TXT files into the upload zone
  3. Type a query describing what your presentation should cover, e.g.:

    "Create a presentation about electromagnetic wave interference patterns"

  4. Click "GENERATE BRIEFING DECK" and wait for the AI
  5. Navigate slides with the โ—€ PREV / NEXT โ–ถ buttons or โ†/โ†’ arrow keys
  6. Click "VIEW FULLSCREEN" for a presentation-ready view

To update an existing presentation with new information, just modify your query and click "UPDATE BRIEFING DECK" โ€” the layout and animations are preserved while the content changes.


๐Ÿ”Œ API Endpoints

Method Endpoint Description
POST /api/upload/ Upload PDF/TXT files. Returns a project_id.
POST /api/generate/ Generate a new slide deck from uploaded docs + query.
POST /api/update/ Update an existing presentation (preserves layout).
GET /api/render/<project_id>/ Get the fullscreen HTML slideshow.
GET /api/project/<project_id>/ Get project details + individual slides as an array.

Example: Generate a Presentation

# 1. Upload a document
curl -X POST http://127.0.0.1:8000/api/upload/ \
  -F "files=@my_document.pdf"

# Response: { "project_id": "abc-123-...", ... }

# 2. Generate slides
curl -X POST http://127.0.0.1:8000/api/generate/ \
  -H "Content-Type: application/json" \
  -d '{"query": "Summarize the key findings", "project_id": "abc-123-..."}'

# 3. View the presentation
# Open in browser: http://127.0.0.1:8000/api/render/abc-123-.../

๐ŸŽจ The Stranger Things Theme

The entire UI is designed with a Stranger Things / Upside Down aesthetic:

  • Dark reddish gradients (from-[#0a0000] via-[#1a0505] to-[#2a0a0a])
  • Glassmorphism cards with red tints and backdrop blur
  • Neon red accents and glowing text effects
  • Share Tech Mono font for that retro-terminal feel
  • Floating particle spores drifting across the screen
  • Flickering header animation (like Hawkins Lab lights)
  • 7 animation types: fade-in, fade-up, fade-down, fade-left, fade-right, zoom-in, slide-in
  • Staggered delays so elements appear sequentially on each slide

๐Ÿง  How the AI Pipeline Works

User uploads documents
        โ”‚
        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  1. INGEST            โ”‚  PyMuPDF parses PDFs โ†’ chunks text
โ”‚     Document Loader   โ”‚  Sentence-Transformers creates embeddings
โ”‚     + Embeddings      โ”‚  Stores vectors in MongoDB Atlas
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
            โ”‚
            โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  2. RETRIEVE (RAG)    โ”‚  User query โ†’ vector similarity search
โ”‚     LlamaIndex        โ”‚  Returns top-10 most relevant chunks
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
            โ”‚
            โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  3. GENERATE          โ”‚  System prompt + context + query
โ”‚     Groq LLM          โ”‚  โ†’ Raw Tailwind HTML slides with
โ”‚     (llama/mixtral)    โ”‚    CSS animations & Stranger Things theme
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
            โ”‚
            โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  4. RENDER            โ”‚  HTML Exporter wraps slides with
โ”‚     HTML Exporter     โ”‚  Tailwind CDN + animation keyframes
โ”‚                       โ”‚  โ†’ Slideshow with keyboard navigation
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โš™๏ธ Tech Stack

Layer Technology Purpose
Frontend React 18 (CDN) UI components
Styling Tailwind CSS (CDN) Slide design + responsive layout
JSX Compile Babel Standalone In-browser JSX โ†’ JS compilation
Backend Django + DRF REST API + file handling
LLM Groq (via LlamaIndex) Slide content generation
Embeddings Sentence-Transformers Document chunk embeddings
Vector DB MongoDB Atlas Vector search for RAG retrieval
Doc Parsing PyMuPDF PDF text extraction

๐Ÿ› Troubleshooting

Issue Fix
ModuleNotFoundError: No module named 'dotenv' Run pip install python-dotenv
CORS errors in browser console Make sure django-cors-headers is installed and CORS_ALLOW_ALL_ORIGINS = True in settings.py
Blank presentation panel Check Django server logs for LLM errors. Ensure GROQ_API_KEY is valid.
Slides show as one big block The LLM may not have produced <!-- SLIDE_BREAK --> markers. Try regenerating.
Frontend won't load Make sure you're running python -m http.server from the frontend-react/ directory

๐Ÿ“œ License

Built for Hackfest ๐Ÿ†


"Mornings are for coffee and contemplation." โ€” Chief Hopper

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors