Skip to content

!feat(env): update environment configuration for web URLs #1561

Merged
tyler-dane merged 10 commits intomainfrom
fix/signup-bug
Mar 23, 2026
Merged

!feat(env): update environment configuration for web URLs #1561
tyler-dane merged 10 commits intomainfrom
fix/signup-bug

Conversation

@tyler-dane
Copy link
Contributor

@tyler-dane tyler-dane commented Mar 22, 2026

BREAKING CHANGE: Changes env variable(s)

fix: clarify local env file naming convention

Problem

The backend dev:backend script loaded --env-file=.env, but the actual file was named .env.local. This naming was inconsistent with the rest of the env file structure (.env.staging, .env.production) and made it unclear which file was for local development vs. other environments.

Changes

  • package.json — updated dev:backend to load --env-file=.env.local instead of --env-file=.env
  • .env.local.example — updated the setup instruction to say "rename to .env.local" instead of .env

Env file structure

The intended convention is now explicit:

File Purpose
.env.local Local development
.env.staging Staging environment
.env.production Production environment

No bare .env — the environment suffix makes the purpose of each file self-evident.

Action required

If your local file is named .env, rename it:

mv packages/backend/.env packages/backend/.env.local

Closes #1559


Note

Medium Risk
Touches password-reset email link generation and environment loading paths across backend, web build, and CLI; misconfigured LOCAL_WEB_URL/*_WEB_URL could break auth flows or scripts. Changes are straightforward but span multiple entrypoints (dev scripts, webpack, Jest).

Overview
Standardizes environment configuration around explicit web URLs. Introduces required LOCAL_WEB_URL (and STAGING_WEB_URL/PROD_WEB_URL for scripts) and updates the example env file and scripts CLI to stop using the old *_DOMAIN variables.

Improves password reset email handling. Reset links are now rewritten using ENV.LOCAL_WEB_URL via an updated buildResetPasswordLink(frontendUrl) API, and EmailPassword email delivery now properly overrides sendEmail (suppressed only in test, otherwise delegates to the original sender with the rewritten link); tests are updated accordingly.

Switches runtime env loading to Node’s --env-file and reduces dotenv usage. Removes dotenv from backend/scripts, deletes scripts init.ts, updates root dev:*/cli scripts to pass --env-file, and replaces webpack’s dotenv usage with a simple .env.* parser. Jest is also updated to only run @shelf/jest-mongodb global setup/teardown for projects that need Mongo.

Written by Cursor Bugbot for commit e7f6fc0. This will update automatically on new commits. Configure here.

…email reset link handling

- Added LOCAL_WEB_URL to .env.local.example and updated env.constants.ts to include it.
- Modified supertokens middleware to utilize LOCAL_WEB_URL for generating password reset links.
- Updated tests to reflect changes in reset link generation and ensure correct behavior with the new URL structure.
- Removed deprecated CLI domain variables in favor of the new web URL configuration.

This change improves the clarity and maintainability of environment configurations and enhances the email reset functionality.
…environment variables

- Updated jest.config.js to conditionally include global setup and teardown for MongoDB based on the requested project.
- Added LOCAL_WEB_URL environment variable to backend test initialization for improved local testing configuration.

These changes improve the testing setup for projects requiring MongoDB and enhance the clarity of environment configurations.
- Removed dotenv dependency from multiple package.json files and eliminated dotenv configuration from init.ts files.
- Updated CLI and development scripts in package.json to utilize environment variables more effectively.
- Enhanced webpack configuration to handle environment variables without relying on dotenv, improving clarity and maintainability.

These changes simplify the environment configuration process and reduce unnecessary dependencies across the project.
- Updated the development script in package.json to unify the backend start command under "dev:backend", simplifying the command structure.
- Removed the redundant "dev:backend-start" script, enhancing clarity and maintainability of the development setup.

This change streamlines the development process for the backend, making it easier for developers to start the server.
- Removed unnecessary import of "@scripts/init" and adjusted the import order for better organization.
- Streamlined the import section by consolidating related imports, enhancing code clarity and maintainability.

This refactor improves the overall structure of the CLI script, making it easier to read and manage.
@tyler-dane tyler-dane marked this pull request as ready for review March 22, 2026 06:31
@tyler-dane tyler-dane changed the title feat(env): update environment configuration for web URLs and enhance email reset link handling !feat(env): update environment configuration for web URLs and enhance email reset link handling Mar 22, 2026
- Eliminated the onReady method and its associated event listener for ConnectionReadyEvent in the MongoService class, streamlining the connection handling logic.
- This change enhances code clarity by removing unnecessary complexity related to connection state management.
- Implemented a check for the local environment in the getDomainAnswer function, returning the host from LOCAL_WEB_URL for improved local development support.
- This enhancement streamlines the process of obtaining the correct domain for local setups, facilitating a smoother development experience.
@tyler-dane
Copy link
Contributor Author

TODO: test and integrate email sending

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues.

@tyler-dane tyler-dane changed the title !feat(env): update environment configuration for web URLs and enhance email reset link handling !feat(env): update environment configuration for web URLs Mar 23, 2026
@tyler-dane tyler-dane merged commit 538c1cf into main Mar 23, 2026
9 checks passed
@tyler-dane tyler-dane deleted the fix/signup-bug branch March 23, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace dotenv with --env-file

1 participant