Designing a dual-access e-commerce platform: User and admin interfaces

Hey everyone! I’m working on a React-based online store and I’m stuck on how to set up the admin side. I’m using Firebase Realtime DB and I’m not sure what’s the best way to handle user roles.

I’ve got two ideas:

  1. Use password login to tell admins and regular users apart. But I’m not sure if Firebase can easily figure out who’s who.

  2. Run the admin dashboard locally and use APIs to change stuff in Firebase.

I’m new to this kind of setup. Has anyone done something similar? What worked for you? Are there better ways to do this that I haven’t thought of?

Really appreciate any advice you can give me on this! Thanks in advance!

I’ve implemented a similar system for a client’s e-commerce platform. We opted for a hybrid approach that’s worked well. We used Firebase Authentication with custom claims to differentiate between regular users and admins. This way, you can set a custom claim like ‘admin: true’ for admin accounts.

On the frontend, we created separate React components for the admin dashboard, only rendering them if the user has the admin claim. This keeps the codebase unified while maintaining distinct user experiences.

For extra security, we also implemented server-side checks on our Cloud Functions to verify admin status before allowing sensitive operations. This dual-layer approach has proven robust and scalable as the platform grew.

Remember to thoroughly test your authentication flow and always follow security best practices when dealing with admin access.

hey daisy! i’ve worked on smth similar. we used firebase auth with custom claims for admin roles. it’s pretty straightforward to set up and secure.

for the admin interface, we just made a separate route in our react app. admins could access it after loggin in. worked great for us!

hope this helps. lemme know if u need more info!

Hey there! So, I’m really intrigued by your e-commerce project. Have you considered using Firebase Authentication’s custom claims? It’s a neat feature that might solve your admin/user dilemma without too much hassle.

I’m curious, though - what made you think about running the admin dashboard locally? That’s an interesting approach I haven’t heard much about. Do you see any particular advantages to that method?

Also, I wonder if you’ve looked into using Firebase Cloud Functions for some of the admin-only operations? It could add an extra layer of security if you’re worried about keeping admin stuff separate.

Oh, and have you thought about how you’ll handle things if your store grows really big? Like, would your current ideas still work well if you suddenly had thousands of users and multiple admins?

This sounds like such a cool project. I’d love to hear more about how it’s going and what other challenges you’re facing. Keep us posted, yeah?