Nitro

From Elixir Wiki
Jump to navigation Jump to search

Nitro[edit]

File:Nitro Logo.png
The Nitro logo

Nitro is a web framework for the Elixir programming language. It provides a powerful and elegant way to build scalable, maintainable, and highly performant web applications. Nitro focuses on developer productivity and strives to provide a pleasant development experience while also prioritizing performance.

Features[edit]

  • Routing: Nitro offers a flexible routing system that allows developers to define routes and map them to specific controller actions.
  • Lean Controllers: Nitro promotes lean controllers by encouraging the separation of concerns and the use of functional programming principles.
  • Templating Engine: Nitro integrates a templating engine that simplifies the creation and rendering of dynamic web content.
  • ORM Integration: Nitro seamlessly integrates with popular Elixir ORMs like Ecto, enabling developers to easily work with databases.
  • Middleware: Nitro supports the use of middleware, allowing developers to add custom logic at various stages of the request/response cycle.
  • Authentication and Authorization: Nitro provides built-in support for authentication and authorization, making it easy to secure web applications.
  • Testing: Nitro offers a testing framework that facilitates the creation of unit tests and integration tests for web applications.
  • Built-in Web Server: Nitro includes a built-in web server for development and testing purposes, making it easy to get started.


Getting Started[edit]

To start using Nitro in your Elixir project, you need to add it as a dependency in your `mix.exs` file. Open the file and add the following line to the `deps` function:

```elixir defp deps do

 [
   {:nitro, "~> x.x.x"}
 ]

end ```

Replace `x.x.x` with the desired version of Nitro. After saving the file, run the following command in your project's directory to fetch the dependency:

```shell mix deps.get ```

Once the dependency is installed, you can start building your Nitro application. Create your routes, controllers, and templates to define the desired behavior and layout of your web application. Use the Nitro command-line interface to start the built-in web server:

```shell mix nitro.server ```

Your Nitro application will now be accessible at `http://localhost:4000`.

Resources[edit]

Check out the following resources to learn more about Nitro and improve your proficiency in developing web applications with Elixir: