DEV Community

Abhishek Sahu
Abhishek Sahu

Posted on

Ghost in the Machine 👻: Creating Ghost Stories with Local AI

👻 Ghost in the Machine

What if the machine in your room could tell you a ghost story without sending your prompt to a hosted AI API?

This is my submission for the Hacktoberfest Open-Source AI Challenge — Week 4: Ghost in the Machine.

What I Built

Ghost in the Machine is a local AI-powered ghost story generator. Users enter a prompt and the application generates a spooky story using the Gemma 3 1B model through Ollama.

I built this project to explore how open-weight AI models can power creative applications on a local machine.

The project combines a React and TypeScript frontend with an Express backend and local AI inference.

Demo

GitHub repository:

https://github.com/abhishekkumarsahu1234567-rgb/ghost-in-the-machine

Live Demo:

https://frontend-puce-chi-10.vercel.app

The project is deployed with a React and TypeScript frontend on Vercel and an Express backend on Render. It uses the Groq API for hosted AI story generation, allowing users to generate spooky stories from their own prompts.

A publicly hosted demo is not available yet. The project is intended to run locally.

To try it:

  1. Install Node.js and Ollama.
  2. Download the model:
   ollama pull gemma3:1b
Enter fullscreen mode Exit fullscreen mode
  1. Start Ollama and keep it running.
  2. Open a terminal in the backend directory, install dependencies with npm install, and start the server using node server.js.
  3. Open another terminal in the frontend directory, run npm install, and then run npm run dev.
  4. Open the local URL printed by Vite and enter a spooky prompt.

The frontend and backend must both be running for story generation to work.

Code

Explore the complete project source code:

View Ghost in the Machine on GitHub

The repository contains the frontend, backend, and project configuration.

How I Built It

The project uses:

  • React + TypeScript + Vite: For the interactive user interface.
  • Node.js + Express: For the story-generation API.
  • Ollama: To run the language model locally.
  • Gemma 3 1B: The open-weight model used for generating stories.

When a user submits a prompt, the frontend sends a request to the backend. The backend communicates with the locally running Ollama model and returns the generated story to the frontend.

Why Does Open Innovation Matter?

Open-weight models make it possible for developers to experiment with AI without depending entirely on a hosted model API.

For a project like this, local inference offers several advantages:

  • More control: Developers can choose and run a model on their own machine.
  • Experimentation: It is easier to explore prompts, model behaviour, and creative use cases.
  • Reduced API dependency: Story generation can work without a paid hosted-model API, provided the local model and required resources are available.
  • Privacy potential: Prompts can remain on the local machine when the application is configured without external services.

Local inference still requires suitable hardware and consumes system resources. Privacy also depends on the complete application configuration.

The Spirit of It 👻

The theme Ghost in the Machine 👻 inspired me to build something that feels playful and slightly mysterious while experimenting with AI-powered storytelling.

I wanted to turn AI-powered storytelling into a small creative experience where users can enter their own ideas and generate atmospheric spooky stories.

This project is an exploration of local AI, full-stack development, and the possibilities of open technology.

What's Next?

Some improvements I would like to explore include:

  • Story length and horror-intensity controls.
  • Different storytelling styles.
  • Better loading and error states.
  • A gallery of generated stories.
  • A recorded demo showing the complete experience.

Thanks for checking out my project!

Built by: Abhishek Kumar Sahu

Project: Ghost in the Machine 👻

Top comments (0)