8000 GitHub - s9rka/racetrack: Realtime racetrack management app powered by websockets
[go: up one dir, main page]

Skip to content

Realtime racetrack management app powered by websockets

Notifications You must be signed in to change notification settings

s9rka/racetrack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Node.js backend server, Express web framework. sqlite for database management, node-sqlite3 package for interacting with the database. Socket.IO for realtime communication between app's interfaces. create-react-app for frontend, tailwind.css for inline styling, and Daisy UI for styling components. Lucide React for icons.

Install dependencies

The project is structured with separate node_modules for the root, server, and client folders. To install dependencies for each part, run the following commands:

# At the project root (for root-level scripts or tools)
npm install

# Navigate to the server folder and install dependencies
cd server
npm install

# Navigate to the client folder and install dependencies
cd ../client
npm install

How to run

Run npm run dev in root directory to start both the backend server (:5000) and frontend application (:3000) in developer mode, or Run npm start in root to run the app in production mode.

Both commands automatically set up ngrok tunnel, the URL can be found in the console. However, before ngrok can work on your machine, you have to set up your authentication token, and copy the path. See next section.

NGROK setup

start-ngrok.js uses a config path defined in root .env file.

To set up ngrok,

  1. Set up your own ngrok authtoken (bash): ngrok authtoken <YOUR_AUTHTOKEN>
  2. Copy the path you got to .env file for the NGROK_CONFIG_PATH value, for example NGROK_CONFIG_PATH=/your/path/to/ngrok/512/.config/ngrok/ngrok.yml
  3. Run npm run build in client folder (When using ngrok, the backend serves the static build of the React application.)

This ensures that ngrok path is correctly set up, and now you can run the app. Ngrok runs automatically when running the app with either npm run dev or npm start. You can get the ngrok tunnel link in the console when app is running.

Communication between interfaces

WebSockets are used to broadcast events to employee interfaces: (Front desk | Race control | Lap-line Observer) and to public interfaces (Spectator | Race driver)

  • Front desk has the ability to create and modify races.
  • Race control has the ability to start and end races, and change the race state during a race.
  • Lap-line observer has the ability to measure lap times during races

All these updates are communicated to all connected interfaces in real time.

Usage

Each employee interface requires an access key before being able to interact with it. Access keys are set on both the backend and frontend in .env files.

Front desk

Front desk sees the upcoming races, and has the ability to edit them (add racers, delete racers, assign cars, delete race). Front desk header section has the "Add New Race" button to add new races.

Race control

Race control sees the upcoming races, and has the ability to go to the Control Dashboard of the next race. On the Control Dashboard we can start the race, and during the race we can control race states.

Race states

Race states are represented by flags:

  • Green (race is ongoing)
  • Yellow (drive slowly)
  • Red (stop driving, danger)
  • Checkered (proceed to the pit lane, end of race)

Lap-line observer

When a new race starts, and a user is logged in to the lap-line observer interface, you will be automatically redirected to the ongoing race dashboard. The ongoing race dashboard has a button for each competitor, and the lap-line observer upon clicking on them, registers lap times and lap count.

Public interfaces

These include the leaderboard, race countdown, next race screen and flag screen.

Other notes

  • This is an MVP, and not a bulletproof application.

About

Realtime racetrack management app powered by websockets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0