No description
  • JavaScript 47.5%
  • EJS 26.8%
  • CSS 25.7%
Find a file
Magnus Naasade 6bf5b6cdb6 bcrypt gen
Signed-off-by: Magnus Naasade <mna@ljm.dk>
2026-02-25 09:44:45 +01:00
assets Initial commit: InnoIT. blog & CMS 2026-02-24 20:57:23 +01:00
config Initial commit: InnoIT. blog & CMS 2026-02-24 20:57:23 +01:00
db bcrypt gen 2026-02-25 09:44:45 +01:00
middleware Changes to image upload and attempted fix of preview markdown 2026-02-24 22:02:50 +01:00
models Initial commit: InnoIT. blog & CMS 2026-02-24 20:57:23 +01:00
public Changes to image inline handlers and attempted fix of preview markdown via DOM 2026-02-24 22:08:24 +01:00
routes auth changes to register logins properly 2026-02-25 09:30:46 +01:00
views Changes to image inline handlers and attempted fix of preview markdown via DOM 2026-02-24 22:08:24 +01:00
.env.example Initial commit: InnoIT. blog & CMS 2026-02-24 20:57:23 +01:00
.gitignore Initial commit: InnoIT. blog & CMS 2026-02-24 20:57:23 +01:00
fix-admin-password.js admin reset tool 2026-02-25 09:36:24 +01:00
generate-hash.js bcrypt gen 2026-02-25 09:38:11 +01:00
innoit-blog.service Changes to the about section and adding service for easy deployment 2026-02-24 21:23:59 +01:00
LICENSE Changes to image upload and attempted fix of preview markdown 2026-02-24 22:02:50 +01:00
package.json Initial commit: InnoIT. blog & CMS 2026-02-24 20:57:23 +01:00
README.md Initial commit: InnoIT. blog & CMS 2026-02-24 20:57:23 +01:00
reset-password.js auth changes to register logins properly 2026-02-25 09:30:46 +01:00
server.js Changes to image inline handlers and attempted fix of preview markdown via DOM 2026-02-24 22:08:24 +01:00
styleguide.md Initial commit: InnoIT. blog & CMS 2026-02-24 20:57:23 +01:00

InnoIT. Blog & CMS

A custom blog platform with a built-in CMS, built with Node.js, Express, PostgreSQL, and EJS.

Features

  • Public blog — home page, blog listing with pagination, individual post pages, about page
  • Custom CMS — full admin panel with dashboard, post editor, category and user management
  • Markdown editor — write posts in Markdown with toolbar and live preview
  • Image uploads — upload images inline or as featured images
  • Categories & tags — organise posts by topic
  • Draft/publish workflow — save drafts and publish when ready
  • Multi-author support — admin and author roles
  • Session-based auth — secure email/password login
  • Responsive design — works on all screen sizes
  • Style guide compliant — Darker Grotesque font, #fff / #000 / #ff4136 colour scheme

Requirements

  • Node.js 18+
  • PostgreSQL 14+

Setup

1. Install dependencies

npm install

2. Create the database

CREATE DATABASE innoit_blog;
CREATE USER innoit WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE innoit_blog TO innoit;

3. Configure environment

cp .env.example .env
# Edit .env with your database credentials and session secret

4. Run migrations and seed data

npm run setup

This creates all database tables and adds:

  • An admin user (admin@innoit.dev / changeme123)
  • Sample categories, tags, and a welcome post

5. Start the server

# Development (with auto-reload)
npm run dev

# Production
npm start

The site will be running at http://localhost:3000.

Admin Panel

Access the admin panel at /admin. Log in at /auth/login.

Feature Path
Dashboard /admin
Manage posts /admin/posts
New post /admin/posts/new
Categories /admin/categories (admin only)
Users /admin/users (admin only)

Roles

Role Permissions
Admin Full access — manage all posts, categories, tags, and users
Author Create and manage own posts only

Project Structure

├── server.js              # Express app entry point
├── config/
│   └── database.js        # PostgreSQL connection pool
├── db/
│   ├── migrate.js         # Database migrations
│   └── seed.js            # Seed data
├── middleware/
│   ├── auth.js            # Authentication guards
│   └── upload.js          # Multer image upload config
├── models/
│   ├── User.js            # User model
│   ├── Post.js            # Post model
│   ├── Category.js        # Category model
│   └── Tag.js             # Tag model
├── routes/
│   ├── public.js          # Home, About pages
│   ├── blog.js            # Blog listing & post pages
│   ├── auth.js            # Login / Logout
│   ├── admin.js           # CMS admin panel
│   └── api.js             # API (image upload)
├── views/                 # EJS templates
│   ├── partials/          # Header, footer, admin layout
│   ├── blog/              # Blog views
│   ├── admin/             # Admin panel views
│   ├── auth/              # Login page
│   └── errors/            # 404, 500
├── public/
│   ├── css/               # Stylesheets
│   ├── js/                # Client-side JavaScript
│   └── uploads/           # Uploaded images
└── assets/                # InnoIT. logos

Deployment

For VPS deployment:

  1. Install Node.js and PostgreSQL on your server
  2. Clone the repo and run npm install --production
  3. Set NODE_ENV=production and a strong SESSION_SECRET in .env
  4. Run npm run setup to initialise the database
  5. Use a process manager like PM2: pm2 start server.js --name innoit-blog
  6. Set up Nginx as a reverse proxy for port 3000
  7. Configure SSL with Let's Encrypt / Certbot

Changing the Admin Password

After first login, change the default password. You can also update it directly:

node -e "
  require('dotenv').config();
  const User = require('./models/User');
  User.updatePassword(1, 'your-new-secure-password').then(() => {
    console.log('Password updated');
    process.exit();
  });
"

License

UNLICENSED — InnoIT.