docs: add comprehensive README for frontend project architecture and setup

This commit is contained in:
Ümit Tunç
2026-04-24 13:22:16 +03:00
parent d641c8c801
commit a007fa201b
+56 -60
View File
@@ -1,73 +1,69 @@
# React + TypeScript + Vite # Mariavel - Modern Database Management Tool (Frontend)
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. Mariavel is a premium, glassmorphic database management interface built for MariaDB/MySQL. It provides an IDE-like experience for managing databases, tables, and executing complex SQL queries.
Currently, two official plugins are available: ## 🚀 Features
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs) - **Data Explorer**: High-performance data viewing using MUI X Data Grid with server-side pagination.
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) - **SQL Console**: Interactive SQL editor powered by Monaco Editor (the core of VS Code) with syntax highlighting and direct execution.
- **Technical Metadata**: Detailed table and database specifications including engine, collation, and storage sizes.
- **Bulk Actions**: Perform maintenance tasks like Truncate, Drop, and Optimize on multiple tables simultaneously.
- **Transfer Tools**: Robust import/export capabilities supporting SQL files and compressed archives.
- **Responsive Design**: Modern, glassmorphic UI with dark mode support and a fluid layout.
## React Compiler ## 🏗️ Architecture & SOLID Principles
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). The application has been recently refactored to follow **SOLID** principles, ensuring a maintainable and scalable codebase:
## Expanding the ESLint configuration ### Single Responsibility Principle (SRP)
Components have been decoupled into specialized units:
- `DatabaseTablesGrid`: Dedicated to table listing and bulk operations.
- `SqlConsole`: Isolated SQL editing and result rendering.
- `TechnicalOverview`: Focused on metadata presentation.
- `MainContent`: Orchestrates high-level layout and navigation.
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: ### Logic Separation (Custom Hooks)
Business logic and data fetching are extracted into custom hooks:
- `useTableData`: Manages paginated data fetching and row mapping.
- `useTableSchema`: Handles column definitions and type mapping from SQL to UI.
```js ### Type Safety
export default defineConfig([ - **Verbatim Module Syntax**: Configured for strict type-only imports (`import type`), improving build performance and code clarity.
globalIgnores(['dist']), - **Centralized Types**: Shared interfaces are located in `src/types/database.ts`.
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this ## 🛠️ Technology Stack
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs... - **Framework**: [React](https://reactjs.org/) + [Vite](https://vitejs.dev/)
], - **Styling**: [Material UI (MUI)](https://mui.com/) with a custom glassmorphic theme.
languageOptions: { - **Editor**: [@monaco-editor/react](https://github.com/suren-atoyan/monaco-react)
parserOptions: { - **Data Grid**: [MUI X Data Grid](https://mui.com/x/react-data-grid/)
project: ['./tsconfig.node.json', './tsconfig.app.json'], - **State Management**: [Zustand](https://github.com/pmndrs/zustand)
tsconfigRootDir: import.meta.dirname, - **API Client**: Axios
},
// other options... ## 📂 Directory Structure
},
}, ```
]) src/
├── components/ # Specialized UI components (DatabaseTablesGrid, SqlConsole, etc.)
├── hooks/ # Custom hooks for logic separation (useTableData, useTableSchema)
├── services/ # API service layers
├── store/ # Zustand global state management
├── types/ # Shared TypeScript interfaces
├── theme/ # MUI theme configuration
└── App.tsx # Main application entry point
``` ```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: ## 🚥 Getting Started
```js 1. Install dependencies:
// eslint.config.js ```bash
import reactX from 'eslint-plugin-react-x' npm install
import reactDom from 'eslint-plugin-react-dom' ```
2. Start development server:
export default defineConfig([ ```bash
globalIgnores(['dist']), npm run dev
{ ```
files: ['**/*.{ts,tsx}'], 3. Build for production:
extends: [ ```bash
// Other configs... npm run build
// Enable lint rules for React ```
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```