Seeking advice on backend architecture for web app

Hey everyone! I’m working on a web app using PHP and MySQL. I’m at a crossroads with my backend design and could use some input.

I’m wondering about:

  1. User management: Should admins have their own table?
  2. Data handling: Extend existing classes or create separate ones for admin tasks?
  3. User roles: Any good resources on implementing different user types?
  4. General backend wisdom: What are some must-follow practices?

I’m a bit overwhelmed by all the options. Any tips or experiences you can share would be awesome! I want to make sure I’m setting things up right from the start.

Thanks in advance for your help!

From my experience, it’s crucial to design your backend with scalability and maintainability in mind. For user management, I’d recommend a single users table with a ‘role’ column rather than separate tables for admins. This approach offers more flexibility as your user types evolve.

Regarding data handling, I’ve found it beneficial to create separate service classes for admin tasks. This keeps your code modular and easier to maintain. For user roles, the RBAC (Role-Based Access Control) pattern has served me well in previous projects.

As for general backend wisdom, always sanitize user inputs, implement proper error handling, and use prepared statements to prevent SQL injection. Also, consider implementing caching mechanisms early on to improve performance as your app grows. Remember, a well-structured backend will save you countless hours down the line.

Yo, heres my 2 cents. Keep users in 1 table, add role column. Makes life easier. For admin stuff, seperate classes r neat, keeps things tidy. check out RBAC for roles, its pretty solid. And always sanitize inputs! learned that the hard way lol. good luck with ur project!

hey there! have u thought about using an ORM like Doctrine? it can make ur life WAY easier with user management and roles. also, whats ur thoughts on using a framework like Laravel? it has some cool built-in features for backend stuff. curious to hear more about ur project goals!