A next-generation platform for interactive 3D molecular generation, visualization, and explanation — built with AI, React, Django, and Three.js.
- Overview
- Key Features
- Prerequisites
- Usage
- Project Structure
- Screenshots
- Tech-Stack
- System Architecture
- Setup Guide
- Acknowledgements
Moleculens is an end‑to‑end chemistry platform that allows users to:
- Generate 3D molecular structures (GLB) using natural‑language prompts
- Visualize models interactively in a high‑fidelity Three.js viewer
- Automatically generate atom‑level metadata for color legends
- Maintain multi‑message chat sessions with persistent history
- Explore a library of prebuilt molecules with thumbnails
- View a cinematic 3D landing page
-
Hero Landing Section
-
AI-powered molecule generation from text prompts
-
3D molecule viewer using Three.js + GLTF
-
Chat system with saved sessions
-
Automatic GLB model generation + thumbnails
-
Full-stack setup using Django REST API + React frontend
-
Modern UI with glass morphism, and dynamic layout switching
-
Session persistence, pinning, and deletion
-
Split-pane model + chat mode
Before installing, ensure you have:
Backend
- Python 3.10+
- pip
- Conda (recommended for RDKit)
- RDKit (
conda install -c conda-forge rdkit) - ollama
- gpt-oss:20b model(
ollama run gpt-oss:20b) - llama3:8b model (
ollama run llama3:8b)
Frontend
- Node.js 16+
- npm or yarn
Home Page
- Scroll through molecule templates
- Click a molecule card to load its 3D model
- Or type a prompt: “Generate ethanol molecule”
3D Viewer
- Rotate by dragging
- Zoom using mouse wheel
- Atom list appears on top right
- Idle animation rotates molecule automatically
Chat Mode
- AI answers chemistry questions
- Every model generated appears as a thumbnail at bottom
- Sidebar stores all chats
- You can pin, reopen, or delete sessions
Sidebar
- List of all sessions
- Search bar
- Pin/unpin
- Slick glass-morphism design
src/
├─ components/
│ ├─ Landing3D.jsx
│ ├─ DNAModel.jsx
│ ├─ LockedControls.jsx
│ ├─ ThreeViewer.jsx
│ ├─ ChatBox.jsx
│ ├─ Sidebar.jsx
│ ├─ HomeGrid.jsx
│ ├─ MoleculeCard.jsx
│ ├─ Header.jsx
│ ├─ BackButton.jsx
│ ├─ InputBar.jsx
│ └─ LoadingIndicator.jsx
│
├─ App.jsx
├─ App.css
└─ assets/
backend/
├─ api/
│ ├─ views.py → All API endpoints (generate-model, sessions, chat, delete, templates)
│ ├─ generator.py → Model-generation engine (SMILES → RDKit → GLB)
│ ├─ vector_search.py → RAG + semantic search + PubChem fallback
│ ├─ llm_client.py → LLM communication wrapper (Ollama/OpenAI)
│ ├─ urls.py → API route definitions
| ├─ serializers.py
│ └─ models.py → Django DB models (ChatSession, ModelTemplate, ChatMessage, etc.)
│
├─ media/
│ ├─ models/ → Auto-generated GLB molecules
│ └─ thumbnails/ → Auto-generated PNG thumbnails
│
├─ db.sqlite3 → SQLite database
├─ manage.py → Django management script
└─ requirements.txt
Backend:
- Django / Django REST Framework
- RDKit (molecule generation)
- Python 3.10+
Frontend:
- React + Vite
- TailwindCSS
- Three.js
- Framer Motion
- GLTFLoader / OrbitControls
git clone https://github.com/AbhinavDShetty/Hack-Babies-2.0.git
cd Hack-Babies-2.0cd backend
python -m venv venvActivate it
Windows:
venv\Scripts\activateMac/Linux:
source venv/bin/activatepip install -r requirements.txtpython manage.py runserverIf successful, the backend should run at:
cd frontend
npm installnpm run devYour frontend will run at:
Ensure your frontend API base is set correctly:
Inside App.jsx:
const API_BASE = "http://127.0.0.1:8000";Backend CORS should allow frontend:
CORS_ALLOW_ALL_ORIGINS = True- Scroll through molecule presets
- Click a molecule card to view its 3D model
- Or use the input bar to ask for any molecule ("generate methane", "show aspirin", etc.)
- Drag to rotate
- Scroll to zoom
- Smooth idle animations
- Atom list displays colors + symbols
- Load previous generated models from the thumbnails bar
- Ask chemistry questions
- Models and explanations are automatically saved
- Sessions appear in the sidebar
- You can pin, delete, or reopen chats
- Every generated molecule is saved as:
- .glb model
- Thumbnail
- Chat session
- Re-open instantly anytime
To wipe previous models & chats:
Remove Django migrations & DB
rm backend/db.sqlite3Delete media folder
rm -rf backend/mediaRecreate DB
python manage.py migrateSpecial thanks to:
- RDKit Team — for molecular generation tools
- Three.js Community — for 3D rendering libraries
- React + Vite — for a fast frontend
- OpenAI / LLM frameworks — for powering the chemistry explanations
You have fully configured Moleculens. Start generating molecules, exploring structures, and chatting with AI chemistry.





