This is a simple TypeScript template designed for creating FiveM game resources, featuring esbuild for efficient compilation.
It allows you to structure your codebase into client, server, and common modules, ensuring a clear separation of concerns and reusability.
Ensure you have at least Node v16.9.1 installed. LTS version is recommended.
It is also recommended to install pnpm over npm or yarn, but feel free to make usage of any package manager of personal preference.
npm install -g pnpm
When using pnpm, files inside node_modules are cloned or hard linked from a single content-addressable storage, which makes it very efficient when managing resources that make use of the same dependencies.
git clone https://github.com/tfxhub/ts-fivem-template.git
cd ts-fivem-template
pnpm i
pnpm dev
// or
pnpm build
pnpm dev
to start the development build with watch mode (automatic build on file changes).pnpm build
to compile your resources for production use, optimizing for performance.pnpm types
to generate TS declaration files (.d.ts) inside ./types directory.pnpm clear
to remove all generated files, keeping your workspace clean when necessary.src/client
: Client-side scripts with access to @citizenfx/client types.src/server
: Server-side scripts with access to @citizenfx/server types.src/common
: Common scripts that can be used on both client and server.bin
: Contains scripts for managing build process and types generation.Contributions are welcome! If you have a feature request, bug report, or a pull request, please feel free to contribute.
This project is licensed under the MIT License - see the LICENSE file for details.