What npm run {command} does, differs from project to project. Depending on your settings, what plugins you have installed, and what asset bundler you use.
For Laravel and Vite, the npm run dev command is used for development and NOT production. it starts the Vite development server on port :4173 which includes hot module replacement for instance. Not to be confused with your local web server that serves your Laravel application, whether that be XAMPP, Docker, or Valet, this is only for assets handled by Vite.
For production we run npm run build, that command generated versioned production assets for your project under the public/build folder. These assets are not normally tracked by Git since they're generally created on the production server or in a CI/CD pipeline. If you don't have that capability, like on shared-hosting for instance, you can remove the /public/build line in your .gitignore file to track the files.
What each command does is covered in Laravel's documentation under Running Vite, I'd spend a few minutes browsing the documentation to familiarise yourself with how Laravel and Vite work together. And as @jlrdw suggested, I'd also recommend reading up on the deployment part of the documentation.
And at no part does Vite generate a .env file for you. And asset files are not stored in the database, they're located under the public/build folder once built. If you're getting an error containing a line similar to failed to load manifest or connect http://127.0.0.1:4173/hot make sure the public/hot file is removed after you stop the Vite development server. That should also not be tracked by Git or uploaded to the production server.