## AI Master Prompt for Linux GameBoost MVP
**1. PROJECT OVERVIEW**
**Project Name:** Linux GameBoost
**Problem:** Linux gamers often struggle to achieve optimal performance when running Windows games through compatibility layers like Wine and Proton. While significant advancements have been made (e.g., Wine 11's kernel-level rewrites), fine-tuning system settings, Wine/Proton configurations, and understanding performance bottlenecks for each game can be complex, time-consuming, and requires deep technical knowledge. This leads to suboptimal frame rates, stuttering, and a frustrating gaming experience.
**Solution:** Linux GameBoost is a desktop application (built with Next.js for potential future web features) designed to simplify and enhance the Linux gaming experience. It leverages the latest performance improvements in Wine/Proton, automatically analyzes game requirements, optimizes system and Wine/Proton settings, and provides real-time performance monitoring. The core value proposition is to empower Linux gamers to achieve 'out-of-the-box' or even 'better-than-Windows' performance with minimal effort, making Linux a truly viable and superior gaming platform.
**Core Value Proposition:** "Unlock peak gaming performance on Linux. Linux GameBoost automatically optimizes your system and Wine/Proton settings for every game, so you can play smoother, faster, and without the hassle."
**Target User:** Linux users who play Windows games (via Steam, Lutris, etc.) and want to maximize performance and ease of use.
**2. TECH STACK**
* **Framework:** Next.js (App Router)
* **Language:** TypeScript
* **Styling:** Tailwind CSS
* **UI Library:** shadcn/ui (for accessible, consistent components)
* **Database:** Drizzle ORM (PostgreSQL or SQLite for MVP simplicity)
* **Authentication:** NextAuth.js (e.g., with GitHub, Google, or local email/password)
* **State Management:** React Context API / Zustand (for global state)
* **Data Fetching:** React Server Components (RSC), Server Actions, Client Components with `fetch` API / React Query (for complex client-side caching/mutations)
* **Background Tasks/System Interaction:** Utilize Node.js child process (`child_process`) or libraries like `execa` to interact with system commands (e.g., `gamemoded`, `mangohud`, Wine/Proton CLI tools, system monitoring tools). *Note: This requires the app to be packaged as a desktop application (e.g., using Electron or Tauri) for full system access.* For the MVP, we'll simulate these interactions where direct OS calls are complex.
* **Charting:** Recharts or Chart.js (for performance metrics)
**3. DATABASE SCHEMA (using Drizzle ORM syntax - PostgreSQL example)**
```typescript
// schema.ts
import { pgTable, uuid, varchar, timestamp, integer, boolean, jsonb, text } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm';
// Users Table
export const users = pgTable('users', {
id: uuid('id').primaryKey().defaultRandom(),
name: varchar('name'),
email: varchar('email').notNull().unique(),
emailVerified: timestamp('emailVerified', { mode: 'date' }),
image: varchar('image'),
createdAt: timestamp('createdAt', { withTimezone: true, mode: 'date' }).defaultNow(),
updatedAt: timestamp('updatedAt', { withTimezone: true, mode: 'date' }).defaultNow(),
});
// User Relations
export const usersRelations = relations(users, ({ many }) => ({
gameProfiles: many(gameProfiles),
}));
// Game Profiles Table
export const gameProfiles = pgTable('gameProfiles', {
id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('userId').notNull().references(() => users.id, { onDelete: 'cascade' }),
gamePath: varchar('gamePath').notNull(), // Path to the game executable or main directory
gameName: varchar('gameName').notNull(), // Display name of the game
detectedWineVersion: varchar('detectedWineVersion'), // e.g., 'wine-ge-8.14' or 'proton-8.0-4'
detectedProtonVersion: varchar('detectedProtonVersion'),
customSettings: jsonb('customSettings'), // User-defined or optimized settings (e.g., { "dxvk_hud": 1, "esync": true })
createdAt: timestamp('createdAt', { withTimezone: true, mode: 'date' }).defaultNow(),
updatedAt: timestamp('updatedAt', { withTimezone: true, mode: 'date' }).defaultNow(),
});
// Game Profile Relations
export const gameProfilesRelations = relations(gameProfiles, ({ one, many }) => ({
user: one(users, {
fields: [gameProfiles.userId],
references: [users.id],
}),
performanceMetrics: many(performanceMetrics),
}));
// Performance Metrics Table
export const performanceMetrics = pgTable('performanceMetrics', {
id: uuid('id').primaryKey().defaultRandom(),
gameProfileId: uuid('gameProfileId').notNull().references(() => gameProfiles.id, { onDelete: 'cascade' }),
timestamp: timestamp('timestamp', { withTimezone: true, mode: 'date' }).defaultNow(),
fps: integer('fps'),
cpuUsage: integer('cpuUsage'), // Percentage
gpuUsage: integer('gpuUsage'), // Percentage
memoryUsage: integer('memoryUsage'), // MB
wineSyncCalls: integer('wineSyncCalls'), // If measurable
avgFrameTime: integer('avgFrameTime'), // ms
});
// Performance Metrics Relations
export const performanceMetricsRelations = relations(performanceMetrics, ({ one }) => ({
gameProfile: one(gameProfiles, {
fields: [performanceMetrics.gameProfileId],
references: [gameProfiles.id],
}));
}));
// Optional: Wine/Proton Version Table
export const wineVersions = pgTable('wineVersions', {
id: uuid('id').primaryKey().defaultRandom(),
version: varchar('version').notNull().unique(),
type: varchar('type').notNull(), // 'wine' or 'proton'
installPath: varchar('installPath'),
isDefault: boolean('isDefault').default(false),
createdAt: timestamp('createdAt', { withTimezone: true, mode: 'date' }).defaultNow(),
});
// Possible relations for wineVersions if needed for managing multiple installed versions
```
**4. CORE FEATURES & USER FLOW**
* **User Authentication (Sign Up/Login):**
* **Flow:** User accesses the app -> Clicks 'Sign Up' or 'Login' -> Chooses authentication method (e.g., GitHub, Email/Password) -> Enters credentials/authorizes OAuth -> Redirected to the main dashboard.
* **Details:** Implement NextAuth.js. For email/password, include password hashing (e.g., bcrypt) and validation. Handle sign-out.
* **Edge Cases:** Invalid credentials, email already exists, session expiration.
* **Game Detection & Profile Creation:**
* **Flow:** Upon first login or via a button, the app prompts the user for Steam Library/game installation paths. It scans these paths to identify game executables/folders. For each detected game, it attempts to identify the Wine/Proton version being used (e.g., by checking ProtonDB, Lutris configurations, or launch options). A new `GameProfile` is created in the database. If a game is already profiled, it shows the existing profile.
* **Details:** Requires user input for game locations. Logic to parse common game structures. Might need integration with Steam API or local manifest files. Initially, manual path input is sufficient for MVP.
* **Edge Cases:** Game not found, multiple Steam libraries, unsupported game types, permissions errors accessing game files.
* **Automatic Optimization Suggestions:**
* **Flow:** User selects a game profile -> Clicks 'Analyze & Optimize' -> The app (simulated or actual command execution) gathers system info (CPU, GPU, RAM) and current Wine/Proton settings (e.g., DXVK, Esync, Fsync settings). It compares this to known optimal settings for that game (potentially using a database of game-specific tweaks or general best practices) -> Presents a list of recommended changes (e.g., "Enable Fsync", "Set DXVK Hud to 1", "Adjust CPU governor").
* **Details:** This is the core logic. MVP can use a simplified rule-based system or pre-defined profiles. Advanced versions could involve ML models. Commands like `gamemoded -s` or `mangohud` could be referenced.
* **Edge Cases:** Game not in database, system doesn't support a recommended setting, user denies permission for changes.
* **Real-time Performance Monitoring:**
* **Flow:** User launches a game (ideally through GameBoost launcher or by manually setting launch options) -> Performance monitoring UI becomes active -> Displays FPS, CPU/GPU usage, RAM usage in real-time on a dashboard or overlay.
* **Details:** Requires executing tools like `mangohud` or parsing performance data from system interfaces. Data is fetched periodically and displayed using charts. Store key metrics in `performanceMetrics` table for historical analysis.
* **Edge Cases:** Game crashes, monitoring tool fails, performance data not available.
* **Wine/Proton Version Management:**
* **Flow:** A dedicated section lists installed Wine/Proton versions. User can trigger updates (via `steam-cmd` or similar tools), install new versions (downloading from official sources/repositories), or select the default version for non-Steam games.
* **Details:** This involves executing package manager commands or specific download scripts. For MVP, it might just *list* versions and provide links to update guides.
* **Edge Cases:** Installation failures, conflicting versions, insufficient disk space.
**5. API & DATA FETCHING**
* **Authentication API Routes:** Handled by NextAuth.js (`/api/auth/[...nextauth]`).
* **Game Profile CRUD API:**
* `POST /api/games`: Create a new game profile.
* `GET /api/games`: Fetch all game profiles for the logged-in user.
* `GET /api/games/[id]`: Fetch a specific game profile.
* `PUT /api/games/[id]`: Update game profile settings.
* `DELETE /api/games/[id]`: Delete a game profile.
* **Optimization API Route:**
* `POST /api/games/[id]/optimize`: Analyze and generate optimization suggestions for a specific game.
* **Performance Data API Route:**
* `POST /api/games/[id]/metrics`: Endpoint to receive performance data from the running game (client-side or background process).
* `GET /api/games/[id]/metrics`: Fetch historical performance data for a game.
* **Data Fetching Strategy:** Use Server Components for initial data loads (user info, game list). Use Server Actions or client-side mutations (e.g., with `fetch` in Client Components or React Query) for actions like creating/updating profiles, triggering optimizations, and sending performance data. Real-time monitoring will involve polling or WebSockets (for future enhancement).
**6. COMPONENT BREAKDOWN (Next.js App Router Structure)**
* **`app/` directory:**
* **`layout.tsx`:** Root layout (HTML, Body, global providers, Tailwind CSS setup).
* **`page.tsx`:** Landing page (for unauthenticated users).
* **`dashboard/`:**
* `page.tsx`: Main dashboard. Overview of games, recent activity, quick links. Fetches user game profiles.
* `layout.tsx`: Dashboard specific layout (e.g., sidebar).
* **`games/`:**
* `page.tsx`: List of all game profiles. Button to add new game.
* `[gameId]/`:
* `page.tsx`: Game profile detail page. Shows settings, optimization suggestions, performance history. (Fetches specific game profile data).
* `components/`: Components specific to this page.
* `GameSettingsForm.tsx`: Form for editing `customSettings`.
* `PerformanceChart.tsx`: Displays historical performance data.
* `OptimizationPanel.tsx`: Shows suggestions and applies them.
* `RealTimeMonitor.tsx`: Component to display live metrics (might be simulated in MVP).
* **`settings/`:**
* `page.tsx`: User account settings (email, password, connected accounts).
* `wine/page.tsx`: Wine/Proton management interface.
* **`auth/`:**
* `signin/page.tsx`: Sign-in page.
* `signup/page.tsx`: Sign-up page.
* **`components/ui/`:** Re-usable UI components from shadcn/ui (Button, Input, Card, Dialog, Select, etc.).
* **`components/`:** Custom shared components (e.g., `Sidebar.tsx`, `Navbar.tsx`, `GameListItem.tsx`, `LoadingSpinner.tsx`).
* **`lib/`:** Utility functions, database connection (Drizzle), API client setup, helper functions for system commands (simulated or actual).
* **`services/`:** Business logic services (e.g., `gameService.ts`, `optimizationService.ts`).
* **`styles/`:** Global CSS files (`globals.css`).
**7. UI/UX DESIGN & VISUAL IDENTITY**
* **Design Style:** Modern, Clean, Functional with a hint of