Skip to content

Environment Variables

To connect your headless storefront to your backend, you must configure the environment variables.

.env Configuration

To get started, create a .env (or .env.local) file in the root of your project and populate it with your instance details:

VariableTypeRequiredVisibilityDefault/Example
NEXT_PUBLIC_BAGISTO_ENDPOINTURLYesPublichttps://your-bagisto-instance.com
NEXT_PUBLIC_BAGISTO_STOREFRONT_KEYStringYesPublicyour_storefront_key_here
NEXT_PUBLIC_NEXT_AUTH_URLURLYesPublichttp://localhost:3000
NEXT_PUBLIC_NEXT_AUTH_SECRETSecretYesPublicyour_next_auth_secret_here
COMPANY_NAMEStringYesServerYour Company Name

More Details

For a deeper dive into all available configuration options, refer to the Bagisto Headless Environment Variables Guide.

Localhost on Mobile

If you plan to test on a physical mobile device, do not use http://localhost:3000 for the endpoint. Use your computer's local network IP (e.g., http://192.168.1.5:3000) so the mobile device can communicate with the server.

Next Steps

Released under the MIT License.