MCPcopy Index your code
hub / github.com/eylonmiz/react-agent

github.com/eylonmiz/react-agent @initial-release

Chat with this repo
repository ↗ · DeepWiki ↗ · release initial-release ↗ · + Follow
352 symbols 814 edges 246 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ReactGPT - The open-source React LLM Agent

<img src="https://res.cloudinary.com/tutim/image/upload/v1683754893/ReactGPT/ReactGPT-flow_bpdwwf.png" alt="Logo"/>








<h3>The open-source React LLM Agent</h3>



<a href="https://www.loom.com/share/658adb2869174e81a39a0a2cdcfec4eb"><strong>Watch Demo »</strong></a>






<a href="https://tutim.io/gpt">Website</a>
·
<a href="https://www.loom.com/share/658adb2869174e81a39a0a2cdcfec4eb">Watch Demo</a>
·
<a href="https://github.com/tutim-io/react-gpt/pull/1/files">Demo Code Example</a>
·
<a href="https://discord.tutim.io">Discord</a>

MIT License Number of GitHub stars Discord is Live Docs are updated Product Hunt

Demo


📖 Introduction

React-GPT is an experimental application that uses the GPT-4 language model to generate React components from user stories. It is built with React, TailwindCSS, Typescript, Radix UI, Shandcn UI, and OpenAI API.

🚀 Features

  • Generate React Components from user stories
  • Compose React Components from existing components
  • Use a local design system to generate React Components
  • Use React, TailwindCSS, Typescript, Radix UI, Shandcn UI
  • Built with Atomic Design Principles

🌈 Quickstart

  1. Clone repository
git clone git@github.com:tutim-io/react-gpt.git
  1. Change to the project directory
cd react-gpt
  1. Get an OpenAI API Key
  2. Set OPENAI_SECRET_KEY in backend/main .env file (see .env.example) or run the script below
echo OPENAI_SECRET_KEY="INSERT_YOUR_OPENAI_SECRET_KEY_VALUE_HERE" >> backend/main/.env
  1. Install dependencies
yarn install
  1. Run Backend Script - This script generates the componenets
yarn backend:dev
  1. Run Frontend App to see your components in action
yarn frontend:dev
  1. Open frontend/main/src/GenReactApp.tsx
Read the instructions and change the example component to the component you generated
  1. Read Project Customization Section
Read the Project Customization Section to learn how to customize and operate the project

📚 Documentation

PRD / User Story to code

Feature Flow

Component Generation Flow

Component Generator

🛠️ Project Customization

  1. Customize workflow:
  2. file: backend/main/react-gen/generateComponents.ts
  3. description: Can control the flow of the generation process, run step by step or full flow.
  4. Render Application
  5. file: frontend/main/src/GenReactApp.tsx
  6. description: Render the generated application, see examples in the file.
    • use JsonSkeleton to render the skeleton of the page
    • use demo.tsx files to render the demo page
  7. Generate React Components
  8. folder: create a folder under LOCAL_COMPONENTS_DIR (default frontend/main/src/react-gpt) (see .env.example file)
  9. description: Generate a user-story.md file under the folder, make it as detailed as possible.
  10. change CONTAINER_PATH in generateComponents.ts to the folder name
  11. run the backend script to generate the React Components.
  12. Customize Folder Structure (see .env.example file)
  13. UI_COMPONENTS_DIR - Where your UI components are located
  14. DEMO_COMPONENTS_DIR - Where your UI components demo files are located
  15. LOCAL_COMPONENTS_DIR - Where your generated components are located

📦 Next Steps

  • Edit existing components
  • Test Components after generating
  • Wireframe image to skeleton code
  • Remote design system to generate React Components
  • Use of external libraries
  • Component logic control (state, props, context, effects, api calls, etc.)

⚠️ Limitations

  • The generated code is not production-ready and should be used for prototyping purposes only.
  • Only works well with GPT4, GPT-3.5 is not supported ATM, so make sure you have GPT4 enabled in your OpenAI account.
  • The output may come with a few bugs and errors, so it is recommended to review and test the code before using it in a production environment, or even running it in a development environment.
  • The first step of the generation process is to convert the user story into a JSON file. This step is not perfect and may result in some inaccuracies or missing information, consider changing the JSON file manually if necessary.
  • Advised to run it step by step, and review the generated code after each step.

🛡 Disclaimer

This project, React-GPT, is an experimental application and is provided "as-is" without any warranty, express or implied. By using this software, you agree to assume all risks associated with its use, including but not limited to data loss, system failure, or any other issues that may arise.

The developers and contributors of this project do not accept any responsibility or liability for any losses, damages, or other consequences that may occur as a result of using this software. You are solely responsible for any decisions and actions taken based on the information provided by React-GPT.

Please note that the use of the GPT-4 language model can be expensive due to its token usage. By utilizing this project, you acknowledge that you are responsible for monitoring and managing your own token usage and the associated costs. It is highly recommended to check your OpenAI API usage regularly and set up any necessary limits or alerts to prevent unexpected charges.

As an autonomous experiment, React-GPT may generate content or take actions that are not in line with real-world business practices or legal requirements. It is your responsibility to ensure that any actions or decisions made based on the output of this software comply with all applicable laws, regulations, and ethical standards. The developers and contributors of this project shall not be held responsible for any consequences arising from the use of this software.

By using React-GPT, you agree to indemnify, defend, and hold harmless the developers, contributors, and any affiliated parties from and against any and all claims, damages, losses, liabilities, costs, and expenses (including reasonable attorneys' fees) arising from your use of this software or your violation of these terms.

👨‍💻 Contribution

  • Special thanks to https://github.com/shadcn/ui for the UI components library that made this project much easier to build.

💪 By the community, for the community

Powered by tutim.io - Co-created by @eylonmiz and @leetwito

Extension points exported contracts — how you extend this code

AnalyticsDashboardPageProps (Interface)
(no doc)
frontend/main/src/react-gpt/AnalyticsDashboardExample/index.tsx
NavItem (Interface)
(no doc)
frontend/shadcn-ui/src/types/nav.ts
Component (Interface)
(no doc)
backend/main/react-gen/utils/helpers.ts
SubHeaderProps (Interface)
(no doc)
frontend/main/src/react-gpt/AnalyticsDashboardExample/SubHeader/index.tsx
NavItemWithChildren (Interface)
(no doc)
frontend/shadcn-ui/src/types/nav.ts
TabNavProps (Interface)
(no doc)
frontend/main/src/react-gpt/AnalyticsDashboardExample/TabNav/index.tsx
MainNavItem (Interface)
(no doc)
frontend/shadcn-ui/src/types/nav.ts
SmallCardsContainerProps (Interface)
(no doc)
frontend/main/src/react-gpt/AnalyticsDashboardExample/SmallCardsContainer/index.tsx

Core symbols most depended-on inside this repo

cn
called by 186
frontend/shadcn-ui/src/lib/utils.ts
useToast
called by 6
frontend/shadcn-ui/src/components/ui/use-toast.ts
saveFile
called by 6
backend/main/react-gen/utils/helpers.ts
dispatch
called by 5
frontend/shadcn-ui/src/components/ui/use-toast.ts
toast
called by 5
frontend/shadcn-ui/src/components/ui/use-toast.ts
checkIfFileExists
called by 4
backend/main/react-gen/utils/helpers.ts
copyToClipboardWithMeta
called by 3
frontend/shadcn-ui/src/components/copy-button.tsx
setTheme
called by 3
frontend/shadcn-ui/src/components/command-menu.tsx

Shape

Function 263
Interface 66
Method 13
Class 10

Languages

TypeScript100%

Modules by API surface

backend/main/react-gen/utils/helpers.ts14 symbols
backend/main/react-gen/utils/ChatBot.ts12 symbols
frontend/shadcn-ui/src/components/ui/use-toast.ts10 symbols
backend/main/react-gen/utils/read.ts9 symbols
frontend/shadcn-ui/src/components/copy-button.tsx7 symbols
frontend/shadcn-ui/src/lib/toc.ts6 symbols
frontend/shadcn-ui/src/components/ui/sheet.tsx5 symbols
frontend/shadcn-ui/src/components/toc.tsx5 symbols
frontend/shadcn-ui/src/components/examples/json-skeleton/demo.tsx5 symbols
frontend/shadcn-ui/src/types/nav.ts4 symbols
frontend/shadcn-ui/src/components/sidebar-nav.tsx4 symbols
frontend/shadcn-ui/src/components/pager.tsx4 symbols

For agents

$ claude mcp add react-agent \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact