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:
- Dream: For the development server
- TyXML: For type-safe HTML generation
- Omd: For Markdown parsing
- Yojson: For JSON config handling
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
- TyXML has a steeper learning curve than I expected, but the benefits of type safety are already apparent
- OCaml's module system is perfect for organizing UI components
- Need to decide on a better approach for handling frontmatter in Markdown files
Tomorrow's Plan
- Implement the Markdown parser with frontmatter extraction
- Begin work on the routing system
- Set up the initial CSS with a theme toggle feature
Day 1 complete! Making steady progress and enjoying the process.