No description
  • HTML 42.3%
  • Go 42.1%
  • CSS 12.8%
  • JavaScript 1.8%
  • Dockerfile 1%
Find a file
Kalvin Carefour Johnny 362dafcb38
Merge pull request #3 from kalvin0x8d0/claude/refactor-wikibulou-security-fYN6v
Add security hardening: CSRF protection, rate limiting, and HTML sanitization
2026-03-31 11:54:10 +08:00
.emergent Auto-generated changes 2026-03-28 23:51:44 +00:00
cmd/server Comprehensive security, architectural, and accessibility refactoring 2026-03-31 03:19:39 +00:00
internal Comprehensive security, architectural, and accessibility refactoring 2026-03-31 03:19:39 +00:00
memory auto-commit for 4a52345b-d580-4b7a-bce8-c44092daf22e 2026-03-28 23:51:08 +00:00
static Comprehensive security, architectural, and accessibility refactoring 2026-03-31 03:19:39 +00:00
templates Comprehensive security, architectural, and accessibility refactoring 2026-03-31 03:19:39 +00:00
.env.example Create .env.example 2026-03-30 08:14:34 +08:00
.gitconfig Auto-generated changes 2026-03-28 23:51:44 +00:00
.gitignore Auto-generated changes 2026-03-28 23:51:44 +00:00
docker-compose.yaml Comprehensive security, architectural, and accessibility refactoring 2026-03-31 03:19:39 +00:00
Dockerfile Fix security vulnerabilities, bugs, and improve infrastructure 2026-03-28 21:14:39 +00:00
go.mod Comprehensive security, architectural, and accessibility refactoring 2026-03-31 03:19:39 +00:00
go.sum Comprehensive security, architectural, and accessibility refactoring 2026-03-31 03:19:39 +00:00
LICENSE Create LICENSE 2026-03-29 05:01:53 +08:00
README.md First commit 2026-03-29 05:00:01 +08:00

Wikibulou

A simple, FLOSS wiki software that doesn't make your brain hurt.

Markdown instead of wikitext. MariaDB for the database. Docker Compose so you can run it in minutes. Built for people who want a wiki, not a science project.


Features

  • Markdown editing — write pages in standard CommonMark Markdown with live preview
  • User accounts — register, login, roles (admin / editor / viewer)
  • Page history — every edit is saved; browse and view old revisions
  • Full-text search — fast FULLTEXT search powered by MariaDB
  • Public or private — toggle whether guests can read without logging in
  • Material You design — clean, responsive UI using Google's Material Design 3 tokens; works on mobile and desktop
  • Docker Compose ready — one command to run the whole stack
  • FLOSS — Go + MariaDB + goldmark, all libre licences

Requirements: Docker and Docker Compose installed on your VPS or computer.

# 1. Clone or unzip the project
git clone https://github.com/your-username/wikibulou.git
cd wikibulou

# 2. Copy the example env file and set your passwords
cp .env.example .env
nano .env   # change DB_ROOT_PASSWORD and DB_PASS to something strong

# 3. Start everything
docker compose up -d

# 4. Open your browser
# http://localhost:8080
# You'll be taken to /setup to create the admin account on first run.

That's it. MariaDB and the wiki server start together. Your data is saved in a Docker volume (wikibulou_db_data) so it survives container restarts.

To stop:

docker compose down

To see logs:

docker compose logs -f app   # app logs
docker compose logs -f db    # database logs

Running Without Docker (manual / development)

Requirements: Go 1.21+, MariaDB 10.6+ or 11.x running somewhere.

# 1. Create the database manually in MariaDB
mysql -u root -p -e "
  CREATE DATABASE wikibulou CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  CREATE USER 'wikibulou'@'localhost' IDENTIFIED BY 'your_password';
  GRANT ALL PRIVILEGES ON wikibulou.* TO 'wikibulou'@'localhost';
  FLUSH PRIVILEGES;
"

# 2. Set environment variables
export DB_HOST=localhost
export DB_PORT=3306
export DB_NAME=wikibulou
export DB_USER=wikibulou
export DB_PASS=your_password
export PORT=8080

# 3. Download Go dependencies
go mod tidy

# 4. Run the server
go run ./cmd/server

The server creates all the database tables on first boot — you don't need to run SQL scripts manually.


Project Structure

wikibulou/
├── cmd/
│   └── server/
│       └── main.go              ← entry point; sets up routes and starts server
├── internal/
│   ├── auth/
│   │   └── auth.go              ← user registration, login, sessions (bcrypt)
│   ├── db/
│   │   └── db.go                ← MariaDB connection, migration, settings
│   ├── handlers/
│   │   ├── handlers.go          ← all HTTP route handlers
│   │   ├── page_model.go        ← page CRUD and history database operations
│   │   ├── preview.go           ← live Markdown preview endpoint
│   │   └── templates.go         ← template loading and rendering
│   ├── markdown/
│   │   └── markdown.go          ← Markdown → HTML using goldmark
│   └── search/
│       └── search.go            ← full-text search using MariaDB FULLTEXT
├── templates/
│   ├── base.html                ← shared HTML layout (nav, footer)
│   ├── home.html                ← wiki home page (page list)
│   ├── view_page.html           ← view a wiki page
│   ├── edit_page.html           ← create or edit a page
│   ├── history.html             ← revision list for a page
│   ├── view_revision.html       ← view a historical revision
│   ├── search.html              ← search results page
│   ├── login.html               ← login form
│   ├── register.html            ← new account form
│   ├── setup.html               ← first-run admin setup
│   ├── settings.html            ← admin wiki settings
│   └── not_found.html           ← 404 / page doesn't exist yet
├── static/
│   ├── css/
│   │   └── style.css            ← Material You design system (pure CSS, no framework)
│   └── js/
│       └── app.js               ← lightweight JS helpers (no framework)
├── Dockerfile                   ← multi-stage Docker build
├── docker-compose.yml           ← MariaDB + app stack
├── .env.example                 ← sample environment variables
├── .gitignore
├── go.mod
├── go.sum
└── README.md

URL Routes

Method URL Description
GET / Home — list all pages
GET /setup First-run admin setup (disappears after first user)
GET/POST /login Login form
GET/POST /register New account
GET /logout Log out
GET /search?q=... Search pages
GET/POST /settings Admin settings (admin only)
GET /wiki/new New page form
POST /wiki/new Create new page
GET /wiki/{slug} View a page
GET/POST /wiki/{slug}/edit Edit a page
POST /wiki/{slug}/delete Delete a page (admin only)
GET /wiki/{slug}/history Revision history
GET /wiki/{slug}/revision/{id} View old revision
POST /preview Live Markdown preview (used by editor)

User Roles

Role Can read Can create/edit Can delete Can change settings
admin
editor
viewer (if wiki is public or logged in)

The first user created (via /setup) is always admin. All self-registered users get the editor role.


Wiki Visibility

In Settings (admin only), you can toggle the wiki between:

  • Public — anyone can read pages without logging in. Only logged-in users can edit.
  • Private — login required to view anything.

Markdown Support

Wikibulou uses goldmark with these extensions enabled:

  • Tables (| col | col |)
  • Strikethrough (~~text~~)
  • Task lists (- [x] done)
  • Auto-linking of URLs
  • Auto-generated heading IDs (for anchor links)

CommonMark reference →


Deploying to a VPS (e.g. Contabo)

  1. Install Docker and Docker Compose on your VPS:

    curl -fsSL https://get.docker.com | sh
    sudo usermod -aG docker $USER
    
  2. Upload the project files to your VPS (e.g. via scp or Termius).

  3. Configure .env with strong passwords.

  4. Start with docker compose up -d.

  5. (Optional) Put Nginx or Caddy in front of it on port 80/443 for HTTPS.

Example Nginx proxy config:

server {
    listen 80;
    server_name wiki.yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

For HTTPS, use Caddy — it handles TLS certificates automatically:

wiki.yourdomain.com {
    reverse_proxy localhost:8080
}

Environment Variables

Variable Default Description
DB_HOST db MariaDB hostname
DB_PORT 3306 MariaDB port
DB_NAME wikibulou Database name
DB_USER wikibulou Database username
DB_PASS wikibulou Database password
DB_ROOT_PASSWORD changeme_root MariaDB root password (Docker only)
PORT 8080 Port for the Go HTTP server
APP_PORT 8080 Host port to map (Docker Compose only)

Development Tips

  • Templates and static files are volume-mounted in Docker Compose, so you can edit them and refresh the browser without rebuilding the image.
  • To rebuild the Go binary after code changes: docker compose up --build -d
  • The server auto-retries the DB connection on startup (10 attempts, 3s apart) so you don't need to worry about startup order.
  • Keyboard shortcut in the editor: Ctrl+S / Cmd+S to save the page.

Licence

Wikibulou is free and open-source software. Do what you want with it.

Dependencies:


Built to be simple and useful. No bloat.