<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: oskhar</title>
    <description>The latest articles on Forem by oskhar (@oskhar).</description>
    <link>https://forem.com/oskhar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1944659%2F66ecc963-b5b4-465b-870d-b23fd5ef2283.jpeg</url>
      <title>Forem: oskhar</title>
      <link>https://forem.com/oskhar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/oskhar"/>
    <language>en</language>
    <item>
      <title>🚀 Commitizen: Making Git Commits the Right Way</title>
      <dc:creator>oskhar</dc:creator>
      <pubDate>Thu, 17 Apr 2025 20:24:08 +0000</pubDate>
      <link>https://forem.com/oskhar/commitizen-making-git-commits-the-right-way-g70</link>
      <guid>https://forem.com/oskhar/commitizen-making-git-commits-the-right-way-g70</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;✅ Once you start using Commitizen, it’s hard to go back. Your future self (and your team) will thank you.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/GDGoC-UINJKT" rel="noopener noreferrer"&gt;
        GDGoC-UINJKT
      &lt;/a&gt; / &lt;a href="https://github.com/GDGoC-UINJKT/init-repo-template" rel="noopener noreferrer"&gt;
        init-repo-template
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🚀 Kickstart your next project with a clean, consistent, and collaborative-ready repo template — zero fuss, maximum clarity.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;🚀 init-repo-template&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;A professional and opinionated GitHub repository template to improve &lt;strong&gt;consistency&lt;/strong&gt;, &lt;strong&gt;collaboration&lt;/strong&gt;, and long-term maintainability for open-source or private projects.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;📦 Ready-to-clone setup for teams who care about clean Git history and a clear collaboration flow.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Related article
&lt;a href="https://dev.to/oskhar/commitizen-making-git-commits-the-right-way-g70" rel="nofollow"&gt;https://dev.to/oskhar/commitizen-making-git-commits-the-right-way-g70&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Why this template?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;This template helps you avoid:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;inconsistent commit messages&lt;/li&gt;
&lt;li&gt;unclear contribution rules&lt;/li&gt;
&lt;li&gt;repetitive repo setup across projects&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It’s designed to be &lt;strong&gt;reusable&lt;/strong&gt;, &lt;strong&gt;team-friendly&lt;/strong&gt;, and &lt;strong&gt;tool-agnostic&lt;/strong&gt; (not tied to Node.js projects).&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;What’s included ✨&lt;/h2&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.czrc&lt;/code&gt; for Commitizen-based interactive commits&lt;/li&gt;
&lt;li&gt;Conventional Commits &amp;amp; semantic versioning support&lt;/li&gt;
&lt;li&gt;Clear collaboration rules in &lt;code&gt;collaboration_guide.md&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;GitHub-ready structure (&lt;code&gt;.github&lt;/code&gt;, docs-friendly layout)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Getting started&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;1. Clone the template&lt;/h3&gt;

&lt;/div&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git clone https://github.com/your-username/init-repo-template.git your-project-name
&lt;span class="pl-c1"&gt;cd&lt;/span&gt; your-project-name&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;2. Read the collaboration guide&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;Before committing anything, read:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;collaboration_guide.md&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It explains commit rules, branching, PR flow, and review etiquette.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;3. Initialize your repository&lt;/h3&gt;

&lt;/div&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git init
git remote add origin &lt;span class="pl-k"&gt;&amp;lt;&lt;/span&gt;your-new-repo-url&lt;span class="pl-k"&gt;&amp;gt;&lt;/span&gt;
npm install -g&lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/GDGoC-UINJKT/init-repo-template" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Writing great code is only part of the job—communicating changes effectively is just as important. That’s where Commitizen comes in. If you’ve ever scrolled through a Git history and felt like deciphering commit messages was harder than debugging code, this tool is here to help.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Why Commit Messages Matter
&lt;/h2&gt;

&lt;p&gt;Every team has seen it: a Git log full of mysterious messages like &lt;code&gt;fix stuff&lt;/code&gt;, &lt;code&gt;update&lt;/code&gt;, or the dreaded &lt;code&gt;asdf&lt;/code&gt;. These commit messages make it hard to track down what changed, when, and why. A poorly written commit message not only wastes time during debugging or code reviews but also undermines the integrity of the development workflow.&lt;/p&gt;

&lt;p&gt;High-quality commit messages help with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🕵️ Tracking bugs and changes – When a bug is discovered, commit messages help pinpoint when the issue was introduced.&lt;/li&gt;
&lt;li&gt;📜 Generating changelogs – For software release notes and user-facing documentation, clean commit messages provide clear references to new features or fixed issues.&lt;/li&gt;
&lt;li&gt;🛠️ Simplifying releases and version bumps – Automated tools rely on commit structure to trigger semantic versioning and changelog creation.&lt;/li&gt;
&lt;li&gt;🤝 Collaborating better in teams – New contributors or reviewers can quickly understand what’s happening without deep-diving into diffs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consistency in commit messages makes your Git history readable, actionable, and valuable—not just now, but months or years down the line.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ What is Commitizen, Really?
&lt;/h2&gt;

&lt;p&gt;Commitizen (often abbreviated as CZ) is an open-source developer tool that standardizes commit messages by guiding developers through a prompt-based interface. It essentially replaces &lt;code&gt;git commit&lt;/code&gt; with a smarter alternative: &lt;code&gt;cz commit&lt;/code&gt;. This process reduces mental load and ensures messages follow a specific style guide.&lt;/p&gt;

&lt;p&gt;Rather than typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Added feature X"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git cz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And get prompted for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;type&lt;/strong&gt; of change (e.g., &lt;code&gt;feat&lt;/code&gt;, &lt;code&gt;fix&lt;/code&gt;, &lt;code&gt;chore&lt;/code&gt;, &lt;code&gt;docs&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;scope&lt;/strong&gt; of the change (e.g., component or module name)&lt;/li&gt;
&lt;li&gt;A short &lt;strong&gt;description&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;A longer &lt;strong&gt;body&lt;/strong&gt; if needed&lt;/li&gt;
&lt;li&gt;Any &lt;strong&gt;breaking changes&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Reference to &lt;strong&gt;issues&lt;/strong&gt; (e.g., &lt;code&gt;Closes #123&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This results in a commit message like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feat&lt;span class="o"&gt;(&lt;/span&gt;auth&lt;span class="o"&gt;)&lt;/span&gt;: add support &lt;span class="k"&gt;for &lt;/span&gt;multi-factor authentication
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is particularly useful when using tools like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;semantic-release&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;standard-version&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;release-it&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These tools rely on commit messages for changelog generation and version control, so Commitizen lays the groundwork for advanced automation.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍 Where Did Commitizen Come From?
&lt;/h2&gt;

&lt;p&gt;Commitizen originated from the need to bridge the gap between human-readable commit logs and machine-readable metadata. As teams began to adopt automated release tools like &lt;code&gt;semantic-release&lt;/code&gt;, a standard commit format became more essential than optional.&lt;/p&gt;

&lt;p&gt;The community began to converge around the &lt;a href="https://www.conventionalcommits.org/" rel="noopener noreferrer"&gt;Conventional Commits&lt;/a&gt; specification—a formal specification for writing standardized commit messages. Tools like Commitizen were developed to simplify adherence to this standard without expecting developers to memorize the format.&lt;/p&gt;

&lt;p&gt;Think of it this way: Git commit messages are one of the few ways developers &lt;em&gt;communicate chronologically&lt;/em&gt; through a project. Commitizen helps make that communication clear, searchable, and contextual. It started small but has grown to be an essential part of many professional and open-source workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why Use Commitizen?
&lt;/h2&gt;

&lt;p&gt;Adopting Commitizen isn’t just about being more organized—it’s about setting the foundation for better tooling, collaboration, and long-term project health.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some benefits in more detail:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;✅ Commit Consistency -&amp;gt; Every commit follows the same format, so no more deciphering what &lt;code&gt;final-update-really-this-time&lt;/code&gt; means. It introduces a shared language for your entire team.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;📝 Auto-generated Changelogs -&amp;gt; Tools like &lt;code&gt;conventional-changelog&lt;/code&gt; can parse your Git history and create beautiful changelogs automatically. This is crucial when shipping software, managing releases, or informing users.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🚀 CI/CD Integration -&amp;gt; Commitizen lays the groundwork for zero-touch deployments with tools like &lt;code&gt;semantic-release&lt;/code&gt;. With the right commit message, your pipeline can automatically determine whether to bump a patch, minor, or major version.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🔬 Readable History -&amp;gt; &lt;code&gt;git log&lt;/code&gt; transforms from a cryptic list of random strings into a story of your project's evolution. Developers can trace changes with clarity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;⏱️ Saves Time -&amp;gt; With commit prompts, developers don’t waste time formatting their messages or wondering what to write. Commitizen streamlines the process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🌍 Community Standard -&amp;gt; It’s widely adopted in both small teams and large enterprises. Knowing Commitizen makes you more effective across different codebases.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚙️ How to Get Started
&lt;/h2&gt;

&lt;p&gt;You don’t need to reinvent your workflow—just drop in Commitizen and go.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. 📦 Installation
&lt;/h3&gt;

&lt;p&gt;Install it globally (to use across all projects):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; commitizen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or locally for just one project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; commitizen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Global install is great for personal projects or experimentation. Local install is ideal for team environments to ensure consistent tooling for everyone.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. 📐 Choose an Adapter
&lt;/h3&gt;

&lt;p&gt;Adapters define how your commits should be structured. The most commonly used one is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; cz-conventional-changelog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This adapter uses the Conventional Commits specification. In &lt;code&gt;package.json&lt;/code&gt;, add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"config"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"commitizen"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./node_modules/cz-conventional-changelog"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This config tells Commitizen to use the installed adapter when prompting for commits.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. 🖊️ Start Committing
&lt;/h3&gt;

&lt;p&gt;Once everything is installed, commit using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx cz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or if installed globally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commitizen will guide you through a series of questions. Your answers generate a properly formatted commit message. This is especially powerful for teams with mixed experience levels—everyone commits the same way.&lt;/p&gt;

&lt;p&gt;You can also integrate with tools like &lt;code&gt;husky&lt;/code&gt; or &lt;code&gt;lint-staged&lt;/code&gt; to enforce commit linting automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧭 Beyond Basics: Making Commitizen Part of the Culture
&lt;/h2&gt;

&lt;p&gt;Just installing Commitizen isn’t enough—it’s about changing habits and aligning the team.&lt;/p&gt;

&lt;h3&gt;
  
  
  Best practices to help it stick:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🧪 Pre-commit hooks with Husky -&amp;gt; Add Commitizen as a Git hook so every commit goes through the &lt;code&gt;cz&lt;/code&gt; prompt. This ensures enforcement, not just suggestion.&lt;/li&gt;
&lt;li&gt;📘 Update CONTRIBUTING.md -&amp;gt; Document how to commit and why it matters. Link to the Conventional Commits guide.&lt;/li&gt;
&lt;li&gt;🧰 Automate with CI/CD -&amp;gt; Set up semantic versioning and changelog generation. When teammates see it working, they’ll get it.&lt;/li&gt;
&lt;li&gt;🔁 Review Commit Messages in PRs -&amp;gt; Don’t just review code—review commit messages. Over time, writing good commits becomes second nature.&lt;/li&gt;
&lt;li&gt;🎓 Train new contributors -&amp;gt; During onboarding, highlight how Commitizen improves code quality and deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Culture change doesn’t happen overnight, but the benefits of consistent commits pay off quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ A Real-World Template You Can Use Today
&lt;/h2&gt;

&lt;p&gt;If you’re thinking: “This sounds great, but I don’t want to set everything up from scratch,” then check out &lt;a href="https://github.com/gdgoc-uinjkt/init-repo-template" rel="noopener noreferrer"&gt;&lt;code&gt;gdgoc-uinjkt/init-repo-template&lt;/code&gt;&lt;/a&gt;. It’s a GitHub template repository that’s ready to go.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧵 What’s Inside?
&lt;/h3&gt;

&lt;p&gt;This template is carefully curated for clean, consistent project initialization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.czrc&lt;/code&gt; – Configuration file for Commitizen&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;collaboration_guide.md&lt;/code&gt; – Defines commit types, message rules, and branching strategy&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;code_of_conduct.md&lt;/code&gt; – Sets the tone for respectful collaboration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.github/ISSUE_TEMPLATE/&lt;/code&gt; – Issue templates for bug reports and feature requests&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.editorconfig&lt;/code&gt; – Ensures consistent formatting across IDEs&lt;/li&gt;
&lt;li&gt;No language-specific boilerplate – So it's ready for Python, Go, Java, or anything else&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🚦 How it Helps
&lt;/h3&gt;

&lt;p&gt;This template removes decision fatigue:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Ready-to-use config – Don’t waste time researching conventions or setting up Commitizen from scratch&lt;/li&gt;
&lt;li&gt;📚 Built-in documentation – Teammates know what to do, where to look, and how to contribute&lt;/li&gt;
&lt;li&gt;🧑‍🤝‍🧑 Promotes collaboration – Makes expectations clear before the first line of code is written&lt;/li&gt;
&lt;li&gt;🏗️ Scales well – From solo projects to large teams, everyone benefits from a consistent setup&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧭 How to Use It
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Visit &lt;a href="https://github.com/gdgoc-uinjkt/init-repo-template" rel="noopener noreferrer"&gt;gdgoc-uinjkt/init-repo-template&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;"Use this template"&lt;/strong&gt; on GitHub&lt;/li&gt;
&lt;li&gt;Fill in your repo details and create it&lt;/li&gt;
&lt;li&gt;Clone to your machine and start building with best practices in place&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🏁 Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Commitizen helps you level up how your team communicates in code. With the right setup—and templates like &lt;code&gt;init-repo-template&lt;/code&gt;—you can enforce quality, automate workflows, and build a clean Git history that tells the real story of your project.&lt;/p&gt;

&lt;p&gt;Whether you’re working on a solo side project or managing an enterprise-level team, Commitizen brings order to chaos and clarity to collaboration.&lt;/p&gt;

&lt;p&gt;Happy committing! 💬✨&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>git</category>
      <category>performance</category>
    </item>
    <item>
      <title>🚀 How to Integrate Commitizen (`cz`) into Your NvChad Setup for Better Git Commits</title>
      <dc:creator>oskhar</dc:creator>
      <pubDate>Thu, 10 Apr 2025 22:04:42 +0000</pubDate>
      <link>https://forem.com/oskhar/how-to-integrate-commitizen-cz-into-your-nvchad-setup-for-better-git-commits-2poi</link>
      <guid>https://forem.com/oskhar/how-to-integrate-commitizen-cz-into-your-nvchad-setup-for-better-git-commits-2poi</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;✅ &lt;em&gt;Make your Git commit messages clean, consistent, and conventional—right inside Neovim!&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When it comes to managing a codebase, &lt;em&gt;well-written commit messages&lt;/em&gt; are as important as clean code. They provide context, help with debugging, and assist collaborators (and your future self) in understanding the evolution of your project. That's where tools like &lt;em&gt;&lt;a href="https://github.com/commitizen/cz-cli" rel="noopener noreferrer"&gt;Commitizen&lt;/a&gt;&lt;/em&gt; shine — guiding you through the process of writing &lt;em&gt;conventional, standardized commits&lt;/em&gt; with ease.&lt;/p&gt;

&lt;p&gt;If you're using &lt;a href="https://github.com/NvChad/NvChad" rel="noopener noreferrer"&gt;NvChad&lt;/a&gt;, a modern and minimal Neovim configuration, integrating &lt;code&gt;cz&lt;/code&gt; into your workflow can &lt;em&gt;drastically improve your Git hygiene&lt;/em&gt; without ever leaving the comfort of your editor.&lt;/p&gt;

&lt;p&gt;This guide explores multiple best-practice approaches to integrating the &lt;code&gt;cz&lt;/code&gt; CLI into NvChad — from simple key mappings to plugin-powered terminals. Whether you're a minimalist or love your floating terminals, there's a setup here for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  📌 Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we begin, make sure you've set up the necessary environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ 1. Install Node.js and npm
&lt;/h3&gt;

&lt;p&gt;Commitizen is a Node.js-based CLI tool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;-v&lt;/span&gt;
npm &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If not installed, get Node.js from &lt;a href="https://nodejs.org/" rel="noopener noreferrer"&gt;nodejs.org&lt;/a&gt; or use your OS package manager.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ 2. Install Commitizen Globally
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; commitizen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify the installation with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should open the interactive Commitizen prompt in your terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Why Use Commitizen in Neovim?
&lt;/h2&gt;

&lt;p&gt;Integrating &lt;code&gt;cz&lt;/code&gt; directly into Neovim with NvChad offers several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🧘‍♂️ Editor-focused workflow – no context switching&lt;/li&gt;
&lt;li&gt;📋 Standardized commits – enforced structure like Conventional Commits&lt;/li&gt;
&lt;li&gt;🚫 Fewer mistakes – no more malformed commit messages&lt;/li&gt;
&lt;li&gt;⚡ Speed and efficiency – one keypress to commit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re already using Neovim as your IDE, why not make Git commits as smooth as writing code?&lt;/p&gt;

&lt;h2&gt;
  
  
  📁 Working with NvChad
&lt;/h2&gt;

&lt;p&gt;NvChad encourages a modular configuration approach. Your custom config lives in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~/.config/nvim/lua/custom/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll mainly edit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;chadrc.lua&lt;/code&gt; – main config for mappings, UI tweaks, etc.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mappings.lua&lt;/code&gt; – for custom key mappings&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugins/&lt;/code&gt; – for managing additional plugins like &lt;code&gt;toggleterm.nvim&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🛠️ Method 1: Lightweight Floating Terminal (Best for Simplicity)
&lt;/h2&gt;

&lt;p&gt;This method uses Neovim's native terminal inside a horizontal split — simple, fast, and dependency-free.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔧 Setup
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Add this function in &lt;code&gt;mappings.lua&lt;/code&gt; or &lt;code&gt;chadrc.lua&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;&lt;span class="kd"&gt;local&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;commitizen_commit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;vim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"belowright split | resize 15 | terminal cz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Map the function to a key, like &lt;code&gt;&amp;lt;leader&amp;gt;cz&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;  &lt;span class="kd"&gt;local&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keymap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set&lt;/span&gt;
  &lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;leader&amp;gt;cz"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;commitizen_commit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;desc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Commit using Commitizen"&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✅ Result:
&lt;/h3&gt;

&lt;p&gt;Hit &lt;code&gt;&amp;lt;leader&amp;gt;cz&lt;/code&gt; and a split terminal will open at the bottom, running the &lt;code&gt;cz&lt;/code&gt; prompt. Super clean and integrates naturally into Neovim.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 Method 2: Enhanced Popup Terminal with ToggleTerm (Best UI)
&lt;/h2&gt;

&lt;p&gt;Want a floating terminal popup with auto-toggle and minimal distractions? Enter &lt;code&gt;toggleterm.nvim&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  📦 Step-by-step
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Add &lt;code&gt;toggleterm.nvim&lt;/code&gt; as a custom plugin in &lt;code&gt;custom/plugins/commitizen.lua&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"akinsho/toggleterm.nvim"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
          &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"toggleterm"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

          &lt;span class="kd"&gt;local&lt;/span&gt; &lt;span class="n"&gt;Terminal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"toggleterm.terminal"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;Terminal&lt;/span&gt;
          &lt;span class="kd"&gt;local&lt;/span&gt; &lt;span class="n"&gt;cz_term&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Terminal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
              &lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"cz"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="n"&gt;hidden&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="n"&gt;direction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"float"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;})&lt;/span&gt;

      &lt;span class="n"&gt;vim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keymap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;leader&amp;gt;cz"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
          &lt;span class="n"&gt;cz_term&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
          &lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;desc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Commit with Commitizen"&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Then import it in &lt;code&gt;custom/plugins/init.lua&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"custom.plugins.commitizen"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✅ Result:
&lt;/h3&gt;

&lt;p&gt;Press &lt;code&gt;&amp;lt;leader&amp;gt;cz&lt;/code&gt;, and a sleek floating terminal opens with &lt;code&gt;cz&lt;/code&gt;. One of the best UX enhancements you can add to your Git workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔁 Method 3: Plain Terminal Split (No Plugin, No Problem)
&lt;/h2&gt;

&lt;p&gt;This method is plugin-free and even more minimalistic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;&lt;span class="n"&gt;vim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keymap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;leader&amp;gt;cz"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;vim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"split | terminal cz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;desc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Commitizen simple split"&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✅ Result:
&lt;/h3&gt;

&lt;p&gt;A quick vertical split opens up with &lt;code&gt;cz&lt;/code&gt;, perfect if you prefer no extra configuration or dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎨 Bonus: Command Palette Integration (NvChad Style)
&lt;/h2&gt;

&lt;p&gt;NvChad includes a command palette-style menu with fuzzy searching. You can create your own custom command to make &lt;code&gt;cz&lt;/code&gt; even more accessible.&lt;/p&gt;

&lt;h3&gt;
  
  
  💡 Add This to &lt;code&gt;chadrc.lua&lt;/code&gt;:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;&lt;span class="n"&gt;vim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nvim_create_user_command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Commitizen"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;vim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"split | terminal cz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✅ Usage:
&lt;/h3&gt;

&lt;p&gt;Just type &lt;code&gt;:Commitizen&lt;/code&gt; in command mode to launch the &lt;code&gt;cz&lt;/code&gt; prompt inside a split. Very handy for keyboard-driven users.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧼 Pro Tip: Prevent Commit Buffers from Lingering
&lt;/h2&gt;

&lt;p&gt;Sometimes, using &lt;code&gt;cz&lt;/code&gt; will leave a &lt;code&gt;.git/COMMIT_EDITMSG&lt;/code&gt; buffer in Neovim. While harmless, it can clutter your buffer list.&lt;/p&gt;

&lt;p&gt;To keep things clean:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;cz&lt;/code&gt; instead of &lt;code&gt;git commit&lt;/code&gt; directly.&lt;/li&gt;
&lt;li&gt;Set autocommands to close the buffer automatically if needed.&lt;/li&gt;
&lt;li&gt;Map &lt;code&gt;&amp;lt;leader&amp;gt;q&lt;/code&gt; to close commit message buffers quickly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  📦 Future Enhancements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🤖 Integrate with &lt;code&gt;gitmoji-cli&lt;/code&gt; for emoji-powered commits.&lt;/li&gt;
&lt;li&gt;🧠 Chain commands to auto-stage, run Commitizen, and push.&lt;/li&gt;
&lt;li&gt;🧰 Hook into &lt;code&gt;lazygit.nvim&lt;/code&gt; and combine floating tools.&lt;/li&gt;
&lt;li&gt;📑 Add commit templates with Conventional Commits + scopes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧭 Summary of Methods
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Floating Terminal&lt;/td&gt;
&lt;td&gt;Horizontal split terminal with &lt;code&gt;cz&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Simple, native integration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ToggleTerm Plugin&lt;/td&gt;
&lt;td&gt;Popup-style floating terminal&lt;/td&gt;
&lt;td&gt;Best UX, clean UI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plain Terminal Split&lt;/td&gt;
&lt;td&gt;Minimal config, vertical split&lt;/td&gt;
&lt;td&gt;Fast and dependency-free&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Command Palette&lt;/td&gt;
&lt;td&gt;Command-mode triggered &lt;code&gt;cz&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Keyboard-driven workflows&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  ✅ Final Thoughts
&lt;/h2&gt;

&lt;p&gt;You don’t need to leave Neovim to make high-quality, conventional commits. Whether you're team minimalism or love a polished UI, integrating &lt;code&gt;cz&lt;/code&gt; into NvChad will &lt;em&gt;save you time, enforce best practices, and make your Git history shine&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This guide offers multiple pathsgg — pick one that fits your workflow or try them all. Either way, your future team (or self) will thank you.&lt;/p&gt;

</description>
      <category>nvchad</category>
      <category>git</category>
      <category>programming</category>
      <category>neovim</category>
    </item>
    <item>
      <title>"Domain-Driven Laravel" build great systems that are scalable and powerful</title>
      <dc:creator>oskhar</dc:creator>
      <pubDate>Sun, 18 Aug 2024 16:21:57 +0000</pubDate>
      <link>https://forem.com/oskhar/domain-driven-laravel-build-great-systems-that-are-scalable-and-powerful-4458</link>
      <guid>https://forem.com/oskhar/domain-driven-laravel-build-great-systems-that-are-scalable-and-powerful-4458</guid>
      <description>&lt;p&gt;In the ever-expanding universe of software development, creating scalable, maintainable, and powerful systems is no small feat. With so many frameworks, tools, and patterns vying for your attention, it's easy to feel like a lost space traveler, orbiting without direction. But fear not, fellow developer! 🌌 The Domain-Driven Laravel repository is here to guide you through the cosmos of RESTful API development, using the Domain-Driven Design (DDD) methodology.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/oskhar/domain-driven-laravel" rel="noopener noreferrer"&gt;https://github.com/oskhar/domain-driven-laravel&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/oskhar" rel="noopener noreferrer"&gt;
        oskhar
      &lt;/a&gt; / &lt;a href="https://github.com/oskhar/domain-driven-laravel" rel="noopener noreferrer"&gt;
        domain-driven-laravel
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🛸 🔃 A pre-configured Laravel 11.x template crafted to facilitate the development of web applications following Domain-Driven Design (DDD) principles.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Domain-Driven Laravel 🛸 🔃&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://github.com/oskhar/domain-driven-laravel/blob/main/LICENSE" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/097023ad85a0394218c75775528b20a47d7140171865bf0ed0ca8920d220f54f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f736b6861722f646f6d61696e2d64726976656e2d6c61726176656c" alt="MIT License"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A robust, scalable, and flexible architecture for developing RESTful APIs with Laravel using Domain-Driven Design (DDD) principles.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://dev.to/oskhar/domain-driven-laravel-build-great-systems-that-are-scalable-and-powerful-4458" rel="nofollow"&gt;📘 Article&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Introduction&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Laravel is an excellent framework for building Powerfull Apps, offering a rich set of features and a clean syntax. However, as projects grow in complexity, it's easy for the codebase to become unmanageable. The absence of a clear architectural pattern can lead to a mix of responsibilities, making the code harder to maintain and scale.&lt;/p&gt;
&lt;p&gt;This repository presents a way to structure Laravel projects using Domain-Driven Design (DDD) principles, allowing for better organization, scalability, and separation of concerns. The approach showcased here is inspired by best practices and aims to solve real-world challenges in a practical and maintainable way.&lt;/p&gt;
&lt;p&gt;The goal is to provide a solid foundation for building Laravel applications that are.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;🧩 Easy to Understand. A well-organized codebase with clear boundaries.&lt;/li&gt;
&lt;li&gt;🛠️ Maintainable. Follow…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/oskhar/domain-driven-laravel" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;In this article, we’ll explore the galaxy of this remarkable Laravel package, uncover its unique features, and see why it's perfect for developers looking to build sophisticated systems. Buckle up, space cowboy, because we’re about to launch! 🚀&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;directory structure: &lt;a href="https://github.com/oskhar/domain-driven-laravel/blob/main/docs/project-structure.md" rel="noopener noreferrer"&gt;https://github.com/oskhar/domain-driven-laravel/blob/main/docs/project-structure.md&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What Is Domain-Driven Laravel?
&lt;/h2&gt;

&lt;p&gt;"Domain-Driven Laravel 🛸 🔃" is a structured approach to building RESTful APIs using Laravel, centered around the principles of Domain-Driven Design (DDD). This package allows you to structure your application logically by grouping related business logic into domains, making your system easier to scale and maintain.&lt;/p&gt;

&lt;p&gt;By leveraging Laravel’s robust architecture with the organizational power of DDD, this repository helps developers create well-organized APIs that are as efficient as they are powerful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Domain-Driven Design?
&lt;/h2&gt;

&lt;p&gt;Domain-Driven Design provides a clear structure for separating concerns and organizing your application into manageable, understandable parts. It focuses on defining the core domain and domain logic (the heart of your business logic) and keeps your application modular.&lt;/p&gt;

&lt;p&gt;Imagine having your system organized like planets orbiting a star, each with a well-defined purpose and connection to the larger system. With DDD, you’ll have domains such as User Management, Product Management, and more, each managing its own gravitational pull in the API ecosystem.&lt;/p&gt;

&lt;p&gt;The real magic of "Domain-Driven Laravel 🛸 🔃" is in its thoughtful implementation of these concepts, transforming Laravel into a well-oiled machine of interconnected domains. You can now build applications that are scalable and ready for the complexities of the real world.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Power of Error Handling: Laughing Through the Cosmos 🤖
&lt;/h2&gt;

&lt;p&gt;If you’re like most developers, you’ve encountered your fair share of error messages. But have you ever had an error handler that &lt;em&gt;insults you&lt;/em&gt; for making a mistake? Welcome to the world of "Domain-Driven Laravel 🛸 🔃", where error handling is not just functional—it’s personal and hilarious!&lt;/p&gt;

&lt;p&gt;This repo offers a built-in error-handling mechanism that not only returns the expected HTTP status codes but also scolds you for making mistakes. Let’s break down some of these responses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$exceptions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;QueryException&lt;/span&gt; &lt;span class="nv"&gt;$exception&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;
        &lt;span class="nc"&gt;APIResponseData&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
            &lt;span class="s2"&gt;"status"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"errors"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s2"&gt;"Bro wrote the wrong database query. Backend skills issue."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="nv"&gt;$exception&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getMessage&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;]),&lt;/span&gt;
        &lt;span class="nc"&gt;APIStatusEnum&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;INTERNAL_SERVER_ERROR&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The moment you make a bad database query, you’ll be greeted with a response like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s2"&gt;"Bro wrote the wrong database query. Backend skills issue."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of a typical, dry error message, the system nudges you to improve your backend skills—sometimes with a bit of attitude!&lt;/p&gt;

&lt;p&gt;Other responses include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Array Structure Gone Wrong:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s2"&gt;"Ayyo, looks like your backend messed up the array structure."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Bad Method Call:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s2"&gt;"Are you sure backend bro? The method you called doesn't exist."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Undefined Exception:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s2"&gt;"Your backend is dumb, bro."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This unique approach not only provides you with helpful information but adds a fun twist to your debugging experience. It turns those dreaded errors into moments of levity, reminding you that even in the vastness of code, a little humor can go a long way.&lt;/p&gt;

&lt;h3&gt;
  
  
  Response Structure.
&lt;/h3&gt;

&lt;p&gt;Thanks to the well-defined structure of the API response, all errors, including these personalized ones, will follow a consistent format. The &lt;code&gt;APIResponseData&lt;/code&gt; class ensures that the response is structured like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;APIResponseData&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Data&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;?bool&lt;/span&gt; &lt;span class="nv"&gt;$status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;?string&lt;/span&gt; &lt;span class="nv"&gt;$message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;mixed&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="cd"&gt;/** @var array&amp;lt;string&amp;gt; */&lt;/span&gt;
        &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;?array&lt;/span&gt; &lt;span class="nv"&gt;$errors&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;?PaginationData&lt;/span&gt; &lt;span class="nv"&gt;$pagination&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;?APIMetaData&lt;/span&gt; &lt;span class="nv"&gt;$meta&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here’s how a 500 Internal Server Error might look:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Example&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Internal&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Server&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Error&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Galactic disruption. An unexpected cosmic event occurred!"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"errors"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"Bro wrote the wrong database query. Backend skills issue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"{{ Query error messages specifically }}"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"meta"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"request_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"response_size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"integer|byte"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This structure provides clarity and consistency, ensuring that every response, whether success or failure, is predictable and easy to handle on the client side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Default Messages: Cosmic Wisdom 🌠
&lt;/h2&gt;

&lt;p&gt;Another shining feature of this repository is the default message handling for API responses. If you forget to set a message on your response, you won't just get a generic fallback—you’ll get a galactic-themed message that makes your API feel like a trip through the stars.&lt;/p&gt;

&lt;p&gt;Here’s a sample of the default messages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;200 SUCCESS&lt;/code&gt;: &lt;em&gt;"Success! Your request has safely landed back to Earth."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;201 CREATED&lt;/code&gt;: &lt;em&gt;"New entity launched into the cosmos."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;400 BAD_REQUEST&lt;/code&gt;: &lt;em&gt;"Your request veered off course and couldn't escape Earth's gravity!"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;401 UNAUTHORIZED&lt;/code&gt;: &lt;em&gt;"Your credentials don't pass the cosmic gatekeeper!"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;404 NOT_FOUND&lt;/code&gt;: &lt;em&gt;"The data you're seeking is beyond the bounds of space!"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;500 INTERNAL_SERVER_ERROR&lt;/code&gt;: &lt;em&gt;"Galactic disruption. An unexpected cosmic event occurred!"&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These thematic responses don’t just provide a fun flavor to your API—they also make it clearer to clients and users what’s happening under the hood.&lt;/p&gt;

&lt;p&gt;For example, if your request hits a &lt;code&gt;404&lt;/code&gt;, instead of a boring "Not Found" message, you’ll receive a cosmic-themed error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s2"&gt;"The data you're seeking is beyond the bounds of space!"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach not only enriches the developer experience but also makes the API more user-friendly. Your clients and users will enjoy these little touches of humor and personality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Going Beyond: What Else Makes This Repository Stellar? 💫
&lt;/h2&gt;

&lt;p&gt;"Domain-Driven Laravel 🛸 🔃" isn't just about humor and cosmic messages. It's a fully fleshed-out package that makes it easier to manage your Laravel applications using DDD principles. Let’s take a look at some of the other key features:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Modular Domain Design.
&lt;/h3&gt;

&lt;p&gt;With a clean and modular architecture, you can easily organize your application into domains, each with its own logic and responsibility. This separation allows for better scaling, testing, and maintenance.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Built-in API Response Management.
&lt;/h3&gt;

&lt;p&gt;Handling API responses is a breeze with a consistent structure that ensures all responses are formatted correctly. Whether you’re returning success, error, or validation messages, the built-in API response handler will make sure everything is in its right place.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Error Handling that Learns.
&lt;/h3&gt;

&lt;p&gt;While the humorous error handling adds personality, it also comes with a solid system that tracks and logs exceptions in a way that helps you debug and improve your code.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Advanced Middleware.
&lt;/h3&gt;

&lt;p&gt;The repository includes advanced middleware implementations that ensure all parts of your application are in sync with the domain rules and API structure. With these middleware hooks, you can ensure that your application always behaves as expected.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Integration with Spatie's Packages.
&lt;/h3&gt;

&lt;p&gt;Leverage the power of Spatie’s robust Laravel packages for roles, permissions, and data handling. This repo comes with pre-configured support for Spatie’s tools, giving you the best of both worlds: the organization of DDD and the strength of Laravel’s best packages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple Usage: Focus on Domain Actions 🛠️
&lt;/h2&gt;

&lt;p&gt;When working with the repository, simplicity is key. The goal is for developers to focus purely on domain actions without worrying about infrastructure concerns. This clear separation of responsibilities ensures that each domain handles its own business logic while leaving shared services and external integrations to other layers.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Stay Focused on Domain Actions.
&lt;/h3&gt;

&lt;p&gt;In this structure, all core logic related to a specific domain is encapsulated in &lt;code&gt;Actions&lt;/code&gt;. You don’t need to think about cross-domain interactions or infrastructure concerns—just focus on building the actions that power your domain. For example, an action like &lt;code&gt;CreateUserAction&lt;/code&gt; lives entirely within the User domain and manages user creation. You can call this action from a controller or another action, keeping your code concise and easy to manage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Domain\User\Actions&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Domain\User\Models\User&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Domain\User\Data\UserData&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CreateUserAction&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;UserData&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;User&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This straightforward action does its job without needing to handle infrastructure-level details like logging, caching, or external API calls. Those concerns are dealt with in the &lt;code&gt;Infrastructure&lt;/code&gt; layer or the &lt;code&gt;Shared&lt;/code&gt; domain, keeping your actions clean and single-focused.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Shared Domain for Cross-Cutting Concerns.
&lt;/h3&gt;

&lt;p&gt;Any service that spans across multiple domains, such as authentication, logging, or notifications, can be placed in the &lt;code&gt;Shared&lt;/code&gt; domain. This prevents domain entanglement and ensures that the logic stays modular and focused.&lt;/p&gt;

&lt;p&gt;For example, a notification service can live in the &lt;code&gt;Shared&lt;/code&gt; domain, allowing any domain to trigger notifications without duplicating code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Domain\Shared\Services&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;NotificationService&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;sendNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;UserData&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$message&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Logic for sending notifications&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any domain that needs to notify users can simply call this service, ensuring that the &lt;code&gt;NotificationService&lt;/code&gt; is consistent across the application.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Infrastructure for External Integrations.
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;Infrastructure&lt;/code&gt; layer handles external services and integrations. This includes third-party APIs, payment gateways, or database configurations. By keeping external integrations here, your domain actions remain focused on business logic without worrying about how the external world works.&lt;/p&gt;

&lt;p&gt;For instance, a payment gateway service could be handled in &lt;code&gt;Infrastructure&lt;/code&gt;, keeping payment logic separate from core domain actions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Infrastructure\Services&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PaymentGatewayService&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;processPayment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;PaymentDetailsData&lt;/span&gt; &lt;span class="nv"&gt;$details&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;mixed&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Payment processing logic&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this structure, domain actions can call on external services when needed, but the bulk of the integration code is abstracted away, keeping your business logic clean and independent.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Flexibility with Interfaces.
&lt;/h3&gt;

&lt;p&gt;To enhance the repository's flexibility and error prevention, developers who are comfortable using interfaces can incorporate a dedicated &lt;code&gt;Interfaces&lt;/code&gt; folder. This addition provides a structured way to manage potential changes, such as migrations or dependency removals, without impacting the core functionality. The minimalist design of this repository ensures that it remains adaptable to various development needs, and the use of interfaces aligns with this principle by offering a safeguard against unforeseen changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;
&lt;span class="err"&gt;├──&lt;/span&gt; &lt;span class="nc"&gt;Console&lt;/span&gt;                     &lt;span class="c1"&gt;# Custom Artisan commands&lt;/span&gt;
&lt;span class="err"&gt;├──&lt;/span&gt; &lt;span class="nc"&gt;Domain&lt;/span&gt;                      &lt;span class="c1"&gt;# Core domain logic and business rules&lt;/span&gt;
&lt;span class="err"&gt;├──&lt;/span&gt; &lt;span class="nc"&gt;Infrastructure&lt;/span&gt;              &lt;span class="c1"&gt;# Infrastructure-related code&lt;/span&gt;
&lt;span class="err"&gt;└──&lt;/span&gt; &lt;span class="nc"&gt;Interfaces&lt;/span&gt;                  &lt;span class="c1"&gt;# Additional Folder&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach allows developers to define contracts for their actions, services, or any other components that may evolve over time, ensuring that the code remains stable and maintainable across different stages of development.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. No Domain Interference.
&lt;/h3&gt;

&lt;p&gt;One of the core principles of "Domain-Driven Laravel 🛸 🔃" is that each domain should remain isolated from others. Domains should not interfere with each other’s logic or responsibilities. If multiple domains need to share services or data, those services should either be abstracted into the &lt;code&gt;Shared&lt;/code&gt; domain or handled in &lt;code&gt;Infrastructure&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This ensures that no domain unintentionally “leaks” logic or affects the behavior of another. It makes your codebase easier to maintain and scale as each domain evolves independently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Take Your Laravel Development to the Stars 🌌
&lt;/h2&gt;

&lt;p&gt;If you’re ready to build Laravel applications that are not only scalable and powerful but also fun to work with, "Domain-Driven Laravel 🛸 🔃" is the repository for you. It combines the elegance of Domain-Driven Design with Laravel's strength, all while adding a dash of cosmic humor 💀&lt;/p&gt;

&lt;p&gt;Whether you’re a seasoned developer or just getting started with DDD, this package will help you organize your code, streamline your APIs, and provide a delightful development experience.&lt;/p&gt;

&lt;p&gt;So what are you waiting for? Head over to the &lt;a href="https://github.com/oskhar/domain-driven-laravel" rel="noopener noreferrer"&gt;Domain-Driven Laravel 🛸 🔃 repository&lt;/a&gt;, and start building systems that are out of this world!&lt;/p&gt;

&lt;p&gt;May your code always compile, and your APIs always return a 200! 🚀✨&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>restapi</category>
      <category>laravel</category>
      <category>php</category>
    </item>
  </channel>
</rss>
