Overview
This module defines the main routing configuration for the Flowise UI application, mapping URL paths to lazily-loaded page components wrapped with permission-based access control.
Description
The MainRoutes object is a React Router route configuration with MainLayout as the parent element. It uses Loadable with React lazy imports for code-splitting all page components. Each child route is wrapped in a RequireAuth component that enforces both permission checks (e.g., chatflows:view, agentflows:view) and feature flag display conditions (e.g., feat:datasets, feat:evaluations). The configuration covers core features (Chatflows, Agentflows, Assistants, Tools, Credentials, Variables, Document Stores, API Keys, Marketplaces), evaluation features (Datasets, Evaluations, Evaluators), operational features (Executions, Logs, Files), account management, and enterprise features (Users, Roles, Login Activity, Workspaces, SSO Configuration).
Usage
This route configuration is imported by the application's router setup and used as one of the top-level route definitions. It defines all authenticated routes within the main application layout.
Code Reference
Source Location
Signature
const MainRoutes = {
path: '/',
element: <MainLayout />,
children: [
{ path: '/', element: <DefaultRedirect /> },
{ path: '/chatflows', element: <RequireAuth permission={'chatflows:view'}><Chatflows /></RequireAuth> },
{ path: '/agentflows', element: <RequireAuth permission={'agentflows:view'}><Agentflows /></RequireAuth> },
// ... 30+ additional routes
]
}
export default MainRoutes
Import
import MainRoutes from '@/routes/MainRoutes'
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| (none) |
N/A |
N/A |
This is a static route configuration object; no runtime inputs
|
Outputs
| Name |
Type |
Description
|
| MainRoutes |
object |
React Router route configuration object with path, element, and children array
|
Route Definitions
| Path |
Component |
Permission |
Feature Flag
|
| / |
DefaultRedirect |
-- |
--
|
| /chatflows |
Chatflows |
chatflows:view |
--
|
| /agentflows |
Agentflows |
agentflows:view |
--
|
| /executions |
Executions |
executions:view |
--
|
| /marketplaces |
Marketplaces |
templates:marketplace,templates:custom |
--
|
| /apikey |
APIKey |
apikeys:view |
--
|
| /tools |
Tools |
tools:view |
--
|
| /assistants |
Assistants |
assistants:view |
--
|
| /assistants/custom |
CustomAssistantLayout |
assistants:view |
--
|
| /assistants/custom/:id |
CustomAssistantConfigurePreview |
assistants:view |
--
|
| /assistants/openai |
OpenAIAssistantLayout |
assistants:view |
--
|
| /credentials |
Credentials |
credentials:view |
--
|
| /variables |
Variables |
variables:view |
--
|
| /document-stores |
Documents |
documentStores:view |
--
|
| /datasets |
EvalDatasets |
datasets:view |
feat:datasets
|
| /evaluations |
EvalEvaluation |
evaluations:view |
feat:evaluations
|
| /evaluators |
Evaluators |
evaluators:view |
feat:evaluators
|
| /logs |
Logs |
logs:view |
feat:logs
|
| /files |
Files |
-- |
feat:files
|
| /account |
Account |
-- |
--
|
| /users |
UsersPage |
users:manage |
feat:users
|
| /roles |
RolesPage |
roles:manage |
feat:roles
|
| /login-activity |
LoginActivityPage |
loginActivity:view |
feat:login-activity
|
| /workspaces |
Workspaces |
workspace:view |
feat:workspaces
|
| /workspace-users/:id |
WorkspaceDetails |
workspace:view |
feat:workspaces
|
| /sso-config |
SSOConfig |
sso:manage |
feat:sso-config
|
| /sso-success |
SSOSuccess |
-- |
--
|
Usage Examples
Basic Usage
import { createBrowserRouter } from 'react-router-dom'
import MainRoutes from '@/routes/MainRoutes'
import AuthRoutes from '@/routes/AuthRoutes'
const router = createBrowserRouter([
MainRoutes,
AuthRoutes
])
Related Pages