✨ Inspiration

The idea for DreamWeaver was born out of a fascination with dreams, creativity, and the strange way our imagination can turn random ideas into beautiful stories.
I wanted to create a digital storyteller — something that could take a small spark of a thought and spin it into a surreal, poetic narrative.

When I first experimented with the Google Gemini API, I was amazed at how naturally it could generate dreamlike text.
That was the seed of DreamWeaver — a space where anyone could type a few words and watch an entire world unfold.

“Dreams are the mind’s way of telling stories we never dared to write.”


🛠️ How I Built It

The project is powered by:

  • Node.js + Express for the backend
  • MySQL for storing generated dreams
  • HTML, CSS, and Vanilla JavaScript for the frontend
  • Gemini API for story generation

The frontend uses a glassmorphism-inspired design, symbolizing the hazy, fragile beauty of dreams.
Each story type (💤 Dreamy, 💀 Horror, 🧚 Fantasy, etc.) sends a slightly modified prompt to Gemini, which tailors the tone and theme of the story.

The system also detects keywords like “short”, “long”, or “medium” to adjust story length dynamically — a subtle but useful touch to respect the token limits of the free Gemini API tier.


🧠 What I Learned

  1. Prompt engineering matters.
    The phrasing of the prompt dramatically changes the emotional tone and structure of the story.
    For example:

    • Prompt: "Dreamy story: a glowing forest"
      → Generates poetic, abstract text.
    • Prompt: "Horror story: a glowing forest"
      → Turns eerie and suspenseful.
  2. Balancing creativity and constraints.
    Working with the free Gemini tier meant limited token lengths and rate caps.
    I learned to optimize text prompts, use concise wording, and detect user intent automatically.

  3. Frontend–backend harmony.
    Ensuring smooth async calls and dynamic UI updates helped me deepen my understanding of REST APIs and modern JavaScript workflows.

  4. Database design with real-world scaling in mind.
    I learned to structure story data efficiently using MySQL — storing prompts, stories, tags, and timestamps for future filtering and analytics.


⚙️ Challenges I Faced

  • Free-tier limitations of the Gemini API forced me to think creatively.
    I couldn’t just generate massive stories — I had to guide the model to be concise and expressive within 500–1000 tokens.

  • Prompt interpretation quirks.
    Gemini sometimes took “short” literally and made stories too short!
    To handle this, I wrote keyword-based length detection using simple NLP logic:

    const lengthWords = {
    short: 100,
    medium: 300,
    long: 600
    };
    
Share this project:

Updates

posted an update

Update: My First Hackathon Experience

DreamWeaver was my very first hackathon project! I joined Maximally PromptStorm to explore how AI could transform imagination into surreal stories — and ended up learning so much about prompt design, full-stack building, and creative AI storytelling.

It was challenging but exciting to complete everything in just 24 hours. I’m proud that my first hackathon taught me how creativity and code can dream together

Log in or sign up for Devpost to join the conversation.