--- title: Environment & Configuration tags: - configuration - environment - settings aliases: - Environment Variables - Configuration --- # Environment & Configuration ## Backend — `settings.json` The primary configuration file. Located at `backend/settings.json`. See `settings.json.example` for template. | Field | Type | Default | Description | |---|---|---|---| | `userDataPath` | string | `C:\Users\{user}\Documents\Showy Data` | Root path for [[Media System\|media storage]] | | `tmdbApiUrl` | string | `https://api.themoviedb.org/3` | [[TMDB Integration]] base URL | | `tmdbApiKey` | string | — | TMDB API key (**required**) | | `backPort` | number | `4000` | Backend server port | | `frontPort` | string | `8000` | Frontend port (reference only) | | `portableMode` | string | `""` | Portable mode path (empty = disabled) | | `libraryViewMode` | string | `"grid"` | Library page view mode | | `watchlistViewMode` | string | `"grid"` | Watchlist page view mode | ### Example ```json { "userDataPath": "C:\\Users\\username\\Documents\\Showy Data", "tmdbApiUrl": "https://api.themoviedb.org/3", "tmdbApiKey": "your_tmdb_api_key_here", "frontPort": "8000", "backPort": 4000, "portableMode": "", "libraryViewMode": "grid", "watchlistViewMode": "grid" } ``` ## Database Configuration > [!info] File: `backend/config/database.js` | Setting | Value | |---|---| | Dialect | MySQL | | Database | `Showzy` | | Host | `localhost` | | Username | `root` | | Password | `password` | | Logging | `sequelize.log` file | ## Docker Environment Variables Used in `docker-compose.yml` — override database connection: | Variable | Default | Description | |---|---|---| | `MYSQL_HOST` | `mysql` | MySQL host (Docker service name) | | `MYSQL_DB` | `Showzy` | Database name | | `MYSQL_USER` | `root` | Database user | | `MYSQL_PASSWORD` | `password` | Database password | | `MYSQL_ROOT_PASSWORD` | `rootpassword` | MySQL root password (init) | ## Frontend Environment | Variable | Source | Description | |---|---|---| | `VITE_API_URL` | `.env` or build arg | API base URL override | Vite dev proxy: `/api` → `http://showyback.coolguy.space` (configured in `vite.config.ts`) ## Electron Environment | Variable | Set By | Description | |---|---|---| | `PARENT_PROCESS` | Electron main process | Electron user data path — signals backend it's running inside Electron | ## Media Folder Structure Created automatically by `configService` on startup at `{userDataPath}`: ``` {userDataPath}/ ├── images/ │ ├── entries/ │ │ ├── posters/ │ │ ├── backdrops/ │ │ └── logos/ │ ├── collections/ │ │ ├── posters/ │ │ └── backdrops/ │ ├── seasons/ │ │ └── posters/ │ ├── episodes/ │ │ └── stills/ │ └── peoples/ │ └── profiles/ └── showy.log ``` ## Important Files | File | Role | |---|---| | `backend/settings.json` | Runtime configuration | | `backend/settings.json.example` | Template | | `backend/config/database.js` | Database connection | | `backend/services/configService.js` | Config reader/writer | | `docker-compose.yml` | Docker env vars | | `react_frontend/vite.config.ts` | Frontend dev proxy | ## See Also - [[Backend]] — Server setup - [[Deployment]] — Docker configuration - [[TMDB Integration]] — API key usage - [[Media System]] — Storage paths - [[Settings Page]] — UI for editing settings