Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

File renamed without changes.
7 changes: 7 additions & 0 deletions .eslintrc.json.temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["next/core-web-vitals"],
"rules": {
"react/no-unescaped-entities": "off",
"@next/next/no-img-element": "off"
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
# Production
/build
/i18n
/.next
/out

# Generated files
.docusaurus
.cache-loader
.source

# Misc
.DS_Store
Expand Down
20 changes: 20 additions & 0 deletions app/docs/get-started/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { DocsPage, DocsBody } from "fumadocs-ui/page";

export default function Page() {
return (
<DocsPage>
<DocsBody>
<h1>Get Started</h1>
<h2>Installation</h2>
<p>
Install Casbin in your preferred language to get started with authorization in your application.
</p>
</DocsBody>
</DocsPage>
);
}

export const metadata = {
title: "Get Started",
description: "Getting started with Casbin",
};
31 changes: 31 additions & 0 deletions app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { DocsLayout } from 'fumadocs-ui/layout';
import type { ReactNode } from 'react';

export default function Layout({ children }: { children: ReactNode }) {
const tree = {
name: 'Documentation',
children: [
{
type: 'page' as const,
name: 'Overview',
url: '/docs/overview',
},
{
type: 'page' as const,
name: 'Get Started',
url: '/docs/get-started',
},
],
};

return (
<DocsLayout
tree={tree}
nav={{
title: 'Casbin',
}}
>
{children}
</DocsLayout>
);
}
24 changes: 24 additions & 0 deletions app/docs/overview/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { DocsPage, DocsBody } from "fumadocs-ui/page";

export default function Page() {
return (
<DocsPage>
<DocsBody>
<h1>Overview</h1>
<p>
Casbin is a powerful and efficient open-source access control library that supports various
access control models for enforcing authorization across the board.
</p>
<h2>Languages Supported by Casbin</h2>
<p>
Casbin provides support for various programming languages, ready to be integrated within any project and workflow.
</p>
</DocsBody>
</DocsPage>
);
}

export const metadata = {
title: "Overview",
description: "Casbin Overview",
};
3 changes: 3 additions & 0 deletions app/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
17 changes: 17 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import './global.css';
import { RootProvider } from 'fumadocs-ui/provider';
import type { ReactNode } from 'react';

export default function RootLayout({
children,
}: {
children: ReactNode;
}) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<RootProvider>{children}</RootProvider>
</body>
</html>
);
}
10 changes: 10 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default function HomePage() {
return (
<main className="flex flex-col items-center justify-center min-h-screen p-8">
<h1 className="text-4xl font-bold mb-4">Casbin</h1>
<p className="text-xl text-center max-w-2xl">
An authorization library that supports access control models like ACL, RBAC, ABAC, ReBAC, PBAC, OrBAC, BLP, Biba, LBAC, UCON
</p>
</main>
);
}
File renamed without changes.
8 changes: 8 additions & 0 deletions content/docs/get-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Get Started
description: Getting started with Casbin
---

## Installation

Install Casbin in your preferred language to get started with authorization in your application.
3 changes: 3 additions & 0 deletions content/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Casbin Documentation
---
14 changes: 14 additions & 0 deletions content/docs/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Overview
description: Casbin Overview
---

Casbin is a powerful and efficient open-source access control library that supports various
[access control models](https://en.wikipedia.org/wiki/Access_control#Access_control_models)
for enforcing authorization across the board.

Enforcing a set of rules is as simple as listing subjects, objects, and the desired allowed action (or any other format as per your needs) in a **_policy_** file. This is synonymous across all flows in which Casbin is used. The developer/administrator has complete control over the layout, execution, and conditions for authorization, which are set via the **_model_** file. Casbin provides an **_Enforcer_** for validating an incoming request based on the policy and model files given to the Enforcer.

## Languages Supported by Casbin

Casbin provides support for various programming languages, ready to be integrated within any project and workflow.
File renamed without changes.
60 changes: 60 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import js from "@eslint/js";
import react from "eslint-plugin-react";
import tseslint from "typescript-eslint";
import next from "@next/eslint-plugin-next";

export default [
{
ignores: [
"node_modules",
".next",
"out",
"build",
".docusaurus",
"src.docusaurus.backup/**",
"*.backup.js",
"static/**",
"webpack.config.js",
],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
plugins: {
react,
"@next/next": next,
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
"react/no-unescaped-entities": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
},
},
{
files: ["*.config.{js,mjs}"],
languageOptions: {
globals: {
module: "readonly",
require: "readonly",
__dirname: "readonly",
},
},
rules: {
"@typescript-eslint/no-require-imports": "off",
},
},
];
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
30 changes: 30 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import nextMDX from '@next/mdx';
import remarkGfm from 'remark-gfm';
import rehypePrettyCode from 'rehype-pretty-code';

const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [remarkGfm],
rehypePlugins: [
[
rehypePrettyCode,
{
theme: 'github-dark',
},
],
],
},
});

/** @type {import('next').NextConfig} */
const config = {
pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx'],
reactStrictMode: true,
output: 'export',
images: {
unoptimized: true,
},
};

export default withMDX(config);
47 changes: 27 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,50 @@
"license": "Apache 2.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"lint:js": "eslint --fix . --ext .js",
"lint:css": "stylelint \"src/**/*.{css,scss}\" --fix",
"lint:md": "markdownlint 'docs/**/*.{md,mdx}' --fix",
"lint": "yarn lint:js && yarn lint:css && yarn lint:md",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"crowdin:sync": "docusaurus write-translations && crowdin upload && crowdin download",
"dev": "next dev",
"start": "next dev",
"build": "next build",
"serve": "next start",
"lint:js": "eslint .",
"lint:md": "markdownlint 'content/**/*.{md,mdx}' --fix",
"lint": "yarn lint:js && yarn lint:md",
"prepare": "husky install"
},
"dependencies": {
"@crowdin/cli": "^3.7.10",
"@docusaurus/core": "^3.9.2",
"@docusaurus/preset-classic": "^3.9.2",
"@giscus/react": "^2.2.4",
"@mdx-js/loader": "^3.1.1",
"@mdx-js/react": "^3.0.0",
"@next/mdx": "^16.1.1",
"@popperjs/core": "^2.11.8",
"@types/node": "^25.0.3",
"@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3",
"autoprefixer": "^10.4.23",
"clsx": "^1.1.1",
"eslint-config-next": "^16.1.1",
"fs-extra": "^11.3.3",
"fumadocs-core": "10.1.2",
"fumadocs-ui": "10.1.2",
"gray-matter": "^4.0.3",
"lucide-react": "^0.562.0",
"markdown-to-jsx": "^7.4.0",
"next": "14.2.0",
"postcss": "^8.5.6",
"prism-react-renderer": "^2.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-popper": "^2.3.0"
"react-popper": "^2.3.0",
"rehype-pretty-code": "^0.14.1",
"remark-gfm": "^4.0.1",
"shiki": "^3.20.0",
"typescript": "^5.9.3"
},
"devDependencies": {
"@babel/core": "^7.18.13",
"@babel/eslint-parser": "^7.18.9",
"@babel/preset-react": "^7.18.6",
"eslint": "8.22.0",
"eslint": "9.0.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.0",
Expand All @@ -51,8 +59,7 @@
"stylelint-config-standard-scss": "^5.0.0"
},
"lint-staged": {
"*.js": "eslint --fix",
"*.{css, scss}": "stylelint --fix"
"*.{js,jsx,ts,tsx}": "eslint --fix"
},
"browserslist": {
"production": [
Expand Down
6 changes: 6 additions & 0 deletions postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { createPreset } = require('fumadocs-ui/tailwind-plugin');

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./src/**/*.{ts,tsx,mdx}',
'./app/**/*.{ts,tsx,mdx}',
'./content/**/*.{ts,tsx,mdx}',
'./node_modules/fumadocs-ui/dist/**/*.js',
],
presets: [createPreset()],
};
28 changes: 28 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"jsx": "preserve",
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"allowJs": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules", "src.docusaurus.backup"]
}
Loading
Loading