<?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>DEV Community: Apurba Singh</title>
    <description>The latest articles on DEV Community by Apurba Singh (@apurba_singh_196f99885e48).</description>
    <link>https://dev.to/apurba_singh_196f99885e48</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%2F1640291%2F822bde7c-9eb5-4e90-b415-2927b35e1ede.jpg</url>
      <title>DEV Community: Apurba Singh</title>
      <link>https://dev.to/apurba_singh_196f99885e48</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/apurba_singh_196f99885e48"/>
    <language>en</language>
    <item>
      <title>From Python to Laravel: Why I Built My Own IAM System Instead of Using Existing Packages</title>
      <dc:creator>Apurba Singh</dc:creator>
      <pubDate>Sat, 04 Apr 2026 05:30:57 +0000</pubDate>
      <link>https://dev.to/apurba_singh_196f99885e48/from-python-to-laravel-why-i-built-my-own-iam-system-instead-of-using-existing-packages-3a81</link>
      <guid>https://dev.to/apurba_singh_196f99885e48/from-python-to-laravel-why-i-built-my-own-iam-system-instead-of-using-existing-packages-3a81</guid>
      <description>&lt;p&gt;As a backend developer, I’ve spent most of my career working with Python — FastAPI, Django, Flask.&lt;br&gt;
I’ve always cared about one thing deeply:&lt;br&gt;
👉 building systems that scale without becoming messy&lt;br&gt;
But there was one problem I kept running into… no matter the stack.&lt;/p&gt;

&lt;p&gt;🧠 &lt;strong&gt;The Problem: The “Global Role” Trap&lt;/strong&gt;&lt;br&gt;
At first, everything looks simple:&lt;br&gt;
• Users&lt;br&gt;
• Roles&lt;br&gt;
• Permissions&lt;br&gt;
But as systems grow, things start breaking.&lt;br&gt;
Most RBAC (Role-Based Access Control) packages assume:&lt;br&gt;
👉 a user is either an Admin… or they aren’t.&lt;br&gt;
But real-world systems are never that simple.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A real scenario:&lt;/strong&gt;&lt;br&gt;
• A user is a &lt;strong&gt;Manager in Branch A&lt;/strong&gt;&lt;br&gt;
• The same user is a &lt;strong&gt;Viewer in Branch B&lt;/strong&gt;&lt;br&gt;
Now ask yourself:&lt;br&gt;
👉 How do you model this cleanly?&lt;/p&gt;

&lt;p&gt;Most of the time, we don’t.&lt;br&gt;
We write conditions like:&lt;br&gt;
if ($user-&amp;gt;role === 'manager' &amp;amp;&amp;amp; $branch_id === 1) { ... }&lt;br&gt;
And slowly…&lt;br&gt;
• logic spreads everywhere&lt;br&gt;
• dependencies grow&lt;br&gt;
• and one small change breaks multiple parts of the system&lt;/p&gt;

&lt;p&gt;😵 &lt;strong&gt;When It Became a Problem&lt;/strong&gt;&lt;br&gt;
Across multiple projects, I saw the same pattern:&lt;br&gt;
• Roles started multiplying&lt;br&gt;
• Permissions became unclear&lt;br&gt;
• Debugging access issues became painful&lt;br&gt;
It didn’t matter if I was using Python or Laravel.&lt;br&gt;
👉 The problem wasn’t the framework.&lt;br&gt;
👉 The problem was the model.&lt;/p&gt;

&lt;p&gt;🔄 &lt;strong&gt;The Turning Point&lt;/strong&gt;&lt;br&gt;
While working on Laravel-based systems, I explored existing solutions like Spatie.&lt;br&gt;
They are great — clean, simple, and widely used 👏&lt;br&gt;
But for complex systems, I kept hitting limitations:&lt;br&gt;
• No real support for contextual authority&lt;br&gt;
• Difficult to manage multi-tenant permissions&lt;br&gt;
• Hard to model relationships between roles and scopes&lt;br&gt;
At some point, I stopped trying to “work around” the problem.&lt;br&gt;
👉 I decided to rethink it.&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;Building Laravel IAM&lt;/strong&gt;&lt;br&gt;
Instead of focusing only on roles, I started thinking in terms of:&lt;br&gt;
👉 &lt;strong&gt;relationships + context + resolution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This led me to build:&lt;br&gt;
&lt;strong&gt;Laravel IAM (v0.2.0)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⚙️ &lt;strong&gt;The Core Idea: The Four Levels of Truth&lt;/strong&gt;&lt;br&gt;
Instead of hardcoding logic, the system resolves permissions through layered specificity:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;*&lt;em&gt;Global *&lt;/em&gt;→ &lt;em&gt;.&lt;/em&gt; (Super Admin)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource Wildcard&lt;/strong&gt; → invoice.*&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Action Wildcard&lt;/strong&gt; → *.approve&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Atomic Permission&lt;/strong&gt; → invoice.approve
This makes permission checks:
• predictable
• scalable
• easy to reason about&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;🧩 &lt;strong&gt;Context Matters&lt;/strong&gt;&lt;br&gt;
The same role doesn’t mean the same thing everywhere.&lt;br&gt;
So the system supports:&lt;br&gt;
• Tenant-based roles&lt;br&gt;
• Team-based roles&lt;br&gt;
• Branch-level permissions&lt;br&gt;
👉 Without turning your code into a mess&lt;/p&gt;

&lt;p&gt;💡 &lt;strong&gt;What I Learned&lt;/strong&gt;&lt;br&gt;
This journey taught me something important:&lt;br&gt;
👉 &lt;strong&gt;Authorization is not about roles — it’s about context&lt;/strong&gt;&lt;br&gt;
And even more importantly:&lt;br&gt;
👉 &lt;strong&gt;Architecture matters more than framework&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⚙️ &lt;strong&gt;Under the Hood&lt;/strong&gt;&lt;br&gt;
Some design decisions behind the system:&lt;br&gt;
• &lt;strong&gt;Registry Pattern&lt;/strong&gt; → decoupled resources &amp;amp; actions&lt;br&gt;
• &lt;strong&gt;Flexible Role Assignment&lt;/strong&gt; → supports IDs, slugs, or models&lt;br&gt;
• &lt;strong&gt;Scoped Middleware&lt;/strong&gt; → supports contextual authorization&lt;br&gt;
• &lt;strong&gt;Blade Directives&lt;/strong&gt; → clean UI permission checks&lt;br&gt;
And yes — everything is backed by a test suite simulating real workflows ✅&lt;/p&gt;

&lt;p&gt;🛠️ &lt;strong&gt;Open Source&lt;/strong&gt;&lt;br&gt;
I’ve open-sourced the project and would genuinely love feedback:&lt;br&gt;
📦 &lt;a href="https://packagist.org/packages/apurba-labs/laravel-iam" rel="noopener noreferrer"&gt;https://packagist.org/packages/apurba-labs/laravel-iam&lt;/a&gt;&lt;br&gt;
💻 &lt;a href="https://github.com/apurba-labs/laravel-iam" rel="noopener noreferrer"&gt;https://github.com/apurba-labs/laravel-iam&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💬 &lt;strong&gt;Let’s Talk&lt;/strong&gt;&lt;br&gt;
How do you handle complex permissions in your systems?&lt;br&gt;
Have you faced similar challenges with RBAC?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the 2026 WeCoded Challenge (&lt;a href="https://dev.to/challenges/wecoded-2026):"&gt;https://dev.to/challenges/wecoded-2026):&lt;/a&gt; Echoes of Experience&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Built with ☕ and logic by Apurba Labs.&lt;/p&gt;

&lt;h1&gt;
  
  
  Laravel #PHP #Python #IAM #RBAC #SaaS #Backend #OpenSource #WeCoded #wecoded2026
&lt;/h1&gt;

</description>
      <category>laravel</category>
      <category>saas</category>
      <category>opensource</category>
      <category>wecoded</category>
    </item>
    <item>
      <title>I’m a Python Developer — So I Built a Better IAM System for Laravel</title>
      <dc:creator>Apurba Singh</dc:creator>
      <pubDate>Fri, 03 Apr 2026 19:16:58 +0000</pubDate>
      <link>https://dev.to/apurba_singh_196f99885e48/im-a-python-developer-so-i-built-a-better-iam-system-for-laravel-gah</link>
      <guid>https://dev.to/apurba_singh_196f99885e48/im-a-python-developer-so-i-built-a-better-iam-system-for-laravel-gah</guid>
      <description>&lt;p&gt;I’m a Python/FastAPI Developer — So I Built an IAM System in Laravel&lt;br&gt;
As a backend developer working with FastAPI, Django, and Flask, I’ve always cared deeply about clean architecture and scalable authorization systems.&lt;br&gt;
But every time I built a SaaS product, I ran into the same problem:&lt;br&gt;
👉 Permissions become messy… very quickly.&lt;/p&gt;




&lt;p&gt;🧠 The Real Problem: Contextual Authority&lt;br&gt;
Let’s say:&lt;br&gt;
• A user is a Manager in Branch A&lt;br&gt;
• The same user is a Viewer in Branch B&lt;br&gt;
Most RBAC systems struggle here.&lt;br&gt;
You either:&lt;br&gt;
• add tons of conditional logic ❌&lt;br&gt;
• or end up with tightly coupled, hard-to-maintain permission rules ❌&lt;/p&gt;




&lt;p&gt;😵 The Breaking Point&lt;br&gt;
When systems grow, you start seeing:&lt;br&gt;
• Role explosions (too many roles)&lt;br&gt;
• Nested dependencies&lt;br&gt;
• Hardcoded permission checks&lt;br&gt;
• “Who can do what?” becomes unclear&lt;br&gt;
I faced this repeatedly in Python projects…&lt;br&gt;
and surprisingly, the same issue exists in Laravel.&lt;/p&gt;

&lt;p&gt;🚀 So I Built: Laravel IAM (v0.2.0)&lt;br&gt;
Instead of patching the problem, I designed a system that handles:&lt;br&gt;
✔ Contextual permissions (per scope: tenant, team, branch)&lt;br&gt;
✔ Wildcard permissions (expense.&lt;em&gt;, *.&lt;/em&gt;)&lt;br&gt;
✔ Hierarchical access (manage → all actions)&lt;br&gt;
✔ Dynamic resolution (no hardcoded roles)&lt;/p&gt;

&lt;p&gt;⚙️ The Core Idea: “Four Levels of Truth”&lt;br&gt;
The engine resolves permissions using a layered approach:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Direct Permission → exact match&lt;/li&gt;
&lt;li&gt;Wildcard Match → resource.*&lt;/li&gt;
&lt;li&gt;Hierarchy Rule → resource.manage&lt;/li&gt;
&lt;li&gt;Global Access → &lt;em&gt;.&lt;/em&gt;
This allows instant and predictable permission resolution — even in complex SaaS environments.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;🔥 Why Not Just Use Existing Packages?&lt;br&gt;
Packages like Spatie are great for basic RBAC 👏&lt;br&gt;
But they don’t fully solve:&lt;br&gt;
• Context-based access control&lt;br&gt;
• Dynamic multi-tenant systems&lt;br&gt;
• Workflow-aware permission resolution&lt;/p&gt;

&lt;p&gt;💡 Example&lt;br&gt;
IAM::can($user, 'expense.approve');&lt;br&gt;
No complex conditionals.&lt;br&gt;
No hardcoded roles.&lt;br&gt;
Just clean, predictable logic.&lt;/p&gt;

&lt;p&gt;🛠️ Open Source — Try It&lt;br&gt;
I’ve open-sourced the project and would love feedback from the community:&lt;br&gt;
📦 Packagist: &lt;a href="https://packagist.org/packages/apurba-labs/laravel-iam" rel="noopener noreferrer"&gt;https://packagist.org/packages/apurba-labs/laravel-iam&lt;/a&gt;&lt;br&gt;
💻 GitHub: &lt;a href="https://github.com/apurba-labs/laravel-iam" rel="noopener noreferrer"&gt;https://github.com/apurba-labs/laravel-iam&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💬 Let’s Discuss&lt;br&gt;
How do you handle contextual permissions in your projects?&lt;br&gt;
Have you faced similar issues with RBAC systems?&lt;/p&gt;

&lt;h1&gt;
  
  
  Laravel #PHP #FastAPI #RBAC #IAM #SaaS #Backend #OpenSource
&lt;/h1&gt;

</description>
      <category>backend</category>
      <category>laravel</category>
      <category>showdev</category>
      <category>wecoded</category>
    </item>
    <item>
      <title>I Built a Laravel Approval Engine to Stop Email Spam 🚀</title>
      <dc:creator>Apurba Singh</dc:creator>
      <pubDate>Wed, 25 Mar 2026 23:33:15 +0000</pubDate>
      <link>https://dev.to/apurba_singh_196f99885e48/i-built-a-laravel-approval-engine-to-stop-email-spam-3okd</link>
      <guid>https://dev.to/apurba_singh_196f99885e48/i-built-a-laravel-approval-engine-to-stop-email-spam-3okd</guid>
      <description>&lt;p&gt;Over the last few months, while working on enterprise Laravel projects, I noticed a recurring "Notification Nightmare." &lt;/p&gt;

&lt;p&gt;Every company needs an approval workflow (requisitions, invoices, PTO), but most systems flood managers with separate notifications for every single item. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I decided to build a solution: &lt;a href="https://github.com/apurba-labs/laravel-approval-engine" rel="noopener noreferrer"&gt;Laravel Approval Engine&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔥 The "Smart Batching" Concept
&lt;/h2&gt;

&lt;p&gt;The core problem with enterprise workflows isn't the approval logic; it's &lt;strong&gt;notification fatigue.&lt;/strong&gt; Instead of sending 50 separate emails for 50 pending approvals, my engine buffers them into &lt;strong&gt;1 smart batch&lt;/strong&gt;. The manager receives a single, clean digest with secure, token-based links to approve everything at once.&lt;/p&gt;

&lt;h2&gt;
  
  
  🏗️ How it Works
&lt;/h2&gt;

&lt;p&gt;The architecture is designed to be modular and plug-and-play.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Define a Module:&lt;/strong&gt; Use &lt;code&gt;php artisan make:workflow-module&lt;/code&gt; to create a logic class.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Queue Records:&lt;/strong&gt; Your business models enter a "pending" state.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;The Processor:&lt;/strong&gt; A scheduled artisan command bundles pending records into a &lt;code&gt;Batch&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Action:&lt;/strong&gt; The approver receives a single email. They can &lt;strong&gt;Approve All&lt;/strong&gt;, &lt;strong&gt;Reject&lt;/strong&gt;, or &lt;strong&gt;View Details&lt;/strong&gt; via a secure Next.js dashboard.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🧠 Technical Highlights
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-stage Workflows:&lt;/strong&gt; Easily route from &lt;code&gt;Manager -&amp;gt; Finance -&amp;gt; CEO&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token-based Security:&lt;/strong&gt; Approvers don't even need to log in to take action.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event-Driven:&lt;/strong&gt; Hooks for every stage (Created, Approved, Escalated).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Next.js Dashboard:&lt;/strong&gt; A sleek frontend for managing the workflow status.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Laravel 12 Ready:&lt;/strong&gt; Built to work with the latest PHP 8.2+ features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  📊 The Workflow Flow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph TD
    A[Pending Records] --&amp;gt; B[Smart Batch Created]
    B --&amp;gt; C[Email Digest Sent]
    C --&amp;gt; D[Approver Clicks Link]
    D --&amp;gt; E[Stage Resolver]
    E --&amp;gt; F{Next Stage?}
    F -- Yes --&amp;gt; G[Create Next Batch]
    F -- No --&amp;gt; H[Workflow Completed]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🚀 Try the Demo
&lt;/h2&gt;

&lt;p&gt;I've included a demo inside the repo so you can see it in action in under 2 minutes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/apurba-labs/laravel-approval-engine
&lt;span class="nb"&gt;cd &lt;/span&gt;laravel-approval-engine/example/laravel-demo
composer &lt;span class="nb"&gt;install
&lt;/span&gt;php artisan approval:demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔗 GitHub
&lt;/h2&gt;

&lt;p&gt;I’d love for the community to check it out, give it a star, or suggest new features!&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/apurba-labs/laravel-approval-engine" rel="noopener noreferrer"&gt;Get the Code on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Would love to hear your feedback! How do you handle complex approval routing in your own Laravel apps?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
