Day 1: Setting Up the Memoir Project

Date: June 7, 2025

Today I started work on Memoir, my OCaml-based static site generator. The goal is to build a minimalist yet powerful system that can render my writing with excellent performance while giving me complete control over the output.

Morning: Project Structure

Started the day by planning the project structure. Decided on a simple but effective organization:

memoir/
├── bin/           # Executable entry points
├── lib/           # Core library code
│   ├── content/   # Content handling
│   ├── templates/ # HTML templates
│   └── types/     # Type definitions
├── test/          # Test suite
└── static/        # Static assets

Created the initial dune project structure with:

$ dune init project memoir

Afternoon: Core Dependencies

Selected the core dependencies:

Added these to the dune file and created the initial project structure. Ran into some issues with Omd version compatibility but resolved by pinning to a specific version.

Evening: First Templates

Started implementing the basic templates system using TyXML. It feels very satisfying to have type safety while generating HTML! Writing the header component was particularly interesting:

(** Header component for all pages *)
module Header = struct
  (** Complete header component *)
  let make ?(show_logo = true) () =
    let open Html in
    header
      ~a:[ a_class [ "site-header" ] ]
      [
        div
          ~a:[ a_class [ "container" ]; a_class [ "header-container" ] ]
          [
            (if show_logo then logo () else span []);
            nav_toggle ();
            navigation ();
          ];
      ]
end

Key Learnings

  1. TyXML has a steeper learning curve than I expected, but the benefits of type safety are already apparent
  2. OCaml's module system is perfect for organizing UI components
  3. Need to decide on a better approach for handling frontmatter in Markdown files

Tomorrow's Plan


Day 1 complete! Making steady progress and enjoying the process.

Hey, this site is part of ring.muhokama.fun!