Celtrix icon indicating copy to clipboard operation
Celtrix copied to clipboard

`serverAuthSetup` runs twice for `mern+tailwind+auth` and `mevn+tailwind+auth` stacks

Open vipul674 opened this issue 4 months ago • 5 comments

Bug

For the two *+tailwind+auth stacks, the Express server setup (which runs npm init -y and installs dependencies) executes twice:

  1. Once inside the stack setup itself:
    • mernSetup() calls serverAuthSetup() when config.stack === "mern+tailwind+auth" (utils/installer.js:321-322)
    • mevnTailwindAuthSetup() calls serverAuthSetup() at the end (utils/installer.js:398)
  2. Then again from utils/project.js:
    • mern+tailwind+auth path: project.js:204 → serverAuthSetup(...) after mernTailwindSetup
    • mevn+tailwind+auth path: project.js:210 → serverAuthSetup(...) after copyTemplates

Reproduction

  1. celtrix create → stack mern+tailwind+auth
  2. Observe npm init -y + dependency install output twice for the server/ directory

Impact

  • Redundant npm init -y + full dependency install → noticeably slower scaffolding.
  • Second npm init -y rewrites server/package.json (dependencies are dropped, then reinstalled) — wasteful and risks losing the deps between the two passes.

Suggested fix

Call serverAuthSetup in exactly one place per stack — either inside the *Setup helper or in project.js, not both. Prefer keeping it in project.js so the auth-server setup is uniform across stacks.

Environment

  • celtrix v3.0.1

vipul674 avatar Aug 02 '26 19:08 vipul674

@JoeCelaster I would like to work on this issue.

vipul674 avatar Aug 02 '26 19:08 vipul674

Local Reproduction Results

I reproduced the reported behavior locally using the Celtrix source code on Windows.

Environment

  • OS: Windows
  • Stack: MERN + Tailwind + Auth
  • Language: TypeScript
  • Runtime: Node.js
  • Package manager: npm

Steps to reproduce

  1. Run the local Celtrix CLI.
  2. Select MERN + Tailwind + Auth.
  3. Choose TypeScript, Node.js, and npm.
  4. Enable dependency installation.
  5. Observe the backend setup output during scaffolding.

Expected behavior

Backend initialization and dependency installation should execute only once.

Actual behavior

The output showed two backend dependency-installation steps:

  • First installation: 137 packages added.
  • Second installation: dependencies reported as up to date, with 138 packages audited.

Scaffolding completed successfully in 27.4 seconds.

This behavior is consistent with the duplicate server setup described in this issue. Is this issue still available for another contributor to work on?

Nikhil1869 avatar Oct 10 '26 09:10 Nikhil1869

I would like to work on this issue !

Shashank-Venkatesh avatar Oct 13 '26 08:10 Shashank-Venkatesh

Assign me this issue .

pratikadamas avatar Oct 26 '26 21:10 pratikadamas

Assign me this issue .

Hey buddy I am working on this issue !

Shashank-Venkatesh avatar Oct 27 '26 01:10 Shashank-Venkatesh