Skip to content

Latest commit

 

History

History
115 lines (80 loc) · 2.43 KB

File metadata and controls

115 lines (80 loc) · 2.43 KB

OCaml Dream Web Application Template

A production-ready OCaml Dream web framework template for Railway deployment. This template includes server-side HTML rendering with Tailwind CSS and HTMX, perfect for building modern interactive web applications.

✨ Features

  • OCaml with Dream web framework
  • Server-side HTML rendering with Dream-HTML
  • Tailwind CSS for styling
  • HTMX for dynamic interactions
  • Docker containerization for consistent deployment
  • Production-ready configuration with optimized builds

🚀 One-Click Deploy

Deploy this template to Railway with a single click:

Deploy on Railway

🛠 Local Development

Prerequisites

  • OCaml (install from ocaml.org)
  • Opam package manager
  • Dune build system

Setup

  1. Clone the repository:
git clone <your-repo-url>
cd railway-dream
  1. Install dependencies:
opam install . --deps-only
  1. Build the project:
dune build
  1. Run the server:
dune exec app

The server will start on http://localhost:8080

Development Commands

Use the provided Makefile for common tasks:

# Start development server
make dev

# Build the project
make build

# Run tests
make test

🐳 Docker

Build and run with Docker:

docker build -t dream-app .
docker run -p 8080:8080 dream-app

🧪 Testing

Run the test suite:

dune runtest

📁 Project Structure

├── bin/             # Executable entry point
├── lib/             # Main application code
│   ├── app.ml      # Web server and routes
│   └── dune        # Build configuration
├── test/           # Test files
├── Dockerfile      # Container configuration
├── Makefile        # Development commands
└── dune-project    # Project configuration

🔧 Configuration

The app is configured for Railway deployment with:

  • Environment-based port configuration
  • Production-optimized Docker builds
  • Automatic dependency management with Opam

📚 Learn More

📄 License

This template is available as open source under the terms of the MIT License.