CoreUI Free Bootstrap Admin Template is a professional admin dashboard template built on Bootstrap 5 and CoreUI components. It provides a ready-to-use foundation for building admin panels, dashboards, and web applications with a clean, modern interface.
Key Characteristics:
- Server-side templating approach (Pug → HTML)
- Bootstrap 5 + CoreUI component library
- Vanilla JavaScript (no framework dependencies)
- Multi-page application (MPA) architecture
- Static file generation with build-time compilation
┌─────────────────────────────────────────────────────┐
│ Source Files │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Pug │ │ Sass │ │ JS │ │
│ │Templates │ │ Styles │ │ Modules │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ │ │ │ │
└───────┼─────────────┼─────────────┼─────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────┐
│ Build Pipeline │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Pug │ │PostCSS + │ │ Babel │ │
│ │Compiler │ │ Sass │ │Transpiler│ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ │ │ │ │
└───────┼─────────────┼─────────────┼─────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────┐
│ Distribution Files │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ HTML │ │ CSS │ │ JS │ │
│ │ Files │ │ (minified)│ │(bundled) │ │
│ └──────────┘ └──────────┘ └──────────┘ │
│ (served via browser-sync or web server) │
└─────────────────────────────────────────────────────┘
- HTML Generation: Pug 3.0.3 (template engine)
- CSS Framework: Bootstrap 5.3.x
- Component Library: CoreUI 5.x (@coreui/coreui)
- Icons: CoreUI Icons (@coreui/icons)
- JavaScript: Vanilla ES6+ (no framework)
- Charts: Chart.js 4.x
- Scrollbars: SimpleBar 6.x
- Package Manager: npm
- CSS Processing: Sass 1.97.0 → PostCSS → Autoprefixer
- JS Transpilation: Babel 7.28.x with preset-env
- Task Runner: npm scripts with npm-run-all
- File Watching: Nodemon
- Live Server: Browser-sync 3.0.4
- Linting: ESLint 9.x (flat config) with XO + Unicorn
- Style Linting: Stylelint 16.x with Bootstrap config
- Formatting: Prettier 3.7.4
- Editor Config: .editorconfig for consistency
coreui-free-bootstrap-admin-template/
│
├── src/ # Source files (edit these)
│ ├── pug/ # Pug templates (HTML source)
│ │ ├── _layout/ # Base layout templates
│ │ │ └── default.pug # Main layout with sidebar/header
│ │ ├── _partials/ # Reusable components
│ │ │ ├── _header.pug # Top navigation bar
│ │ │ ├── _sidebar.pug # Left sidebar navigation
│ │ │ ├── _footer.pug # Page footer
│ │ │ └── _breadcrumb.pug # Breadcrumb navigation
│ │ ├── _mixins/ # Pug helper mixins
│ │ │ ├── breadcrumb.pug # Breadcrumb generator
│ │ │ ├── callout.pug # Alert/callout boxes
│ │ │ └── example.pug # Code example displays
│ │ └── views/ # Page templates
│ │ ├── dashboard.pug # Main dashboard page
│ │ ├── base/ # UI base components
│ │ ├── buttons/ # Button examples
│ │ ├── forms/ # Form components
│ │ ├── icons/ # Icon libraries
│ │ ├── notifications/ # Alerts, toasts, modals
│ │ ├── pages/ # Auth pages (login, register)
│ │ └── ...
│ │
│ ├── scss/ # Sass stylesheets
│ │ ├── style.scss # Main stylesheet entry
│ │ ├── style-rtl.scss # RTL (right-to-left) styles
│ │ └── examples.scss # Demo/example page styles
│ │
│ ├── js/ # JavaScript modules
│ │ ├── main.js # Main entry point
│ │ ├── charts.js # Chart.js configurations
│ │ ├── color-modes.js # Dark/light theme switcher
│ │ ├── tooltips.js # Tooltip initialization
│ │ ├── popovers.js # Popover initialization
│ │ └── ...
│ │
│ ├── assets/ # Static assets
│ │ ├── brand/ # Logo files
│ │ ├── favicon/ # Favicon files
│ │ └── img/ # Images
│ │
│ └── views/ # Compiled HTML (auto-generated)
│ └── *.html # Do NOT edit these manually
│
├── dist/ # Production build output
│ ├── css/ # Minified CSS
│ ├── js/ # Transpiled JS
│ ├── assets/ # Copied assets
│ ├── vendors/ # Third-party libraries
│ └── *.html # Production HTML files
│
├── build/ # Build scripts
│ ├── pug.mjs # Pug compilation script
│ ├── postcss.config.mjs # PostCSS configuration
│ ├── vendors.mjs # Vendor file bundling
│ └── change-version.mjs # Version management
│
├── node_modules/ # npm dependencies (ignored)
│
└── Configuration files
├── package.json # Dependencies and scripts
├── .editorconfig # Editor settings
├── eslint.config.mjs # ESLint flat config
├── .prettierrc.json # Prettier formatting
├── .stylelintrc # Stylelint rules
├── .browserslistrc # Target browsers
├── .babelrc.js # Babel transpiler config
└── .cursorrules # AI context (Cursor IDE)
- Clean: Remove old compiled files
- Compile Pug:
src/pug/**/*.pug→src/views/*.html - Compile Sass:
src/scss/*.scss→dist/css/*.css(expanded, autoprefixed) - Transpile JS:
src/js/*.js→dist/js/*.js(Babel with source maps) - Copy Assets:
src/assets/**/*→dist/assets/ - Build Vendors: Bundle third-party libraries
- Watch Files: Monitor changes and recompile
- Browser-sync: Live reload server on http://localhost:3000
- All development steps
- Minify CSS: Compress stylesheets with cssnano
- Minify JS: Already transpiled by Babel
- Optimize Assets: Copy optimized files
- Generate zip: Create distribution package
npm run watch # Watch all file types
npm run watch-pug # Watch Pug templates only
npm run watch-css # Watch Sass files only
npm run watch-js # Watch JavaScript files only
Each watch task uses nodemon to monitor file changes and trigger appropriate compilation.
1. Browser Request
└─> /index.html
2. Server Response
└─> Serve dist/index.html (static file)
3. HTML Loads Resources
├─> dist/css/style.css (Bootstrap + CoreUI + custom styles)
├─> dist/js/main.js (app initialization)
└─> dist/vendors/*.js (Chart.js, SimpleBar, etc.)
4. JavaScript Execution
├─> Initialize CoreUI components
├─> Set up event listeners
├─> Configure charts (if on dashboard)
└─> Enable tooltips/popovers
5. User Interaction
└─> JavaScript handles UI updates (no page reload)
1. User clicks theme toggle button
└─> color-modes.js listens for click
2. ColorModeStorageManager updates preference
├─> Save to localStorage
└─> Update [data-coreui-theme] attribute
3. CSS custom properties respond
└─> Variables change (--cui-primary-bg, --cui-text-color, etc.)
4. ColorSchemeChange event fires
└─> Charts re-render with new theme colors
1. charts.js module loads
└─> import Chart from 'chart.js/auto'
2. DOM ready
└─> Find chart canvas elements
3. Fetch data (or use inline data)
└─> Random data generator for demo
4. Create Chart.js instance
├─> Configure chart type (line, bar, pie, etc.)
├─> Apply theme colors from CSS variables
└─> Set responsive options
5. Theme changes
└─> Re-initialize charts with new colors
default.pug (base layout)
├─> _header.pug (navigation bar)
├─> _sidebar.pug (side navigation)
├─> block content
│ └─> dashboard.pug (page content)
├─> block scripts (page-specific JS)
└─> _footer.pug (page footer)
Block System:
block content: Main page content areablock scripts: Page-specific JavaScript includes- Each view extends the layout and overrides blocks
style.scss
├─> Import Bootstrap 5
├─> Import CoreUI components
├─> Import custom variables
└─> Import custom component styles
Theme System:
[data-coreui-theme="light"] # Light mode (default)
[data-coreui-theme="dark"] # Dark mode
[data-coreui-theme="auto"] # System preference
CSS Custom Properties:
--cui-primary,--cui-secondary, etc. (colors)--cui-bg,--cui-text-color(backgrounds/text)--cui-border-color,--cui-shadow(UI elements)
Each JS file in src/js/ is an ES6 module:
// Import dependencies
import { Something } from '@coreui/coreui'
// Define functionality
const doSomething = () => { /* ... */ }
// Initialize on DOM ready
document.addEventListener('DOMContentLoaded', () => {
doSomething()
})
// Export if needed (most files use side effects only)| Package | Purpose | Used In |
|---|---|---|
@coreui/coreui |
UI component library | All pages |
@coreui/icons |
Icon library | Icon pages |
chart.js |
Charts and graphs | Dashboard |
simplebar |
Custom scrollbars | Sidebar |
@coreui/utils |
Utility functions | Theme switching |
| Package | Purpose |
|---|---|
sass |
CSS preprocessing |
@babel/core |
JavaScript transpilation |
pug |
HTML templating |
postcss |
CSS post-processing |
autoprefixer |
Vendor prefix automation |
browser-sync |
Development server |
eslint |
JavaScript linting |
stylelint |
CSS linting |
Defined in .browserslistrc:
>= 0.5%
last 2 major versions
not dead
Chrome >= 60
Firefox >= 60
Edge >= 79
Safari >= 12
iOS >= 12
Modern browsers with ES6+ support (Babel handles transpilation for older browsers if needed).
- Run
npm run build - Deploy
dist/folder to:- Netlify
- Vercel
- GitHub Pages
- AWS S3 + CloudFront
- Any static file server
- Run
npm run build - Copy
dist/contents to web root - Configure server to serve
index.htmlas default - Set proper MIME types for CSS/JS files
FROM nginx:alpine
COPY dist/ /usr/share/nginx/html/
EXPOSE 80- Sass compilation removes unused styles
- PostCSS autoprefixer adds only necessary prefixes
- Minification in production build
- CSS is render-blocking (loaded in
<head>)
- Babel transpiles only necessary polyfills (preset-env)
- Source maps for debugging (development only)
- Modules loaded as separate files (no bundler)
- Deferred script loading where possible
- SVG icons (scalable, small file size)
- Favicon in multiple formats for compatibility
- Images in
src/assets/should be optimized before adding
Template includes inline scripts and styles. For strict CSP:
- Extract inline scripts to external files
- Use nonces or hashes for required inline scripts
- Update CSP headers accordingly
- Pug automatically escapes HTML by default
- Use
!= htmlonly for trusted content - Sanitize user input on server-side (if adding backend)
- Regularly update npm dependencies
- Run
npm auditto check for vulnerabilities - Pin major versions in
package.json
- Create
src/pug/views/my-page.pug - Extend layout:
extends ../_layout/default.pug - Override content block:
block content .container-lg.px-4 h1 My Page Title p Page content here
- Run
npm startto compile - Access at
/my-page.html
- Check CoreUI docs: https://coreui.io/bootstrap/docs/
- Copy component markup to Pug file
- Convert HTML to Pug syntax (use html2pug.com if needed)
- Import required JavaScript:
import { Modal } from '@coreui/coreui'
- Initialize component in page-specific JS
- Edit
src/scss/style.scssor create new partial - Use Sass modules syntax to import CoreUI:
For CoreUI Pro projects:
@use "@coreui/coreui/scss/coreui" as * with ( $enable-deprecation-messages: false );
@use "@coreui/coreui-pro/scss/coreui" as * with ( $enable-deprecation-messages: false );
- Use CSS custom properties for theme compatibility
- Run
npm run cssto compile
This template is frontend-only. To add backend:
-
Fetch API for AJAX requests:
fetch('/api/endpoint') .then(response => response.json()) .then(data => updateUI(data))
-
Authentication: Implement token-based auth
- Store JWT in localStorage/sessionStorage
- Add Authorization header to requests
- Redirect to login on 401 responses
-
State Management: For complex apps, consider:
- Vanilla JS with custom events
- Lightweight state library (Zustand, Nano Stores)
- Full framework migration (React, Vue, etc.)
- Error: "Cannot find module"
- Fix: Check Pug include/extend paths (relative to file)
- Error: "Undefined variable"
- Fix: Import Bootstrap/CoreUI variables before using
- Error: "X is not defined"
- Fix: Add
/* global X */comment or import module
- Fix: Add
- Error: Browser-sync not updating
- Fix: Check if
watchscripts are running, restartnpm start
- Fix: Check if
- Error: npm scripts fail
- Fix: Delete
node_modules/anddist/, runnpm install, thennpm run build
- Fix: Delete
- CoreUI Bootstrap Docs: https://coreui.io/bootstrap/docs/
- Pug Documentation: https://pugjs.org/
- Chart.js Documentation: https://www.chartjs.org/
- Sass Documentation: https://sass-lang.com/documentation/
See releases for version history and updates.