Lua x React Boilerplate

A boilerplate for building FiveM UIs using React (TypeScript or JavaScript) and Lua. This template helps you quickly set up a modern UI for your FiveM scripts, with easy integration between Lua and Re


๐Ÿš€ Features

  • React Frontend โ€“ Build UIs with React (choose TypeScript or JavaScript).

  • Lua Integration โ€“ Communicate between your React UI and FiveM Lua scripts.

  • SCSS Support โ€“ Style your UI with SCSS for advanced styling.

  • Hot Reload/Dev Server โ€“ Fast development with live reloading.


๐Ÿ“ฆ Installation

  1. Download the Boilerplate:

    • Choose your preferred version: TypeScript or JavaScript.

    • Download and extract to your FiveM resources folder.

  2. Add to server.cfg:

    ensure lua-react-boilerplate

โšก Quick Start

  1. Install dependencies:

    cd web
    npm install
  2. Build or run in dev mode:

    • Build for production:

      npm run build
    • Or run the dev server for hot reload:

      npm run dev
  3. Create your own components:

    • Go to web/src/components and add your new component files.

    • Import and use them in App.tsx (or App.jsx) in web/src to make them visible in your UI.


โš ๏ธ Troubleshooting

If you are having errors, make sure you are NOT running in npm run dev mode. For FiveM to use your latest UI, always run npm run build and use the built files.


๐Ÿ“‚ File Structure

lua-x-react-boilerplate/
โ”‚โ”€โ”€ fxmanifest.lua       # Resource manifest
โ”‚โ”€โ”€ client/              # Lua client scripts
โ”‚โ”€โ”€ server/              # Lua server scripts
โ”‚โ”€โ”€ web/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/  # Your React components
โ”‚   โ”‚   โ”œโ”€โ”€ App.tsx      # Main React app (edit to add your components)
โ”‚   โ”œโ”€โ”€ ...
โ”‚โ”€โ”€ README.md            # Documentation

Last updated