A CLI tool to scaffold React Three Fiber projects with or without physics (Rapier). Quickly bootstrap your 3D web applications with modern tooling and best practices.
- Interactive CLI: Choose your project name, language, and features
- Language Support:
- TypeScript: Full type safety with TypeScript configuration
- JavaScript: Simple JavaScript setup for quick prototyping
- Two Template Options:
- Basic Template: React Three Fiber with essential 3D features
- Physics Template: Includes Rapier physics engine for realistic interactions
- Modern Stack: Built with Vite, ESLint, and modern tooling
- Ready to Use: Pre-configured with all necessary dependencies
npm install -g r3f-template
npm install r3f-template
npx r3f-template
r3f-template
The CLI will prompt you for:
- Project Name: The name of your new project
- Language: Choose between TypeScript or JavaScript
- Template: Choose between Basic or Physics (Rapier) template
$ r3f-template
? Enter your project name: my-3d-game
? Choose your language: TypeScript
? Choose your template: Physics (Rapier)
โ
Project created in ./my-3d-game
๐ Run 'cd my-3d-game'
๐ Run 'npm install'
๐ Run 'npm run dev'
my-project/
โโโ src/
โ โโโ Components/
โ โ โโโ Lights.tsx
โ โ โโโ Suzanne.tsx
โ โโโ App.tsx
โ โโโ App.css
โ โโโ index.css
โ โโโ main.tsx
โ โโโ vite-env.d.ts
โโโ public/
โ โโโ suzanne.glb
โโโ package.json
โโโ vite.config.ts
โโโ tsconfig.json
โโโ tsconfig.app.json
โโโ tsconfig.node.json
โโโ eslint.config.js
my-project/
โโโ src/
โ โโโ Components/
โ โ โโโ Lights.jsx
โ โ โโโ Suzanne.jsx
โ โโโ App.jsx
โ โโโ App.css
โ โโโ index.css
โ โโโ main.jsx
โโโ public/
โ โโโ suzanne.glb
โโโ package.json
โโโ vite.config.js
โโโ eslint.config.js
my-project/
โโโ src/
โ โโโ Components/
โ โ โโโ Lights.tsx
โ โ โโโ Player.tsx
โ โ โโโ Ground.tsx
โ โ โโโ Suzanne.tsx
โ โโโ App.tsx
โ โโโ App.css
โ โโโ index.css
โ โโโ main.tsx
โ โโโ vite-env.d.ts
โโโ public/
โ โโโ suzanne.gltf
โโโ package.json
โโโ vite.config.ts
โโโ tsconfig.json
โโโ tsconfig.app.json
โโโ tsconfig.node.json
โโโ eslint.config.js
my-project/
โโโ src/
โ โโโ Components/
โ โ โโโ Lights.jsx
โ โ โโโ Player.jsx
โ โ โโโ Ground.jsx
โ โ โโโ Suzanne.jsx
โ โโโ App.jsx
โ โโโ App.css
โ โโโ index.css
โ โโโ main.jsx
โโโ public/
โ โโโ suzanne.gltf
โโโ package.json
โโโ vite.config.js
โโโ eslint.config.js
@react-three/drei
- Useful helpers for React Three Fiber@react-three/fiber
- React renderer for Three.jsreact
&react-dom
- React corethree
- 3D libraryvite
- Build tooleslint
- Code lintingtypescript
(TypeScript template only) - Type safety
@react-three/rapier
- Physics engine integration
After creating your project:
cd my-project
npm install
npm run dev
Your 3D application will be available at http://localhost:5173
- 3D Scene Setup: Pre-configured Canvas with proper lighting
- Suzanne Model: Classic 3D model for testing
- TypeScript Support: Full type safety (TypeScript template)
- Hot Reload: Fast development with Vite
- ESLint: Code quality and consistency
- Rapier Physics: Realistic physics simulation
- Player Controller: First-person movement with keyboard controls (WASD/Arrow keys for movement, Space for jumping)
- Mouse Look: Pointer lock controls for camera rotation
- Collision Detection: Proper physics bodies and colliders
- Interactive Environment: Physics-enabled ground plane
- Camera Follow: Camera automatically follows the player position
The physics template includes a fully functional player controller with controls already implemented:
- Movement: Use WASD keys or Arrow keys to move
- Jump: Press Spacebar to jump
- Mouse Look: Click to lock mouse pointer and look around
- Exit Mouse Lock: Press Escape to unlock mouse
Note: All controls are pre-configured and ready to use - no additional setup required!
- 3D Web Applications: Interactive 3D experiences
- Games: Browser-based 3D games
- Visualizations: Data and scientific visualizations
- Prototypes: Quick 3D concept validation
- Educational Projects: Learning Three.js and React Three Fiber
Both templates are fully customizable:
- Add Models: Replace or add 3D models in the
public/
directory - Modify Components: Edit components in
src/Components/
- Extend Physics: Add more physics bodies and interactions
- Styling: Customize CSS in
src/App.css
andsrc/index.css
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Sathish - GitHub
Made with โค๏ธ for the React Three Fiber community