Installation
Installation Guide
This guide will walk you through installing and setting up B2Lib in your FiveM server.
Requirements
Before installing B2Lib, ensure your server meets these requirements:
FiveM Server: Latest recommended version
Operating System: Windows or Linux
Node.js: Version 16 or higher (for building the web interface)
Framework: Any FiveM framework (ESX, QBCore, etc.) or standalone
Installation Methods
Method 1: Download Release (Recommended)
Download the latest release from the B2Lib releases page
Extract the archive to your server's
resourcesfolderRename the folder to
b2lib(if not already named correctly)Add to server.cfg:
ensure b2lib
Method 2: Git Clone
Navigate to your resources folder:
Clone the repository:
Navigate to the B2Lib folder:
Install dependencies and build:
Add to server.cfg:
Quick Setup
1. Basic Configuration
The default configuration should work out of the box, but you can customize it:
Open
config.luain the B2Lib folderReview the settings and adjust as needed:
2. Start Your Server
Start your FiveM server
Check the console for any errors
Join your server to test the installation
3. Test the Installation
Run these commands in-game to test B2Lib:
Verification
Console Output
When B2Lib starts successfully, you should see:
In-Game Test
Open the theme settings with
/themesettingsorF7(if bound)Try a notification:
Framework Integration
ESX Integration
B2Lib works seamlessly with ESX. No additional configuration required.
QBCore Integration
B2Lib works with QBCore out of the box.
Standalone Usage
B2Lib can be used without any framework:
Troubleshooting
Common Issues
1. Resource Not Starting
Problem: B2Lib doesn't start or shows errors in console.
Solutions:
Check that the folder is named exactly
b2libEnsure
ensure b2libis in yourserver.cfgVerify all files are present and not corrupted
Check server console for specific error messages
2. UI Not Showing
Problem: UI components don't appear in-game.
Solutions:
Check if NUI is enabled on your server
Verify the
web/distfolder exists and contains built filesTry rebuilding the web interface:
npm run buildCheck browser console (F12) for JavaScript errors
3. Theme Settings Not Opening
Problem: Theme settings don't open when called.
Solutions:
Ensure the player has appropriate permissions
Check if another UI is blocking NUI focus
Verify the theme settings component is enabled in config
Try restarting the resource:
/restart b2lib
4. Build Errors
Problem: npm run build fails with errors.
Solutions:
Ensure Node.js version 16+ is installed
Delete
node_modulesand runnpm installagainCheck for any missing dependencies
Ensure you have write permissions in the folder
Debug Mode
Enable debug mode for detailed logging:
This will show detailed information in the console about:
Component initialization
Function calls and parameters
Event triggers
Error details
Getting Help
If you're still having issues:
Check the console for error messages
Enable debug mode for more information
Review the documentation for proper usage
Check GitHub issues for known problems
Create a new issue with detailed information
Performance Optimization
Server Performance
Disable unused components in
Config.EnabledComponentsAdjust notification limits in
Config.Notifications.maxVisibleUse appropriate update intervals for dynamic content
Client Performance
Limit concurrent UI elements (notifications, progress bars, etc.)
Use efficient positioning (avoid frequent position changes)
Test on lower-end hardware to ensure compatibility
Security Considerations
Server Security
Review permissions for theme settings access
Validate user inputs in custom implementations
Monitor resource usage to prevent abuse
Client Security
Keep NUI secure by validating all data
Avoid exposing sensitive information in UI components
Use proper event validation for client-server communication
Next Steps
After successful installation:
Read the UI Components Guide to learn about available components
Explore Configuration Options for customization
Check out Examples for implementation ideas
Review Best Practices for optimal usage
Updates
Updating B2Lib
Backup your configuration (
config.luaand any custom settings)Download the latest release or pull from Git
Replace the old files (keeping your config backup)
Restore your configuration settings
Restart the resource:
/restart b2libTest functionality to ensure everything works
Version Compatibility
Check release notes for breaking changes
Test in development before updating production
Keep backups of working versions
Last updated