Skip to content

Implement security hardening module#68

Merged
Josephat-S merged 1 commit into
devfrom
feat/security
May 26, 2026
Merged

Implement security hardening module#68
Josephat-S merged 1 commit into
devfrom
feat/security

Conversation

@Josephat-S
Copy link
Copy Markdown
Contributor

This pull request introduces a new enterprise security hardening feature for Next.js projects generated by the CLI. The main changes add an automated security setup step, which generates secure environment variable validation, security headers, and other best practices during project creation. It also removes previously hardcoded environment validation from the template, centralizing this logic in the generator.

Security hardening automation:

  • Added a new applySecurity function in src/security.js that, when enabled, automatically generates an env.mjs file with Zod-based environment variable validation, a .env.example template, a secure next.config.js with recommended security headers, a .gitignore with best practices, and ensures zod is added as a dependency. This step only applies to Next.js architectures and is invoked during project generation. [1] [2] [3]

Template simplification:

  • Removed the hardcoded env.mjs and related environment validation logic from the Next.js template (templates/portfolio/nextjs-monolith/env.mjs and lib/db.ts), so this logic is now provided by the generator when security hardening is enabled. [1] [2]

Closes #47

@Josephat-S Josephat-S requested a review from a team May 26, 2026 10:02
@Josephat-S Josephat-S merged commit 1b8c5ea into dev May 26, 2026
6 checks passed
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.

Implement Security Hardening Module

1 participant