01
Separating authentication from authorization
Authentication is handled through Supabase Auth, while administrative access is determined separately through the user's role stored in the database. This keeps user identity and application permissions as distinct concerns.
02
Using Server Actions for menu mutations
Menu creation, updates, and deletion are implemented with Next.js Server Actions instead of separate API endpoints for each CRUD operation. This keeps internal menu mutations close to the server-side application logic without introducing unnecessary API endpoints.
03
Enforcing authorization at the server boundary
Administrative permissions are verified on the server before menu mutations are executed. The application does not rely solely on hiding dashboard functionality in the client, keeping authorization independent from the UI.
04
Keeping authentication isolated behind an API route
Authentication uses a dedicated API route because it has its own request and session lifecycle, while internal menu management remains implemented through Server Actions. This keeps the communication pattern appropriate to each responsibility.
05
Separating public and administrative data flows
The public interface focuses on consuming and presenting menu data, while authenticated administrative workflows handle menu mutations. Separating these responsibilities keeps the public experience independent from management operations.