The missing piece in your DIY journey. Transform any DIY URL into a pristine, visual-first learning guide using NanoCraft
NanoCraft is an AI-powered web application designed to simplify learning for makers, creators, and DIY enthusiasts. It takes an existing DIY guide such as an Instructables URL scrapes its content, and leverages Google Gemini to transform dense, raw text into a structured, step-by-step visual guide. Additionally, NanoCraft automatically generates relevant scene images for each step using Cloudflare Workers AI and provides a context-aware AI chatbot to answer any questions you might have about the project.
Follow these detailed instructions to set up NanoCraft locally.
git clone https://github.com/vynride/NanoCraft.git
cd NanoCraftNavigate to the backend directory and set up your environment variables.
You can use the provided .env.example as a reference.
cd backend
cp .env.example .envYou will need to acquire API keys for the following services:
- Google Gemini: Get your API key from Google AI Studio.
- Cloudflare Workers AI: Get your setup details from the Cloudflare Developer Portal.
- MongoDB Atlas: Set up a free cluster on MongoDB and get your connection string.
Update the .env file with these credentials.
While still in the backend directory, create and activate a Python virtual environment, then install the dependencies:
# Create a virtual environment
python3 -m venv .venv
# Activate the virtual environment
# On Linux/macOS:
source .venv/bin/activate
# On Windows:
# .venv\Scripts\activate
# Install requirements
pip install -r requirements.txtOpen a new terminal, navigate to the frontend directory, and install the Node.js packages:
cd frontend
npm install- Backend: Run the FastAPI server inside your activated virtual environment:
uvicorn main:app --reload
- Frontend: Start the Vite development server:
npm run dev
NanoCraft is composed of a decoupled frontend and backend that communicate via REST APIs.
- Input Submission: A user pastes a DIY project URL into the frontend application.
- Scraping: The React application sends a POST request to the FastAPI backend, which safely scrapes the target URL.
- Data Structuring: The backend passes the scraped content to Google Gemini to extract a structured layout containing a project summary, a visual anchor, and individual steps with scene descriptions.
- Data Persistence: The structured project data is stored in MongoDB.
- Image Generation: The backend triggers an asynchronous background process that generates images for each step using Cloudflare Workers AI. These images are stored in MongoDB's GridFS.
- Polling & Rendering: The frontend polls the backend and progressively renders the project instructions and generated images as they complete.
- Contextual Chat: The user can interact with the DIY Chatbot natively integrated into the workspace sidebar, which utilizes project data and Gemini to answer specific questions about the materials and steps.
NanoCraft/
├── backend/ # FastAPI Application
│ ├── main.py # Entry point, routing, and background generation tasks
│ ├── db/ # MongoDB connection and GridFS operations
│ ├── models/ # Pydantic models (Instruction, Project, Step)
│ ├── utils/ # Integrations (scraper.py, gemini.py, workers.py, chat.py)
│ ├── requirements.txt # Python dependencies
│ └── .env.example # Template for environment variables
└── frontend/ # React & Vite Application
├── index.html # Main HTML with SEO tags
├── package.json # Node dependencies
├── src/
│ ├── pages/ # Top-level view components (Landing, Workspace, Chat)
│ ├── components/ # Reusable UI elements (Sidebar, Logo, SEOHead)
│ └── services/ # API abstraction layer
└── public/ # Static assets
- Frontend: React, Vite, React Router, TailwindCSS.
- Backend: Python, FastAPI.
- Database: MongoDB (Atlas) & GridFS.
- AI Services: Google Gemini API, Cloudflare Workers AI.