This repository is a basic boilerplate for getting started with TypeScript in FiveM scripting. It contains helpful utilities such as:
- delay
- emitNetPromise
- onNetPromise
- Prisma ORM
- NUI with React + Vite (credits to project-error)
- Node > v10.6
- Yarn (Preferred but not required)
First clone the repository somewhere near your server folder,
then point serverFolder
in esbuild.config.js
to your server folder.
You can also change [local]
in serverResourcesPath
to any desired name, that's
the output folder of your resources.
Run yarn
in the root folder to install the dependencies and yarn build <resourceName>
to build your resource.
You can build the NUI separately by going running yarn build-nui <resourceName>
in the root folder
NOTE:
build-nui
will only build the web project and NOT copy the bundle to your server's resource folder. Runningyarn build <resource>
on the root folder will copy everything to your server's resource folder including the NUI bundle IF it's was built beforewards.
yarn build <resourceName> <true>
will enable watch mode.
The boilerplate was made using yarn
but is still compatible with
npm
.
Credits to project-error for the react boilerplate. It is available at: https://github.com/project-error/fivem-react-boilerplate-lua