Zum Hauptinhalt springen

Frontend-Quellcode

Das Casdoor-Frontend, das die Admin-Konsole und die Anmeldeseiten enthält, befindet sich im web-Verzeichnis des Casdoor-Repositories. Es handelt sich um eine React-Anwendung, die in TypeScript geschrieben, mit Vite erstellt und mit Tailwind CSS und shadcn/ui gestaltet ist. Diese Seite beschreibt die Struktur des Quellcodes.

Frontend ausführen und erstellen​

Führen Sie die folgenden Befehle im web-Verzeichnis aus.

CommandBeschreibung
yarn installInstalls the dependencies. Use Yarn 1.x
yarn startStarts the development server on port 7001. It expects the backend on port 8000
yarn buildBuilds the static files into web/build, which the backend serves

Für die vollständige Einrichtung siehe Im Entwicklungsmodus ausführen.

Dateien im web-Verzeichnis​

File or directoryBeschreibung
publicStatic files that are copied to the build as they are
srcSource code of the application
index.htmlHTML entry point
vite.config.tsVite configuration
tailwind.config.js, postcss.config.jsTailwind CSS configuration
components.jsonshadcn/ui configuration
tsconfig.jsonTypeScript configuration
cypress, cypress.config.jsEnd-to-end tests
package.json, yarn.lockDependencies

Dateien im src-Verzeichnis​

File or directoryDescription
main.tsxEntry point that mounts the application
App.tsxRoutes of the admin console and the sign-in pages
Conf.tsCompile-time settings, such as the default theme and the custom footer. See Compile-time frontend settings
pagesOne file per page. *ListPage.tsx is the list of an object type, and *EditPage.tsx is its edit page. pages/auth contains the sign-in, sign-up, and related pages
componentsShared components, grouped by area, for example application, provider, and user. components/ui contains the shadcn/ui components
backendOne file per object type with the calls to the Casdoor API, for example ApplicationBackend.ts
authHelpers of the sign-in flow, such as provider URLs, the password obfuscator, and WebAuthn
hooksReact hooks, for example for the signed-in account, the language, and the theme
libHelper functions. lib/setting.tsx contains the general helpers
localesTranslations, one data.json per language
i18n.tsSetup of the translation library
index.cssGlobal styles

Siehe auch​