I went from designer to frontend lead on this project.
Panel SBF is the internal platform where teams across Grupo SBF put the tools that stores, sales, inventory, campaigns and pricing depend on. I joined as a product designer, wrote the plan to replace a legacy admin, and then I was asked to lead the frontend that carried it out.
Role
Senior Product Designer, then Frontend Engineer and frontend lead
ProblemThe tools were scattered, and anyone could grant any permission.
People across the company kept complaining about the same thing. Solutions were spread across many teams, and every new product rebuilt the same services.
Behind all of that there was a legacy admin written in C#, with the interface in a C# framework too. It had hundreds of features and real security gaps. Its permission model let anyone grant anything, including discount coupons of up to 99% off.
Frame · My role
My roleI was hired as a designer and ended up writing the plan.
I joined as a product designer on a team with two products, freight management and inventory management.
I mapped every product inside the legacy admin and all of its security gaps.
I wrote an action plan and a future state, which was to move the scattered services into one modern platform.
I designed the architecture, and then I was asked to lead the frontend and carry the plan out.
Frame · Decision 01
DecisionWe used one monorepo with a Go proxy in front of every service.
The new Panel lives in a monorepo. The frontend is Next.js, which is a lot simpler to maintain than the old admin. Every request goes through a Go backend that works as a proxy and as the role middleware, so no screen talks to a team's service directly.
Panel · Next.js
Go proxy · roles and audit
Team services
Frame · Decision 02
DecisionPermissions come from the brand, and the master user is gone.
Each user belongs to a brand, and only some users can see every brand. We removed the master user, the one that could give any permission to anyone.
Comment from Thiago
Thiago · the ruleYou get access through the brands you belong to and the actions you were granted inside them.
Frame · Decision 03
DecisionThe proxy logs every request.
Since everything goes through the proxy, that's where we write the audit log. On every request it saves the user id and what that user did in the Panel.
Frame · Decision 04
DecisionWe started with coupons.
The first feature we prioritized was discount coupon management, because that's where the old model let people create coupons of up to 99% off, and that was the gap we wanted to close first.
Frame · Screen · recreated
ScreenYou can try both permission models here.
Pick a user and create a coupon in each model. The legacy admin lets everyone create it and doesn't log anything. The Panel checks the user's brand and role, and it logs every attempt.
New coupon
Pick a user, a brand and a discount, then create the coupon.
Audit logEvery attempt that goes through the proxy shows up here, allowed or not.
I recreated this with fake data and made-up limits. There's no company code, assets or copy in it.
Frame · Code
CodeHere's a simplified version of the two checks.
// Simplified example for this page. Not company code.func Authorize(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user := UserFrom(r.Context())
action := ActionFor(r) // "coupons:create"
brand := r.Header.Get("X-Brand")
allowed := Can(user, action, brand)
audit.Write(audit.Entry{
UserID: user.ID,
Action: action,
Brand: brand,
Allowed: allowed,
})
if !allowed {
http.Error(w, "forbidden", http.StatusForbidden)
return
}
next.ServeHTTP(w, r)
})
}
// Simplified example for this page. Not company code.type Brand = 'centauro' | 'nike';
type Action = 'coupons:view' | 'coupons:create';
type User = {
id: string;
brands: Brand[] | 'all';
actions: Action[];
};
// There is no master role: access comes from the brands// a user belongs to, and the actions granted inside them.exportconst can = (user: User, action: Action, brand: Brand) =>
(user.brands === 'all' || user.brands.includes(brand)) &&
user.actions.includes(action);
I wrote this for this page to show the idea. It's not the production code.
Frame · Result
ResultThe project worked and the team grew.
3frontend engineers when I left: me, another senior and a junior
5more people on the project: 1 backend, 1 PM, 1 tech lead, 2 designers
10 to 15teams using the Panel
// Simplified example for this page. Not company code.
func Authorize(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user := UserFrom(r.Context())
action := ActionFor(r) // "coupons:create"
brand := r.Header.Get("X-Brand")
allowed := Can(user, action, brand)
audit.Write(audit.Entry{
UserID: user.ID,
Action: action,
Brand: brand,
Allowed: allowed,
})
if !allowed {
http.Error(w, "forbidden", http.StatusForbidden)
return
}
next.ServeHTTP(w, r)
})
}
// Simplified example for this page. Not company code.
type Brand = 'centauro' | 'nike';
type Action = 'coupons:view' | 'coupons:create';
type User = {
id: string;
brands: Brand[] | 'all';
actions: Action[];
};
// There is no master role: access comes from the brands
// a user belongs to, and the actions granted inside them.
export const can = (user: User, action: Action, brand: Brand) =>
(user.brands === 'all' || user.brands.includes(brand)) &&
user.actions.includes(action);