A type-safe static site generator built with OCaml, designed for both content creators and OCaml developers.
Ramen provides a command-line tool for building content-heavy static sites with a focus on data validation and consistency. It also exposes its core logic as an OCaml library for developers who need more control.
🌐 View Example Site – Generated from the content in this repository
Ramen is for two groups of people:
- CLI Users (Content Creators): If you want to build a blog or static
site without writing any OCaml, you can use the
ramencommand-line tool. You write content in Markdown and configure your site with simple YAML files. - Library Users (OCaml Developers): If you're an OCaml developer, you can use Ramen as a library to add content-driven pages to a larger web project (e.g., a Dream application). You get full, type-safe control over the data and HTML generation.
- Simple, file-based content: Write posts in Markdown, manage data in YAML.
- Content validation: The build process checks your content for missing fields or incorrect formats, preventing broken pages.
- Modern tooling: A simple CLI with
init,build, andservecommands. - Built-in styling: Clean, professional design with no configuration required.
# Clone the repository
git clone https://github.com/samoht/ramen.git
cd ramen
# Install dependencies
dune pkg lock # for dune package management
# OR
opam install . --deps-only . -t # for opam users
# Build and install
dune build
dune install # installs the `ramen` binary into your current opam switch- OCaml ≥ 5.0
- Dune ≥ 3.0
- Standard OCaml web libraries (dependencies handled by opam/dune)
-
Create a new site:
ramen init my-blog cd my-blog -
Start the development server:
ramen serve
Your site is now available at
http://localhost:8080. The server will automatically rebuild the site when you change any content.
- Data-driven core: A powerful core library for loading and validating structured content from files.
- Type-safe HTML generation: Uses OCaml's type system to generate HTML with compile-time validation, preventing common web development errors.
- Seamless integration: Designed to be used within other OCaml applications.
Ramen's architecture is data-driven:
- Load: The
Datamodule reads Markdown and YAML files from yourdata/directory. - Validate: Built-in validation checks the loaded data for consistency and completeness. Errors are reported with clear, file-specific messages.
- Generate: The
Enginemodule orchestrates the process and generates the final static assets.
This in-memory model provides the type-safety of the original design without the complex code-generation build step.
(* my_dream_app.ml *)
let () =
(* 1. Use Ramen to build the static part of your site on startup *)
let _ = Ramen.Build.run ~data_dir:"docs" ~output_dir:"_site/docs"
~theme:"default" in
(* 2. Serve the generated files alongside your dynamic routes *)
Dream.run @@ Dream.router [
Dream.get "/docs/**" (Dream.static "_site/docs");
Dream.get "/" (fun _ -> Dream.html "My dynamic homepage!");
(* ... other dynamic routes ... *)
]Contributions are welcome! Please see the TODO/ directory for the
project's roadmap and open issues.
This project was developed with significant AI assistance (Claude Code by Anthropic). The core architecture originated from the Tarides.com blog generator, but extensive refactoring, feature additions, and modernization were performed using AI-assisted development.
While the tool has been tested and works well in practice, users should be aware that:
-
Technical implications: AI-generated code may have unique patterns or subtle issues. We've tested Ramen on real projects, but thorough testing is always recommended.
-
Legal uncertainty: The copyright status and liability for AI-generated code remain legally untested. The original codebase provides a foundation, but AI contributions cannot be easily traced to specific training data.
-
Practical use: Despite these unknowns, Ramen provides useful functionality for static site generation and is actively maintained.
By using this tool, you acknowledge these uncertainties. As with any development tool: use version control, review generated sites, and test thoroughly.
ISC
