TypeScript Starter Pack for FiveM

A comprehensive TypeScript boilerplate for FiveM development with modern tooling, type safety, and best practices.

๐Ÿš€ Quick Start

Prerequisites

  • Node.js (v16 or higher)

  • Yarn package manager

  • FiveM server

Installation

  1. Clone or download this starter pack

  2. Navigate to the project directory

  3. Install dependencies:

    yarn

Development Commands

  • yarn build - Build TypeScript files to JavaScript

  • yarn dev - Build and obfuscate files for production

  • yarn watch - Auto-build TypeScript files (development mode)

๐Ÿ“ Project Structure

ts-starterpack/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ client/          # Client-side scripts
โ”‚   โ”œโ”€โ”€ server/          # Server-side scripts
โ”‚   โ””โ”€โ”€ shared/          # Shared types and utilities
โ”œโ”€โ”€ types/
โ”‚   โ””โ”€โ”€ global.d.ts      # Global type definitions
โ”œโ”€โ”€ dist/                # Compiled JavaScript files
โ””โ”€โ”€ package.json

๐Ÿ”ง TypeScript Configuration

Type References

IMPORTANT: Add the appropriate type reference at the top of every file:

For client-side files:

/// <reference types="@citizenfx/client" />

For server-side files:

/// <reference types="@citizenfx/server" />

This enables IntelliSense and type checking for FiveM native functions.

๐ŸŽฏ Key Features

  • Type Safety: Full TypeScript support with FiveM native types

  • Modern Tooling: Yarn, ESLint, and Prettier configuration

  • Hot Reload: Automatic compilation during development

  • Production Ready: Obfuscation and optimization for deployment

  • Modular Structure: Organized codebase with clear separation of concerns

๐Ÿ”— Global Types

All global variables, interfaces, and types are defined in types/*.d.ts file.

You can extend this file to add your own global types and interfaces.

๐Ÿค Contributing

Feel free to submit issues, feature requests, or pull requests to improve this starter pack.

๐Ÿ“„ License

This project is open source and available under the MIT License.

Last updated