Configuration & Environment Variables
Relevant source files
The following files were used as context for generating this wiki page:- frontend/vite.config.ts
- frontend/package.json
- frontend/src/pages/Index.tsx
- frontend/src/components/LocationInfo.tsx
- README.md
- frontend/src/pages/About.tsx
- frontend/index.html
- backend/live_server_identifier.py - Note: This file was requested but not provided in the context. Backend configuration details are therefore unavailable.
- frontend/src/vite-env.d.ts - Note: This file was requested but not provided in the context. Information on custom Vite environment variables is unavailable.
Introduction
Configuration in the LLaMa Leaks project primarily revolves around the frontend application, which is built using Vite. This includes settings for the development server, the build process, path aliasing, and environment-specific behavior. A key aspect of the application's data is managed through a static JSON file, which acts as a data source for the live server information displayed on the site.
The project utilizes standard environment variables like NODE_ENV to differentiate between development and production modes, enabling features such as debugging tools only during development. Backend configuration details are not present in the analyzed source files.
Frontend Configuration
The frontend configuration is managed by Vite and is defined in frontend/vite.config.ts. This file controls the development server, build output, and module resolution.
Vite Configuration (vite.config.ts)
This diagram illustrates the main configuration objects within the Vite setup.
Sources: frontend/vite.config.ts
The configuration is broken down into several key areas:
| Key | Description | Value |
|---|---|---|
server | Configures the development server. | Binds to 127.0.0.1 on port 8080. |
plugins | Specifies the Vite plugins to use. | Includes the official React plugin (@vitejs/plugin-react-swc). |
resolve.alias | Defines path aliases for cleaner imports. | The @ symbol is an alias for the /src directory. |
build | Defines the production build settings. | The output directory is dist, and source maps are disabled. |
Sources: frontend/vite.config.ts:6-25
Package Scripts (package.json)
The package.json file defines scripts that are fundamental to the project's development and build lifecycle.
| Script | Command | Description |
|---|---|---|
dev | vite | Starts the Vite development server using the configuration in vite.config.ts. |
build | vite build | Creates a production build of the frontend application in the dist directory. |
lint | eslint . | Runs the ESLint linter to check the codebase for errors and style issues. |
preview | vite preview | Serves the production build locally to preview it before deployment. |
Sources: frontend/package.json:6-11
Environment Variables
The project uses the standard process.env.NODE_ENV environment variable to control application behavior based on the execution mode (development vs. production).
Development-Only Features
A primary example is the conditional rendering of a Sentry test button, which is only included in the DOM during development. This prevents debugging tools from being exposed in the production build.
The following flowchart shows the logic for rendering the component.
This is implemented in the Index.tsx page component using a dynamic import and a conditional check.
// frontend/src/pages/Index.tsx:13-15
const SentryTestButton =
process.env.NODE_ENV === "development"
? lazy(() => import("@/components/SentryTestButton"))
: () => null;
// frontend/src/pages/Index.tsx:40-46
{process.env.NODE_ENV === 'development' && (
<Suspense fallback={<div>Loading...</div>}>
<div className="fixed bottom-4 right-4 z-50">
<SentryTestButton />
</div>
</Suspense>
)}
Sources: frontend/src/pages/Index.tsx:13-15, 40-46
Data Configuration
The application's core data about exposed servers is not fetched from a live backend API but is read from a static JSON file located at /data/live_servers.json. The LocationInfo component is responsible for fetching, parsing, and displaying a random server from this dataset.
Data Fetching Flow
This sequence diagram shows how the LocationInfo component fetches and displays server data upon rendering.
Data Schema (ServerData)
The component defines a ServerData TypeScript interface, which serves as the schema for each server object within the live_servers.json file.
| Field | Type | Description |
|---|---|---|
ip | string | The masked IP address of the server. |
port | number | The port number the server is running on. |
version | string | The Ollama version string. |
city | string | The city where the server is located. |
country | string | The two-letter country code. |
country_name | string | The full country name. |
region | string | The region or state. |
latitude | string | The geographical latitude. |
longitude | string | The geographical longitude. |
local | ServerModel[] | An array of AI models available locally on the server. |
running | ServerModel[] | An array of AI models currently running on the server. |
first_seen_online | string | The ISO timestamp of when the server was first detected. |
age | string | A human-readable string representing how long the server has been online. |
status | string | The current status of the server (e.g., "live"). |
Sources: frontend/src/components/LocationInfo.tsx:14-29
Summary
The configuration of the LLaMa Leaks project is straightforward and centered on its Vite-based frontend. Key configurations include development server settings, build optimizations, and path aliasing defined in vite.config.ts. Environment variables are used to enable development-specific features, ensuring a clean production build. Finally, the application relies on a statically configured JSON file for its primary data source, which simplifies deployment and focuses the project on its educational purpose of displaying pre-collected data about exposed servers.