{"id":43614627,"url":"https://github.com/pyrex41/sim_poc","last_synced_at":"2026-02-04T12:23:48.291Z","repository":{"id":324318260,"uuid":"1096748727","full_name":"pyrex41/sim_poc","owner":"pyrex41","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-22T06:17:10.000Z","size":16997,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-22T07:12:42.726Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyrex41.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-14T22:21:47.000Z","updated_at":"2025-11-17T03:56:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"14f7ea76-61e1-4582-8b70-b0e9d68f8590","html_url":"https://github.com/pyrex41/sim_poc","commit_stats":null,"previous_names":["pyrex41/sim_poc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pyrex41/sim_poc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrex41%2Fsim_poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrex41%2Fsim_poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrex41%2Fsim_poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrex41%2Fsim_poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyrex41","download_url":"https://codeload.github.com/pyrex41/sim_poc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrex41%2Fsim_poc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29084188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T03:31:03.593Z","status":"ssl_error","status_checked_at":"2026-02-04T03:29:50.742Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-04T12:23:47.635Z","updated_at":"2026-02-04T12:23:48.287Z","avatar_url":"https://github.com/pyrex41.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI-Powered Physics Simulator\n\nA sophisticated 3D physics simulation platform that uses cutting-edge AI to generate and refine physics scenes through natural language prompts. Built with Elm frontend and FastAPI backend, featuring real-time physics simulation powered by Rapier.js.\n\n## 🚀 Features\n\n### AI-Powered Scene Generation\n- **Claude Sonnet 4.5**: Latest Anthropic AI model for intelligent scene creation\n- **Natural Language Prompts**: Generate complex physics scenes from text descriptions\n- **Scene Refinement**: Modify existing scenes with conversational AI\n- **Context-Aware**: AI understands physics principles and realistic object interactions\n\n### Real-Time 3D Physics Simulation\n- **Rapier Physics Engine**: High-performance, WebAssembly-powered physics\n- **Realistic Physics**: Gravity, collisions, friction, and restitution\n- **Multiple Object Types**: Boxes, spheres, cylinders with customizable properties\n- **Dynamic Interactions**: Objects interact naturally in real-time\n\n### Interactive 3D Editor\n- **Transform Controls**: Move, rotate, and scale objects with visual gizmos\n- **Property Editing**: Adjust mass, friction, restitution, and visual properties\n- **Object Selection**: Click to select objects with visual feedback\n- **Real-Time Updates**: See physics changes instantly\n\n### Advanced Features\n- **Undo/Redo System**: Full history tracking with keyboard shortcuts\n- **Local Storage**: Scenes persist across browser sessions\n- **Keyboard Shortcuts**: Space (play/pause), G/R/S (transform modes), Ctrl+Z/Y (undo/redo)\n- **Responsive UI**: Modern, clean interface optimized for physics simulation\n\n## 🛠️ Technology Stack\n\n### Frontend\n- **Elm 0.19.1**: Functional programming language for reliable UIs\n- **Three.js**: 3D graphics and rendering\n- **Rapier.js**: WebAssembly physics engine\n- **Vite**: Fast development server and build tool\n\n### Backend\n- **FastAPI**: High-performance Python web framework\n- **OpenRouter API**: Access to Claude Sonnet 4.5 via OpenAI-compatible interface\n- **Pydantic**: Data validation and serialization\n- **Uvicorn**: ASGI server for production deployment\n\n### AI Integration\n- **Claude Sonnet 4.5**: Anthropic's most advanced AI model\n- **1M Token Context**: Massive context window for complex scene generation\n- **OpenRouter**: Multi-provider AI routing with automatic fallbacks\n\n## 📋 Prerequisites\n\n- **Python 3.14+** with virtual environment support\n- **Node.js 16+** and npm\n- **OpenRouter API Key** (for AI scene generation)\n\n## 🚀 Quick Start\n\n### 1. Clone and Setup\n```bash\ngit clone \u003crepository-url\u003e\ncd physics-simulator\n```\n\n### 2. Backend Setup\n```bash\ncd backend\npython3 -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\npip install -r requirements.txt\n```\n\n### 3. Frontend Setup\n```bash\n# In a separate terminal\nnpm install\n```\n\n### 4. Environment Configuration\nCreate a `.env` file in the backend directory:\n```bash\nOPENROUTER_API_KEY=your_openrouter_api_key_here\n```\n\n### 5. Start the Application\n```bash\n# Terminal 1: Backend\ncd backend \u0026\u0026 source venv/bin/activate\nOPENROUTER_API_KEY=your_key python main.py\n\n# Terminal 2: Frontend\nnpm run dev\n```\n\n### 6. Open in Browser\nNavigate to `http://localhost:5173`\n\n## 🎮 Usage Guide\n\n### Generating Scenes\n1. Enter a natural language prompt in the left panel\n2. Click \"Generate Scene\" to create a new physics scene\n3. Watch as AI creates realistic objects with proper physics properties\n\n### Example Prompts\n- \"a red ball bouncing on a wooden table\"\n- \"stack of colorful boxes with a sphere rolling between them\"\n- \"pyramid of spheres on a ramp with a cube at the bottom\"\n\n### Editing Scenes\n1. **Select Objects**: Click on objects in the 3D view\n2. **Transform**: Use G (move), R (rotate), S (scale) keys\n3. **Properties**: Adjust physics properties in the right panel\n4. **Refine**: Use the \"Refine Scene\" feature to modify with AI\n\n### Physics Controls\n- **Play/Pause**: Spacebar or play button\n- **Reset**: Reload the page to reset the scene\n- **Undo/Redo**: Ctrl+Z / Ctrl+Y\n\n## 🔧 API Reference\n\n### Backend Endpoints\n\n#### Generate Scene\n```http\nPOST /api/generate\nContent-Type: application/json\n\n{\n  \"prompt\": \"a bouncing ball and a wooden box\"\n}\n```\n\n#### Refine Scene\n```http\nPOST /api/refine\nContent-Type: application/json\n\n{\n  \"scene\": {...},\n  \"prompt\": \"make the ball blue\"\n}\n```\n\n### Scene Format\n```json\n{\n  \"objects\": {\n    \"object_id\": {\n      \"id\": \"object_id\",\n      \"transform\": {\n        \"position\": {\"x\": 0.0, \"y\": 5.0, \"z\": 0.0},\n        \"rotation\": {\"x\": 0.0, \"y\": 0.0, \"z\": 0.0},\n        \"scale\": {\"x\": 1.0, \"y\": 1.0, \"z\": 1.0}\n      },\n      \"physicsProperties\": {\n        \"mass\": 1.0,\n        \"friction\": 0.5,\n        \"restitution\": 0.3\n      },\n      \"visualProperties\": {\n        \"color\": \"#ff0000\",\n        \"shape\": \"Box\"\n      }\n    }\n  },\n  \"selectedObject\": null\n}\n```\n\n## 🏗️ Architecture\n\n### Frontend Architecture (Elm)\n```\nMain.elm\n├── Model: Scene, UI state, simulation state\n├── Update: Message handling and state transitions\n├── View: Three-panel layout with canvas integration\n└── Ports: Communication with JavaScript/Three.js\n```\n\n### Backend Architecture (FastAPI)\n```\nmain.py\n├── AI Client: OpenRouter integration with Claude Sonnet 4.5\n├── Scene Generation: AI-powered scene creation\n├── Scene Refinement: Conversational scene modification\n└── API Endpoints: RESTful physics scene management\n```\n\n### Physics Integration\n```\nPhysicsRenderer.js (Three.js + Rapier)\n├── Scene Management: Object creation and updates\n├── Physics Simulation: Real-time physics calculations\n├── Transform Controls: Interactive object manipulation\n└── Rendering: WebGL-accelerated 3D graphics\n```\n\n## 🔒 Security \u0026 Privacy\n\n- **API Key Security**: OpenRouter API key stored server-side only\n- **No Data Persistence**: Scenes exist only in browser memory\n- **Local Storage**: Optional scene saving in browser localStorage\n- **CORS Protection**: Configured for localhost development\n\n## 🚀 Deployment\n\n### Development\n```bash\n# Backend\ncd backend \u0026\u0026 source venv/bin/activate\nuvicorn main:app --reload --host 0.0.0.0 --port 8000\n\n# Frontend\nnpm run dev -- --host 0.0.0.0\n```\n\n### Production Build\n```bash\n# Frontend\nnpm run build\n\n# Backend (using gunicorn)\ngunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker\n```\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature-name`\n3. Make changes and test thoroughly\n4. Commit changes: `git commit -am 'Add feature'`\n5. Push to branch: `git push origin feature-name`\n6. Submit a pull request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## 🙏 Acknowledgments\n\n- **Anthropic**: For Claude Sonnet 4.5 AI model\n- **OpenRouter**: For AI model access and routing\n- **Rapier Physics**: For high-performance WebAssembly physics\n- **Three.js**: For 3D graphics and WebGL rendering\n- **Elm**: For reliable functional programming frontend\n\n## 📞 Support\n\nFor questions or issues:\n- Create an issue on GitHub\n- Check the troubleshooting section below\n\n## 🔧 Troubleshooting\n\n### Common Issues\n\n**Backend won't start:**\n- Ensure Python virtual environment is activated\n- Check OPENROUTER_API_KEY environment variable\n- Verify all dependencies are installed: `pip install -r requirements.txt`\n\n**Frontend compilation errors:**\n- Run `npm install` to ensure all dependencies\n- Check Elm version: `elm --version` (should be 0.19.1)\n- Clear Elm cache: `rm -rf elm-stuff \u0026\u0026 elm install`\n\n**Physics not working:**\n- Check browser console for WebAssembly errors\n- Ensure modern browser with WebGL support\n- Try refreshing the page\n\n**AI generation fails:**\n- Verify OpenRouter API key is valid\n- Check API quota and billing status\n- Ensure internet connection for API calls\n\n### Development Tips\n\n- Use browser developer tools to inspect 3D scene\n- Check browser console for Elm runtime errors\n- Monitor network tab for API request/response\n- Use browser localStorage inspector for saved scenes\n\n---\n\n**Built with ❤️ using cutting-edge AI and modern web technologies**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrex41%2Fsim_poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyrex41%2Fsim_poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrex41%2Fsim_poc/lists"}