Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Priyanshu471/ad-management/llms.txt

Use this file to discover all available pages before exploring further.

The Admin portal is the control center of the Ad Management System, built exclusively for platform administrators. Accessible at /admin, it wraps all child routes in a shared layout that renders a persistent sidebar, a top Header bar, and the page content area. Any visitor who is not logged in is intercepted before the layout renders and is shown an access prompt that redirects them to the login page.

Admin Capabilities

User Management

View all registered Advertisers and Creators in two role-split tables. Inspect names, email addresses, and membership history at a glance.

Campaign Oversight

The Manage panel is planned to surface every campaign across all advertiser accounts, with API support for status updates and deletion already in place.

System Settings

The Settings panel is planned to expose platform-wide configuration controls. Currently, all configuration is managed through environment variables.

Finances

The Finances panel is planned to aggregate campaign budget data across all advertisers. The underlying campaign API that powers this view is already functional.
The admin layout renders a persistent sidebar using the shared Sidebar component populated with the adminMenu array from lib/menu.ts. Each entry maps a label and icon to a protected route:
Menu ItemRouteIcon
Dashboard/adminLayoutGrid
Users/admin/usersUserRoundCog
Manage/admin/manageFolderKanban
System Settings/admin/settingsSettings
Finances/admin/financesLandmark
Clicking a sidebar link calls router.push(menu.link) and marks the item as active via the useActive hook, which applies the bg-graydark dark:bg-meta-4 highlight class to the selected entry.

Access Control

The admin layout (app/admin/layout.tsx) checks the Zustand useUser store on every render. If isLoggedIn is false, it returns the AuthGuard component immediately — no sidebar or content area is rendered. The AuthGuard component (app/admin/_components/authGaurd.tsx) displays a centered message showing the path the user tried to access, a prompt to log in, and a link to the login page. Simultaneously, a useEffect inside AuthGuard calls router.push(LOGIN_ROUTE) — which resolves to / — as soon as the component mounts, so unauthenticated visitors are automatically redirected to the login page.
// AuthGuard renders while the redirect is in flight
export default function AuthGuard() {
  const pathname = usePathname();
  const router = useRouter();
  const { isLoggedIn } = useUser();

  useEffect(() => {
    if (!isLoggedIn) {
      router.push(LOGIN_ROUTE); // LOGIN_ROUTE = "/"
    }
  }, [isLoggedIn]);

  return (
    <div className="flex flex-col h-screen justify-center items-center bg-whiter">
      <pre>You are trying to access: {pathname.slice(1)}</pre>
      <p className="block">
        This is a protected route please{" "}
        <Link href={`${LOGIN_ROUTE}`} className="underline text-violet-700">
          Log In
        </Link>{" "}
        to continue.
      </p>
    </div>
  );
}
The auth guard checks only whether the user is logged in — it does not verify that the logged-in account holds an admin role. Any authenticated user who navigates directly to /admin will reach the portal. In a production deployment, add a role check in the layout (e.g. if (role !== "admin") return <AuthGuard />) and restrict admin account creation to a secure seeding or invite flow.

Dashboard Page

The Dashboard page at /admin currently renders a minimal placeholder:
const Admin: React.FC = () => {
  return <div className="flex h-screen">Admin Dashboard</div>;
};
The dashboard UI is planned for a future iteration. The sidebar navigation and layout shell are fully functional.

Build docs developers (and LLMs) love