# Yaws - a web server? How does it differ from a framework?

**URL:** <https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428>\
**Category:** Chat / Discussions\
**Tags:** yaws, erlang-noob-curiosities\
**Created:** [November 2, 2021, 3:52am UTC](https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428 "2021-11-02T03:52:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![AstonJ](https://erlangforums.com/user_avatar/erlangforums.com/astonj/32/9_2.png) [@AstonJ](https://erlangforums.com/u/AstonJ)\
**Post date:** [November 2, 2021, 3:52am UTC](https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428/1 "2021-11-02T03:52:51Z")

</div>

When I think of a web server something like the Apache HTTP server comes to mind - or perhaps something like mod\_ruby/Passenger Phusion (which allows you to run Ruby apps on an Apache server) but looking at [this thread on EF](https://elixirforum.com/t/yaws-vs-cowboy-and-phoenix/3348), [Yaws](http://yaws.hyber.org) is more like a _web framework_?

I wonder if anyone who has used Yaws could share their experience?

_Perhaps @vinoski (Yaws core team) and @OvermindDL1 (who took part in that thread) could also chime in? 😊_

---

<div class="post-metadata">

**Author:** ![robert](https://erlangforums.com/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@robert](https://erlangforums.com/u/robert)\
**Post date:** [November 2, 2021, 8:02am UTC](https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428/2 "2021-11-02T08:02:22Z")

</div>

Please correct me if I am wrong but I believe Claes Wikström is in fact the creator of Yaws.

---

<div class="post-metadata">

**Author:** ![cmkarlsson](https://erlangforums.com/user_avatar/erlangforums.com/cmkarlsson/32/416_2.png) [@cmkarlsson](https://erlangforums.com/u/cmkarlsson)\
**Post date:** [November 2, 2021, 10:01am UTC](https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428/3 "2021-11-02T10:01:26Z")

</div>

My definition of a web server is a piece of software which implements the HTTP server specification of some version and is able to respond to client requests.

A web framework is a set of libraries and conventions that aid in the development of dynamic web applications. Most web frameworks work with or include an HTTP server of some sort. Of course there is a wide span what constitutes a web framework from micro-frameworks to full-blown ruby on rails style frameworks. The more micro, the closer to just a web server you get.

Yaws is both a web server and a web framework. I think it actually started more like a traditional web server that could serve static content and dynamic content through erlang embedded in html pages (ehtml). Think more like apache/php than phoenix.

It also supports running in embedded mode, where it is part of your OTP application.

By using yaws _appmods_ (an appmod is an erlang module which exports and `out/1` function and is registered in config to server a specific URL path) you have full control over the URI Path and can hand off all the processing to your own erlang modules. By using it this way it behaves more like cowboy or elli.

Yaws have lots of features:

- websockets / long polling / SSE
- json
- virtual servers
- ehtml, which I guess would be yaws html dialect (it is a html represented as erlang tuples)
- session/cookies
- webdav
- streaming / chunked transfer

and probably a lot more.

I think though, that if you are used to a modern framework yaws may appear a bit archaic. Reading the documentation is like reading a history book over how http has developed over time 😃

---

<div class="post-metadata">

**Author:** ![vinoski](https://erlangforums.com/user_avatar/erlangforums.com/vinoski/32/265_2.png) [@vinoski](https://erlangforums.com/u/vinoski)\
**Post date:** [November 2, 2021, 12:27pm UTC](https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428/4 "2021-11-02T12:27:10Z")

</div>

You’re correct. Claes, better known as klacke, created Yaws sometime around 2000. To the best of my knowledge, the first commits for it to source control were in January 2001.

Claes is now retired, so I’m the sole caretaker of Yaws. I started contributing to it in 2008.

---

<div class="post-metadata">

**Author:** ![AstonJ](https://erlangforums.com/user_avatar/erlangforums.com/astonj/32/9_2.png) [@AstonJ](https://erlangforums.com/u/AstonJ)\
**Post date:** [November 2, 2021, 9:18pm UTC](https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428/5 "2021-11-02T21:18:42Z")

</div>

Thanks @Robert + @vinoski - I fixed my post :003:

Great post @cmkarlsson :023:

> [@cmkarlsson](#):
>
> Yaws is both a web server and a web framework.

Interesting - wonder if it could be seen as (or maybe even expanded a little so it’s more like) a ‘micro’ web framework? That could add more potential use-cases even if just by making it easier for people to imagine where/when they might want to use it. (I haven’t actually used a micro framework myself, but know some of them (like Ruby’s Sinatra) are quite popular - hence why it might be worthwhile for Yaws.)

---

<div class="post-metadata">

**Author:** ![vinoski](https://erlangforums.com/user_avatar/erlangforums.com/vinoski/32/265_2.png) [@vinoski](https://erlangforums.com/u/vinoski)\
**Post date:** [November 3, 2021, 12:18am UTC](https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428/6 "2021-11-03T00:18:02Z")

</div>

This is a pretty good description.

As for the documentation being like an HTTP history book, one reason for this is that Yaws has always evolved based on contributions from people using it. As web technologies advanced over the years, Yaws users would either contribute code to implement new web features or ask us to implement them, and sometimes we implemented features without being asked because we were using them in our own jobs.

---

<div class="post-metadata">

**Author:** ![vinoski](https://erlangforums.com/user_avatar/erlangforums.com/vinoski/32/265_2.png) [@vinoski](https://erlangforums.com/u/vinoski)\
**Post date:** [November 3, 2021, 12:25am UTC](https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428/7 "2021-11-03T00:25:19Z")

</div>

Something we’ve always tried hard to do with Yaws is maintain backward compatibility from one release to the next. Seems like changing to a micro framework would go against this notion.

In addition, as @cmkarlsson already noted, Yaws is embeddable, and I’d add to that the fact that it’s reasonably modular – the various features it provides can be used if you want them or ignored if you don’t.

---

<div class="post-metadata">

**Author:** ![OvermindDL1](https://erlangforums.com/user_avatar/erlangforums.com/overminddl1/32/398_2.png) [@OvermindDL1](https://erlangforums.com/u/OvermindDL1)\
**Post date:** [November 4, 2021, 7:16pm UTC](https://erlangforums.com/t/yaws-a-web-server-how-does-it-differ-from-a-framework/428/8 "2021-11-04T19:16:13Z")

</div>

> [@cmkarlsson](#):
>
> Yaws is both a web server and a web framework. I think it actually started more like a traditional web server that could serve static content and dynamic content through erlang embedded in html pages (ehtml). Think more like apache/php than phoenix.

Yeah that sounds about right from what I remember of it’s growth.

It is definitely more low level, has a ton of power, had a few performance issues back in the day (like even before cowboy/mochiweb/etc) but those are likely quite fixed at this point, lol.

I quite enjoyed making the few things in it that I did though, it was pleasant to work in.
