When you run locally you use a trial license, this is intended so a developer can test changes without deploying to the cloud. If you want your app to run longer, you can deploy it to a sand box environment.
When running locally, the environment will eventually shut down, all of your data will remain in your database. If you rerun the app locally, it will reset the time on your trial license.
Here is a walk through for creating and deploying to the sandbox environment.
https://docs.mendix.com/howto6/create-and-deploy-your-first-app#7-deploying-an-app-to-the-cloud
I believe the default runtime when starting locally in the modeler (F5) is 2 hours.