Skip to content

ylstack1/cf-cms-dashboard

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CF CMS Admin Dashboard

A modern, fully-featured CMS admin dashboard built with Next.js 16, React 19, and TypeScript. This dashboard provides a comprehensive interface for managing content, media, users, collections, plugins, and system settings.

Features

  • πŸ” Authentication - Secure login with Bearer token authentication
  • πŸ“ Content Management - Create, edit, delete, and publish content
  • πŸ“ Collections - Organize content into collections
  • πŸ–ΌοΈ Media Library - Upload and manage media files
  • πŸ‘₯ User Management - Manage team members and permissions
  • πŸ”Œ Plugin System - Extend functionality with plugins
  • βš™οΈ Settings - Configure CMS behavior and appearance
  • 🎨 Dark Theme - Beautiful dark UI with Tailwind CSS
  • πŸ“± Responsive Design - Mobile-first responsive layout

Tech Stack

  • Framework: Next.js 16 (App Router)
  • React: React 19
  • TypeScript: Full type safety
  • State Management: Zustand with persist middleware
  • Data Fetching: SWR for server state management
  • HTTP Client: Axios with interceptors
  • UI Components: Radix UI primitives
  • Styling: Tailwind CSS 4
  • Icons: Lucide React
  • Fonts: Geist Sans & Geist Mono

Getting Started

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm

Installation

  1. Clone the repository
  2. Install dependencies:
pnpm install
  1. Create a .env.local file:
cp .env.example .env.local
  1. Update the API base URL in .env.local:
NEXT_PUBLIC_API_BASE_URL=http://localhost:3001

Development

pnpm dev

Open http://localhost:3000 to access the dashboard.

Build

pnpm build
pnpm start

Project Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ admin/
β”‚   β”‚   β”œβ”€β”€ layout.tsx          # Admin layout with auth guard
β”‚   β”‚   β”œβ”€β”€ dashboard/          # Dashboard page
β”‚   β”‚   β”œβ”€β”€ content/            # Content management
β”‚   β”‚   β”œβ”€β”€ collections/        # Collections management
β”‚   β”‚   β”œβ”€β”€ media/              # Media library
β”‚   β”‚   β”œβ”€β”€ users/              # User management
β”‚   β”‚   β”œβ”€β”€ plugins/            # Plugin management
β”‚   β”‚   └── settings/           # System settings
β”‚   β”œβ”€β”€ login/                  # Login page
β”‚   └── layout.tsx              # Root layout
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ admin/                  # Admin-specific components
β”‚   β”‚   └── admin-sidebar.tsx  # Dynamic sidebar with plugins
β”‚   β”œβ”€β”€ ui/                     # Reusable UI components
β”‚   └── providers.tsx           # SWR and Theme providers
β”œβ”€β”€ hooks/                      # Custom hooks for data fetching
β”‚   β”œβ”€β”€ useDashboard.ts
β”‚   β”œβ”€β”€ useContent.ts
β”‚   β”œβ”€β”€ useCollections.ts
β”‚   β”œβ”€β”€ useMedia.ts
β”‚   β”œβ”€β”€ useUsers.ts
β”‚   β”œβ”€β”€ usePlugins.ts
β”‚   └── useSettings.ts
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ api.ts                  # API client with auth
β”‚   β”œβ”€β”€ constants.ts            # App constants
β”‚   └── utils.ts                # Utility functions
β”œβ”€β”€ store/
β”‚   └── authStore.ts            # Zustand auth store
β”œβ”€β”€ types/
β”‚   └── index.ts                # TypeScript type definitions
└── middleware.ts               # Auth middleware

API Endpoints

The dashboard integrates with the following backend API endpoints:

Authentication

  • POST /admin/auth/login - User login
  • POST /admin/auth/logout - User logout
  • GET /admin/auth/me - Get current user

Dashboard

  • GET /admin/dashboard/stats - Dashboard statistics
  • GET /admin/dashboard/recent-activity - Recent activity feed

Content

  • GET /admin/content - List content (with pagination & filters)
  • POST /admin/content - Create content
  • GET /admin/content/:id - Get content by ID
  • PUT /admin/content/:id - Update content
  • DELETE /admin/content/:id - Delete content

Collections

  • GET /admin/collections - List collections
  • GET /admin/collections/:id - Get collection by ID
  • POST /admin/collections - Create collection
  • PUT /admin/collections/:id - Update collection

Media

  • GET /admin/media - List media files
  • POST /admin/media - Upload media file(s)
  • DELETE /admin/media/:id - Delete media file

Users

  • GET /admin/users - List users
  • POST /admin/users - Create user
  • PUT /admin/users/:id - Update user
  • DELETE /admin/users/:id - Delete user

Plugins

  • GET /admin/plugins - List plugins
  • GET /admin/plugins/:id - Get plugin by ID
  • PATCH /admin/plugins/:id - Toggle plugin enabled state
  • GET /admin/plugins/:id/settings - Get plugin settings
  • PUT /admin/plugins/:id/settings - Update plugin settings

Settings

  • GET /admin/settings - Get system settings
  • PUT /admin/settings - Update system settings

Authentication

The dashboard uses Bearer token authentication with the following flow:

  1. User logs in via /login page
  2. Token is stored in Zustand store (localStorage) and cookie
  3. All API requests include Authorization: Bearer {token} header
  4. On 401 response, user is logged out and redirected to login
  5. Middleware protects /admin/* routes

Features

Dynamic Sidebar

The sidebar automatically loads and displays menu items from enabled plugins, allowing for extensible navigation.

Error Handling

  • API errors are caught and displayed to users
  • Loading states for all async operations
  • Proper error boundaries

Theme Support

Dark theme is enabled by default with support for system theme preferences.

Customization

API Base URL

Configure the backend API URL in .env.local:

NEXT_PUBLIC_API_BASE_URL=https://api.example.com

Theme

Modify Tailwind CSS configuration in app/globals.css to customize colors and styles.

License

MIT

Support

For issues and questions, please open an issue on the repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 92.9%
  • CSS 6.8%
  • JavaScript 0.3%