Socket
Socket
Sign inDemoInstall

@patrtorg/enim-magni-hic

Package Overview
Dependencies
Maintainers
0
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@patrtorg/enim-magni-hic

![GitHub branch checks state][build-url] [![codecov][cov-img]][cov-url] [![Known Vulnerabilities][snyk-img]][snyk-url]


Version published
Maintainers
0
Created
Source

GitHub branch checks state codecov Known Vulnerabilities

🌐 Next.js Runtime Environment Configuration

Effortlessly populate your environment at runtime, not just at build time, with @patrtorg/enim-magni-hic.

🌟 Highlights:

  • Isomorphic Design: Works seamlessly on both server and browser, and even in middleware.
  • Next.js 13 & 14 Ready: Fully compatible with the latest Next.js features.
  • .env Friendly: Use .env files during development, just like standard Next.js.

🤔 Why @patrtorg/enim-magni-hic?

In the modern software development landscape, the "Build once, deploy many" philosophy is key. This principle, essential for easy deployment and testability, is a cornerstone of continuous delivery and is embraced by the twelve-factor methodology. However, front-end development, particularly with Next.js, often lacks support for this - requiring separate builds for different environments. @patrtorg/enim-magni-hic is our solution to bridge this gap in Next.js.

📦 Introducing @patrtorg/enim-magni-hic

@patrtorg/enim-magni-hic dynamically injects environment variables into your Next.js application at runtime. This approach adheres to the "build once, deploy many" principle, allowing the same build to be used across various environments without rebuilds.

🤝 Compatibility Notes

🔖 Version Guide

  • 1.x: Next.js 12/13 Page Router
  • 2.x: Next.js 13 App Router
  • 3.x: Next.js 14 with advanced caching

🚀 Getting Started

In your app/layout.tsx, add:

// app/layout.tsx
import { PublicEnvScript } from '@patrtorg/enim-magni-hic';

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <head>
        <PublicEnvScript />
      </head>
      <body>
        {children}
      </body>
    </html>
  );
}

The PublicEnvScript component automatically exposes all environment variables prefixed with NEXT_PUBLIC_ to the browser. For custom variable exposure, refer to EXPOSING_CUSTOM_ENV.md.

🧑‍💻 Usage

Access your environment variables easily:

// app/client-page.tsx
'use client';
import { env } from '@patrtorg/enim-magni-hic';

export default function SomePage() {
  const NEXT_PUBLIC_FOO = env('NEXT_PUBLIC_FOO');
  return <main>NEXT_PUBLIC_FOO: {NEXT_PUBLIC_FOO}</main>;
}

🛠 Utilities

Need to expose non-prefixed environment variables to the browser? Check out MAKING_ENV_PUBLIC.md.

👷 Maintenance

@patrtorg/enim-magni-hic is proudly maintained by Expatfile.tax, the leading US expat tax e-filing software.

📚 Acknowledgments

Kudos to the react-env project for the inspiration, and a shoutout to @andonirdgz for the innovative context provider idea!


Keywords

FAQs

Package last updated on 07 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc