IHP is a database centric framework. It comes with an integrated Postgres server out of the box.
learn moreWith Haskell and Nix we use the most reliable technologies available, to make sure your application will never crash because of Null Pointer Exceptions.
learn moreIHP comes with everything you need to build great web applications out of the box.
learn moreIHP is a batteries-included web framework, optimized for longterm productivity and programmer happiness.
With IHP all your application code is written in Haskell - a functional programming language with an incredible type system, used by giants such as GitHub and Facebook.
Thanks to Haskell's impressive type system you can write code that is far more robust than you have seen before.
(Don't worry, you don't need to know much about Haskell to get started, you'll learn it along the way)
While haskell is a compiled language, the built-in dev server automatically reloads your code changes using the fastest way possible.
Changes are reflected instantly. Just like good old PHP.
With IHP all your application code is written in Haskell - a functional programming with an incredible type system, used by giants such as GitHub and Facebook.
Thanks to Haskell's impressive type system you can write code that is far more robust than you have seen before.
Don't worry, you don't need to know much about Haskell to get started, you'll learn it along the way. IHP is the haskell web framework for non-haskellers.
-- Make a password hash
hash <- hashPassword "hunter2"
-- Set values
let user = newRecord @User
|> set #email "someone@example.com"
|> set #passwordHash hash
-- Insert it into the DB
createRecord user
action UsersAction = do
-- Fetch 10 users ordered by firstname
users <- query @User
|> orderBy #firstname
|> limit 10
|> fetch
render IndexView { .. }
-- The autoRefresh keyword makes the action realtime
-- No app-specific JS needed
-- ↘↘↘
action MessagesAction = autoRefresh do
messages <- query @Message
|> orderBy #createdAt
|> fetch
render IndexView { .. }
IHP is a database centric web framework. We introspect your database schema to provide type-safe APIs and query builders.
You don't have to be a database expert to use IHP, with the Schema Designer you quickly click together your data structures.
If you like your code editor more, you can always manually edit the SQL files.
Stop dealing with repetitive form HTML code. IHP brings you a sophisticated but simple form engine that takes care of the HTML and validation logic.
instance View NewView where
html NewView { .. } = [hsx|
<h1>New Comment</h1>
{renderForm comment}
|]
renderForm comment = formFor comment [hsx|
{hiddenField #threadId}
<!-- Labels + Validation Results are taken care of -->
{textareaField #body}
{submitButton}
|]
instance View NewView where
html NewView { .. } = [hsx|
<h1>New Comment</h1>
{renderForm comment}
|]
renderForm comment = formFor comment [hsx|
{hiddenField #threadId}
{(textareaField #body) {
fieldLabel = "Your Comment:",
helpText = "You can use markdown here."
}}
<p>
<!-- Use any HTML inside your forms -->
Please double check your comment
for spelling mistakes.
</p>
{submitButton}
|]
action CreateCommentAction = do
let comment = newRecord @Comment
comment
|> fill @["body", "threadId"]
|> set #userId currentUserId
-- Actual validation here
|> validateField #body nonEmpty
|> validateField #threadId nonEmpty
|> ifValid \case
-- Validation Failed -> Render form + errors
Left comment -> render NewView { .. }
-- Validation Good
Right comment -> do
-- Insert comment to DB
comment <- comment |> createRecord
let commentId = get #id comment
-- Redirect to comment
redirectTo ShowCommentAction { commentId }
Try out what the future of software engineering feels like