This guide provides a step-by-step walkthrough for developers who want to extend the Admin Dashboard with a new management section (e.g., "Analytics" or "Coupons").
Create a new file in backend/routers/ or add to admin.py. If the section is complex, a new file is better: backend/routers/coupons.py.
from fastapi import APIRouter, Depends
from backend.auth_utils import get_current_active_admin
from backend.db import get_db
router = APIRouter(prefix="/admin/coupons", tags=["Coupons"])
@router.get("/")
async def get_all_coupons(admin=Depends(get_current_active_admin), db=Depends(get_db)):
# Logic to fetch data from DB
return {"coupons": []}
In backend/main.py, include your new router:
from backend.routers import coupons
app.include_router(coupons.router)
The Admin Dashboard uses a dedicated localization system.
Edit src/locales/master_admin/tabs.json and add your new tab ID:
{
"orders": "Orders",
"new_section": "My New Section"
}
Create a new file src/locales/master_admin/new_section.json for all texts within that section.
Run the following command to update the frontend JSONs:
backend\.venv\Scripts\python.exe scripts\manage_locales.py split
Create src/components/admin/NewSection.vue. Use existing sections as templates (e.g., ServicesSection.vue).
<template>
<div class="space-y-6">
<h2 class="text-2xl font-bold">New Management Section</h2>
<!-- Your UI here -->
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { adminGetNewData } from '@/lib/api';
const data = ref([]);
onMounted(async () => {
data.value = await adminGetNewData();
});
</script>
Add the corresponding function in src/lib/api.ts to call your new backend endpoint.
Finally, register your new section in src/pages/Admin.vue.
import NewSection from "@/components/admin/NewSection.vue";
Add your tab ID to the tabs array and the Tab type definition:
const tabs: { id: Tab }[] = [
...
{ id: "new_section" },
];
type Tab = "orders" | ... | "new_section";
Add the component inside the <!-- Modular Sections --> block:
<NewSection v-if="activeTab === 'new_section'" />
main.py.manage_locales.py split executed.src/lib/api.ts.src/components/admin/.