Overview
MotorDesk is a modern vehicle fleet management SaaS application with electronic billing capabilities, built as an offline-first Progressive Web App (PWA). This guide will help you set up your development environment.Prerequisites
Before you begin, ensure you have the following installed on your system:Node.js and npm
Install Node.js 18.x or higher. This will also install npm (Node Package Manager).Verify your installation:
Installation
Install dependencies
- React 18.2
- TypeScript 5.3
- Vite 7.3
- Redux Toolkit with Redux Saga
- TailwindCSS 4.2
- React Router Dom 7.13
Available Scripts
The project includes several npm scripts defined inpackage.json:6-10:
Script Details
| Script | Command | Description |
|---|---|---|
dev | vite | Starts the Vite development server with HMR |
build | tsc -b && vite build | Type-checks with TypeScript then builds for production |
lint | eslint . | Runs ESLint to check code quality |
preview | vite preview | Preview the production build locally |
Vite Configuration
The project uses Vite as the build tool with the following key configurations (vite.config.ts:7-44):
Plugins
React Plugin
React Plugin
TailwindCSS Plugin
TailwindCSS Plugin
PWA Plugin
PWA Plugin
Path Aliases
The project uses TypeScript path aliases for cleaner imports (vite.config.ts:28-42):
TypeScript Configuration
The project uses strict TypeScript settings (tsconfig.app.json:2-39):
- Target: ES2022
- Module: ESNext with bundler resolution
- JSX: react-jsx (automatic runtime)
- Strict mode: Enabled
- Path aliases: Matching Vite configuration
Development Workflow
Make your changes
Edit files in the
src/ directory. Changes will be reflected immediately in the browser.Troubleshooting
Port 5173 already in use
Port 5173 already in use
If port 5173 is already occupied, Vite will automatically try the next available port. You can also specify a custom port:
Module not found errors
Module not found errors
If you see module resolution errors:
- Clear node_modules and reinstall:
- Restart your TypeScript server in VS Code:
- Press
Cmd/Ctrl + Shift + P - Type “TypeScript: Restart TS Server”
Build fails with type errors
Build fails with type errors
The build script runs TypeScript type checking before building:Fix all TypeScript errors shown in the terminal. You can run type checking separately:
PWA not working in development
PWA not working in development
PWA features (offline support, service workers) work best in production builds. To test:Then open the preview URL in your browser.
Hot reload not working
Hot reload not working
If HMR stops working:
- Check for syntax errors in your code
- Restart the dev server
- Clear browser cache and reload
- Check that you’re not exceeding file watcher limits (Linux):
Next Steps
Now that your environment is set up:- Learn about the Project Structure
- Explore the Component Architecture
- Understand Custom Hooks
- Review the API Documentation
Environment Variables
Create a.env file in the root directory for environment-specific configuration:
