Installation guide
This guide provides comprehensive instructions for installing, configuring, and deploying MKing Admin.Prerequisites
Required software
Ensure you have the following installed before proceeding:Node.js and npm
Node.js version 16.x or higher is recommended.Verify your installation:Download from nodejs.org if needed.
Git
System requirements
- Operating System: Windows 10+, macOS 10.15+, or Linux
- RAM: Minimum 4GB (8GB recommended for development)
- Disk Space: At least 500MB for dependencies and build artifacts
Installation steps
1. Clone the repository
Clone the MKing Admin repository to your local machine:2. Install dependencies
MKing Admin uses npm for package management. Install all dependencies:package.json:12-58):
Core dependencies
[email protected]- React library[email protected]- React DOM rendering[email protected]- TypeScript compiler[email protected]- Build tool and dev server
UI framework
@mui/[email protected]- Material-UI components@mui/[email protected]- Material Design icons@emotion/[email protected]- CSS-in-JS styling@emotion/[email protected]- Styled components
State management
@reduxjs/[email protected]- Redux state management[email protected]- React bindings for Redux[email protected]- Persist Redux state[email protected]- Lightweight state management
Routing & forms
[email protected]- Client-side routing[email protected]- Form handling[email protected]- Schema validation
Data & visualization
[email protected]- Advanced data grids[email protected]- Charts and graphs@fullcalendar/[email protected]- Calendar component
Utilities
[email protected]- HTTP client[email protected]- JWT token decoding[email protected]- Date utilities[email protected]- Utility functions
The complete dependency list includes over 40 packages. Installation may take 2-5 minutes depending on your internet connection.
3. Environment configuration
Create a.env file in the project root:
.env
Environment variables explained
| Variable | Description | Example |
|---|---|---|
VITE_APP_ENV | Application environment | develop, production |
VITE_BASE_URL | Backend API base URL | http://localhost:3008/api |
VITE_GL_PRUEBAS | Testing environment URL | https://pruebas.garantia.mx |
VITE_GL_PRODUCCION | Production environment URL | https://app.garantia.mx |
4. TypeScript configuration
MKing Admin uses TypeScript with strict type checking. The configuration is already set up intsconfig.json:2-18:
- Strict mode: Enhanced type checking
- JSX: React JSX transform
- ES Modules: Modern module system
5. Development server configuration
The Vite development server is configured invite.config.ts with the following settings:
The proxy configuration routes all
/api requests to http://localhost:3333, allowing seamless communication with the backend API during development.Running the application
Development mode
Start the development server with hot module replacement:- Local:
http://localhost:5000 - Network:
http://<your-ip>:5000
Type checking
Run TypeScript type checking without emitting files:Production build
Create an optimized production build:dist/ directory.
Preview production build
Preview the production build locally:Project structure
After installation, your project structure will look like this:Authentication architecture
MKing Admin uses Zustand for authentication state management (fromsrc/store/authStore.ts:11-33):
- User profile data
- Permission-based access control
- Authentication state across the application
Backend API setup
The application expects:- Backend API running on
http://localhost:3333(default) - API endpoints available at
/api/* - JWT-based authentication
.env: ChangeVITE_BASE_URLvite.config.ts: Update proxy target in server configuration
Troubleshooting
Installation issues
Problem: npm install fails with permission errors Solution: Try using sudo (Linux/Mac) or run as administrator (Windows), or fix npm permissions:Build issues
Problem: TypeScript compilation errors Solution: Ensure you’re using TypeScript 5.7.2:Runtime issues
Problem: API requests failing Solution:- Verify backend is running on correct port
- Check CORS configuration on backend
- Verify
VITE_BASE_URLin.env - Check proxy configuration in
vite.config.ts
Next steps
After successful installation:- Review the application structure in
src/ - Explore the authentication flow in
src/auth/ - Understand state management in
src/store/ - Customize the Material-UI theme in
src/theme/ - Start building your features in
src/pages/
For testing, MKing Admin includes Vitest configuration. Run tests with
npm test (testing setup is in src/vitest.setup.ts).