Welcome to the Modular Cyber Security Website & CMS Manual
This manual provides detailed guidance for developers on using and extending the modular cyber security website and content management system (CMS). It covers folder structure, frontend and admin usage, adding new pages and features, security best practices, and development tips to help you build and maintain a secure, scalable, and maintainable platform.
Adding New Frontend Pages
To add a new frontend page, follow these steps:
-
Create the HTML file: Add a new file under
src/frontend/pages/ with semantic structure and Tailwind classes.
-
Include necessary components: Reuse components from
src/frontend/components/ for consistency.
-
Add styles: Use Tailwind utility classes or extend styles in
src/frontend/styles/ if needed.
-
Link scripts: Add any required JavaScript for interactivity, ensuring accessibility and responsiveness.
-
Update navigation: Add links to the new page in the site’s navigation menus.
-
Test: Verify the page on multiple devices and browsers for layout, accessibility, and performance.
Example snippet for a new page header:
<header class="bg-primary-600 text-white p-6 rounded-b-lg shadow">
<h1 class="text-4xl font-bold">New Page Title</h1>
<nav aria-label="Breadcrumb">
<ol class="flex space-x-2 text-sm">
<li><a href="/" class="hover:underline">Home</a></li>
<li><span>/</span></li>
<li aria-current="page" class="font-semibold">New Page</li>
</ol>
</nav>
</header>
Page Protection
Protecting sensitive pages is critical for security. Use authentication and authorization to restrict access.
Best Practices:
- Use secure session management with HTTP-only cookies or tokens.
- Apply middleware on backend routes to verify user identity and roles.
- Redirect unauthorized users to login or error pages.
- On frontend, conditionally render content based on user permissions.
- Use HTTPS and secure headers to protect data in transit.
Example: Express middleware for authentication
// server/middleware/auth.js
function ensureAuthenticated(req, res, next) {
if (req.isAuthenticated && req.isAuthenticated()) {
return next();
}
res.status(401).json({ error: 'Unauthorized' });
}
module.exports = ensureAuthenticated;