<commit_before>##Welcome to Phoenix!

Phoenix is a web development framework written in Elixir which implements the server-side MVC pattern. If you've ever used a similar framework, say Ruby on Rails or Python's Django, many of the concepts will be familiar to you. Phoenix is not, however, simply a Rails clone. It aims to have the best of both worlds, high developer productivity _and_ high application performance. Phoenix also has some interesting new twists, channels for managing Websockets, pre-compiled templates and the potential for alternative architectures which may make services more manageable from the very beginning of your project.

If you are already familiar with Elixir, great! If not, there are a number of places you can go to learn. You might want to read through the [Elixir guides](http://elixir-lang.org/getting_started/1.html) first. You might also want to look through any of the books, blogs or videos listed in the Resources Guide.

The aim of this introductory guide is to present a brief, high level overview of Phoenix, the parts that make it up, and the layers underneath that support it.

### Phoenix

Phoenix is actually the top layer of a multi-layer system designed to be modular and flexible. The other layers are the Elixir middleware project, Plug, and the Erlang web server, Cowboy. Plug and Cowboy are covered in the next sections of this guide.

Phoenix is made up of a number of distinct parts, each with its own purpose and role to play in building a web application. We will cover them all in depth throughout these guides, but here's a quick breakdown.

- The Router
  - parses incoming requests and dispatches to the correct controller/action, passing parameters as needed
  - provides helpers to generate route paths or urls to resources
- Controllers
  - provide functions called actions to handle requests
  - Actions
    - prepare data and pass it into views
    - invoke rendering via views
    - perform redirects
- Views
  - render templates
  - define helper functions, available in templates, to decorate raw data
- Templates
  - are what they sound like :)
- Channels
  - manage sockets
  - are roughly analogous to controllers except that they are bi-directional and persistent
- Sockets
  - are multiplexed, persistent connections
- Topics
  - serve as a PubSub broadcast layer

### Plug

Plug is Elixir's middleware layer. Conceptually, it shares a lot with other middleware layers like Rack for Ruby or WSGI for Python. Plugs are reusable modules that share the same very small, very regular public api. They provide discreet behaviors - like request header parsing or logging. Because the Plug api is so consistent, they can be stacked and executed in a set order, like a pipeline. They can also be re-used within a project or across projects.

Plugs can be written to handle almost anything, from authentication to parameter pre-processing, and even rendering.

Phoenix takes great advantage of Plug in general - the router and controllers especially so.

One of the most important things about Plug, is that it provides adapters to HTTP servers which will ultimately deliver application content to your users. Currently, Plug only provides an adapter to Cowboy, which we will talk about next, but there are plans to provide adapters for other servers in the future.

Links to more in-depth information on Plug can be found in the Resources Guide.

### Cowboy

Cowboy is an HTTP server written in Erlang by <NAME> of [99s](http://ninenines.eu/). Cowboy is built in a modular way on top of Ranch, Bullet, and Sheriff. This is how 99s describes them all.

Cowboy is a small, fast, modular HTTP server supporting Websockets, SPDY and more.

Ranch is a socket acceptor pool for TCP protocols. It is also a standalone library for building networked applications.

Bullet is simple, reliable, efficient streaming library.

Sheriff uses parse transforms for type based validation. Sheriff also validates data dynamically using Erlang's type system with no extra code required.

Cowboy has fantastic documentation. The Guides are especially helpful. Learning more about Cowboy will surely help you to understand of Phoenix more fully.

Cowboy has its own section of links in the Resources Guide.<commit_msg>add bullet points to cowboy components in overview<commit_after>##Welcome to Phoenix!

Phoenix is a web development framework written in Elixir which implements the server-side MVC pattern. If you've ever used a similar framework, say Ruby on Rails or Python's Django, many of the concepts will be familiar to you. Phoenix is not, however, simply a Rails clone. It aims to have the best of both worlds, high developer productivity _and_ high application performance. Phoenix also has some interesting new twists, channels for managing Websockets, pre-compiled templates and the potential for alternative architectures which may make services more manageable from the very beginning of your project.

If you are already familiar with Elixir, great! If not, there are a number of places you can go to learn. You might want to read through the [Elixir guides](http://elixir-lang.org/getting_started/1.html) first. You might also want to look through any of the books, blogs or videos listed in the Resources Guide.

The aim of this introductory guide is to present a brief, high level overview of Phoenix, the parts that make it up, and the layers underneath that support it.

### Phoenix

Phoenix is actually the top layer of a multi-layer system designed to be modular and flexible. The other layers are the Elixir middleware project, Plug, and the Erlang web server, Cowboy. Plug and Cowboy are covered in the next sections of this guide.

Phoenix is made up of a number of distinct parts, each with its own purpose and role to play in building a web application. We will cover them all in depth throughout these guides, but here's a quick breakdown.

- The Router
  - parses incoming requests and dispatches to the correct controller/action, passing parameters as needed
  - provides helpers to generate route paths or urls to resources
- Controllers
  - provide functions called actions to handle requests
  - Actions
    - prepare data and pass it into views
    - invoke rendering via views
    - perform redirects
- Views
  - render templates
  - define helper functions, available in templates, to decorate raw data
- Templates
  - are what they sound like :)
- Channels
  - manage sockets
  - are roughly analogous to controllers except that they are bi-directional and persistent
- Sockets
  - are multiplexed, persistent connections
- Topics
  - serve as a PubSub broadcast layer

### Plug

Plug is Elixir's middleware layer. Conceptually, it shares a lot with other middleware layers like Rack for Ruby or WSGI for Python. Plugs are reusable modules that share the same very small, very regular public api. They provide discreet behaviors - like request header parsing or logging. Because the Plug api is so consistent, they can be stacked and executed in a set order, like a pipeline. They can also be re-used within a project or across projects.

Plugs can be written to handle almost anything, from authentication to parameter pre-processing, and even rendering.

Phoenix takes great advantage of Plug in general - the router and controllers especially so.

One of the most important things about Plug, is that it provides adapters to HTTP servers which will ultimately deliver application content to your users. Currently, Plug only provides an adapter to Cowboy, which we will talk about next, but there are plans to provide adapters for other servers in the future.

Links to more in-depth information on Plug can be found in the Resources Guide.

### Cowboy

Cowboy is an HTTP server written in Erlang by <NAME> of [99s](http://ninenines.eu/). Cowboy is built in a modular way on top of Ranch, Bullet, and Sheriff. This is how 99s describes them all.

- Cowboy is a small, fast, modular HTTP server supporting Websockets, SPDY and more.

- Ranch is a socket acceptor pool for TCP protocols. It is also a standalone library for building networked applications.

- Bullet is simple, reliable, efficient streaming library.

- Sheriff uses parse transforms for type based validation. Sheriff also validates data dynamically using Erlang's type system with no extra code required.

Cowboy has fantastic documentation. The Guides are especially helpful. Learning more about Cowboy will surely help you to understand of Phoenix more fully.

Cowboy has its own section of links in the Resources Guide.
{'fraction_non_alphanumeric': 0.03638483965014577, 'fraction_numerical': 0.0011661807580174927, 'mean_word_length': 4.203883495145631, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1620568', 'n_tokens_mistral': 2086, 'n_tokens_neox': 1959, 'n_words': 1316}