Skip to content

InfinityDoodle/james-fusion-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

James Divin Fusion Game

This repository contains a small game that lets you imaginatively "fuse" James Divin with anything you can think of.
The game is split into two parts:

  1. Frontend – a tiny single-page web-app that lives on Netlify.
  2. Backend – a Python FastAPI micro-service that talks to the OpenAI API.

1 · Frontend (Netlify)

The frontend is completely static and therefore a perfect fit for Netlify. All files are inside the frontend/ folder.

frontend/
 ├── index.html
 ├── script.js
 └── style.css

Local preview

cd frontend
npx serve .

The page will prompt you for the backend URL (see next section).

Deploy to Netlify

  1. Push this repo to a Git provider (GitHub, GitLab, Bitbucket).
  2. In Netlify, Create a new site from Git and pick the repo.
  3. In the build settings set:
    • Build command: (leave empty – static site)
    • Publish directory: frontend
  4. Click Deploy site.

Netlify will assign a public URL (e.g. https://james-fusion.netlify.app).


2 · Backend (Python / FastAPI)

Because Netlify Functions don't support Python at runtime, the backend runs on any service that can host a Python web-server (Render, Railway, Fly.io, etc.).

backend/
 ├── main.py          # FastAPI application
 ├── requirements.txt # Python deps
 └── .env.example     # Environment variables template

Environment variables

Copy backend/env.template.env and fill in:

OPENAI_API_KEY=sk-************************
JAMES_BIO="<Paste James' bio here>"

Local dev

cd backend
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload --port 8000

Deploy suggestions

  • Render.comBlueprint deploy: connect repo, pick ./backend as root, start command uvicorn main:app --host 0.0.0.0 --port 10000, and add env vars.
  • Railway.app – create a new Python service from Git.
  • Fly.iofly launch inside backend/.

Make note of the public HTTPS URL – you will enter it on the frontend.


3 · Wiring the two together

When the frontend loads it asks for the backend endpoint (https://your-backend-host.xyz). It then sends a POST /combine request whenever the player presses Enter.

The backend calls ChatGPT 4o to get:

  • text_description – 2-3 fun sentences describing the fusion.
  • image_description – a short prompt for DALL·E.
  • image_url – a freshly generated DALL·E image URL.

All three are returned to the frontend, which updates the page.


Happy fusing! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published