Local development

Get started working locally on your app in a few easy steps. Open your terminal app, and:

Create a new application:

npm create "@enhance" ./begin-app -y

cd to your Begin project directory:

cd begin-app

Start the app locally:

begin dev
b dev

Open your browser to https://localhost:3333 to start testing your app locally.

Note: you can specify the port to run your app locally by passing --port as a command line parameter. For more information see the docs on the begin dev command.

Any changes to the code in the app folder of your project will trigger a live reload.

Note: livereload will execute your api routes along with each change as long as it matches the current path. Be mindful of how a reload might interact with your app’s data layer.

Environment variables

If you code depends on environment variables begin dev does not read them from the operating system. Instead, you need to be explicit in passing these variables to your local development environment.

To pass environment variables into begin dev create a file named .env in the root of your project. You then specify the variables as key/value pairs separated by a =. For example:

FOO=bar
API_KEY=super-secret

For more information on how to set environment variables for your deployed environments see Environment Variables

Never check in your .env file to source code control. By default .env is included in your projects .gitignore file to prevent you from accidentally leaking secrets on the internet.