Skip to content
项目

关于

🔥 构建类型安全 Web 应用的最快方式。IHP 是一款开箱即用的新型 Web 框架,专为长期生产力和程序员的幸福感而优化。

网站与应用开发

这些数字如何统计

实测星标增长

24小时
+1
7天
+7
15天
+10
1个月
+20

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

MIT License

IHP Website

IHP: The Type-safe Web Framework for Builders

IHP is a batteries-included web framework optimized for longterm productivity and programmer happiness. Built on top of Haskell and Nix. Move fast, without breaking things.

In production since 2017. Used by teams building serious web applications.

Watch the IHP introduction

What IHP Code Looks Like

-- Controller: Create a new post
action CreatePostAction = do
    let post = newRecord @Post
    post
        |> fill @'["title", "body"]
        |> validateField #title nonEmpty
        |> validateField #body nonEmpty
        |> ifValid \case
            Left post -> render NewView { .. }
            Right post -> do
                post <- post |> createRecord
                redirectTo PostsAction

-- View: Type-safe HTML with HSX
renderPost :: Post -> Html
renderPost post = [hsx|
    <article>
        <h2>{post.title}</h2>
        <p>{post.body}</p>
    </article>
|]

Features

Type Safety -- Type-safe routing, queries, and HTML (HSX). Catch errors at compile time.

AI-Driven Development -- Optimized for Claude Code and AI-assisted workflows. The type system acts as a safety net -- AI generates code, the compiler verifies it. Ship features faster with confidence. IHP ships with a comprehensive CLAUDE.md that teaches AI tools the framework conventions.

Schema Designer -- Visual database design tool. Edit tables in a GUI or write SQL directly.

Code Generators -- Generate controllers, views, and migrations from the IDE.

Live Reload -- Instant feedback during development despite being a compiled language.

Live Reload

Auto Refresh -- Real-time views that update when data changes. One line of code.

Auto Refresh

Authentication -- Built-in user signup and login.

Forms & Validation -- Type-safe form handling with built-in validation.

Managed Environment -- Nix handles all dependencies including PostgreSQL and GHC. You don't need to learn Nix -- IHP uses it behind the scenes so that devenv up just works. Every developer on your team gets the exact same environment with zero setup friction.

Quick Start

nix profile install nixpkgs#ihp-new
ihp-new myproject
cd myproject && devenv up

Full Installation Guide | Your First Project

Package Ecosystem

IHP is a monorepo with focused packages:

Package Purpose
ihp Core web framework (routing, controllers, views, models, validation)
ihp-hsx HSX templating (JSX-like HTML in Haskell)
ihp-ide Dev server, schema designer, code generators
ihp-datasync Real-time data sync via WebSockets
ihp-graphql GraphQL API
ihp-openai OpenAI integration
ihp-ssc Server-side components
ihp-hspec Testing utilities
ihp-migrate Database migration tool
ihp-mail Email support
ihp-job-dashboard Background job monitoring
ihp-pglistener PostgreSQL LISTEN/NOTIFY

Deployment

IHP apps deploy to NixOS servers using the built-in deploy-to-nixos tool. Your entire server configuration -- nginx, TLS via Let's Encrypt, PostgreSQL, systemd services -- lives declaratively in your git repository under Config/nix/hosts/production/.

deploy-to-nixos production

This runs nixos-rebuild over SSH to apply your configuration. No Docker, Kubernetes, or CI pipeline required -- your server matches your dev environment exactly. Systemd socket activation queues requests during deploys for zero-downtime restarts, and a watchdog automatically recovers unresponsive processes.

Docker and bare-metal deployments are also supported. Full deployment guide

Community

  • Slack -- Questions, help with type errors, or just chat
  • Forum -- Longer discussions and announcements

Contributing

We welcome pull requests! See CONTRIBUTING.md for details. Documentation lives in the Guide directory.

探索相关项目

加载中…