App Structure and Routing
Source Layout
Section titled “Source Layout”Directorysrc/
- App.tsx Root component — provider composition and routes
- main.tsx Entry point
Directorycomponents/
Directorylayout/ DashboardLayout, Header, Sidebar
- …
Directoryui/ shadcn/ui primitives (button, card, dialog, etc.)
- …
Directorycontexts/
- AuthContext.tsx JWT storage and role helpers
- ThemeContext.tsx Dark/light mode
Directorypages/ Full page components for each route
- …
Directoryrouter/
- route.ts PrivateRoute component
Directoryhooks/ Custom React hooks
- …
Directorylib/
- s3-upload.ts Signed URL upload helper
- s3-config.ts S3 client config
Provider Stack
Section titled “Provider Stack”Providers wrap the app in this order (outermost first):
QueryClientProvider ThemeProvider AuthProvider TooltipProvider BrowserRouter KeyboardShortcutsProvider Suspense RoutesRoute Map
Section titled “Route Map”| Route | Access | Purpose |
|---|---|---|
/login | Public | Login page |
/dashboard | Admin | Main dashboard overview |
/articles | Admin | Article list |
/articles/add | Admin | Create new article |
/articles/edit/:id | Admin | Edit existing article |
/articles/preview/:id | Admin | Preview article before publishing |
/sites | Admin | Manage hosted child sites |
/sites/add | Admin | Add new site |
/sites/edit/:id | Admin | Edit site |
/users | Admin | User management |
/tags | Admin | Tag management |
/geo | Admin | Geographic data |
/settings | Admin | Platform settings |
/publishers | Admin | Publisher list and moderation |
/publishers/create | Admin | Create publisher account |
/publishers/:id | Admin | Publisher detail and actions |
/publishers/reports | Admin | Monthly article reports |
/publisher/dashboard | Publisher | Publisher’s personal dashboard |
/publisher/feed | Publisher | RSS feed configuration |
All routes except /login are wrapped in PrivateRoute. Visiting any protected route without a valid token redirects to /login.