DEV Community

Sospeter Mong'are
Sospeter Mong'are

Posted on

Make changes to individual sub-module(admin-panel)

If a client wants a change in their individual admin panel, you need a way to apply updates without affecting other client projects that share the same admin-panel submodule. Here’s how to go about it:


Approach: Use a Separate Branch for Each Client

Since the admin panel is a Git submodule, the best approach is to use branches to track custom changes for each client.

1️⃣ Create a Separate Branch for the Client

If a client (e.g., Client A) wants a custom feature, you need to create a new branch inside the admin panel submodule:

cd client-project-A/admin-panel  # Navigate into the submodule
git checkout -b client-a-customization  # Create a new branch
Enter fullscreen mode Exit fullscreen mode

Now, make the required changes in the admin-panel submodule (e.g., modifying controllers, adding new features).


2️⃣ Commit and Push the Changes

Once you finish the changes:

git add .
git commit -m "Custom changes for Client A"
git push origin client-a-customization  # Push changes to remote
Enter fullscreen mode Exit fullscreen mode

Now, the custom admin panel version for Client A exists in the client-a-customization branch.


3️⃣ Switch the Client Project to Use the New Branch

Go back to the client project and update the submodule to use the custom branch:

cd client-project-A
git submodule update --remote --checkout
cd admin-panel
git checkout client-a-customization
Enter fullscreen mode Exit fullscreen mode

Now, Client A’s project is using the customized admin panel without affecting other clients.


4️⃣ Keep Receiving Global Updates (Optional)

If the main admin panel (master branch) gets new features and you want to merge them into Client A’s custom version, do this:

cd client-project-A/admin-panel
git checkout client-a-customization
git pull origin master  # Merge latest changes from the main branch
Enter fullscreen mode Exit fullscreen mode

This allows Client A to get updates from the global admin panel while keeping their custom features.


Alternative: Use Feature Flags for Customization

Instead of creating separate branches, you can build a configuration system inside the admin panel where each client can enable or disable features dynamically via database settings or environment variables.

Example:

  • Store a list of enabled features in the database for each client.
  • Use middleware or policies to show/hide features based on the client’s configuration.

🎯 Final Thoughts

  • Use separate Git branches for each client’s customizations.
  • Ensure each client project checks out the correct branch for their admin panel submodule.
  • Merge updates from the main admin panel branch when needed.
  • Consider feature flags for more flexibility instead of maintaining multiple branches.

This method ensures maintainability while allowing each client to have their unique admin panel modifications. 🚀 Let me know if you need more details!

Top comments (0)