Commands
  • About
  • Software Development
    • Glossary
    • System Design
      • CAP Theorem
      • Data Migration
      • EAV Model
      • ETL Process
      • Event Sourcing
      • Outbox Pattern
      • SOLID Principles
    • Standards
      • Character Encoding
      • Twirp
    • Elixir
      • IEx
      • Mix
      • Libraries
      • Code Snippets
    • Node.js
      • TypeScript
  • Commands
    • Bookmarks
    • AWS
      • Athena
      • ECS
    • Docker
      • Manage Images
      • Manage Containers
    • File System
      • Grep
      • Search Files
      • Miscellaneous
    • Git
      • Setup New Project
      • Manage Remotes
      • Release Project
    • GPG
    • Kafka
      • Quick Start
    • Kubernetes
    • OpenShift
      • Manage Roles and Bindings
    • PostgreSQL
    • SSL / TLS
      • Common OpenSSL Commands
      • Create Self-signed Certificate
      • Java Truststore and Keystore
    • SSH
      • Key Management
      • Port Forwarding
    • YUM
      • List Repositories
      • List Packages
    • Miscellaneous
      • Network
Powered by GitBook
On this page
  • Web Framework
  • Phoenix
  • Database Management
  • Ecto
  • Background Processing
  • Oban
  • Testing
  • Mock
  • Hammox
  • Bypass
  • Faker
  • Others
  • Alchemy
  1. Software Development
  2. Elixir

Libraries

PreviousMixNextCode Snippets

Last updated 2 years ago

Web Framework

Phoenix

Phoenix is a web development framework written in Elixir which implements the server-side Model View Controller (MVC) pattern. Many of its components and concepts will seem familiar to those of us with experience in other web frameworks like Ruby on Rails or Python's Django.

--

Database Management

Ecto

Ecto is split into 4 main components:

- repositories are wrappers around the data store. Via the repository, we can create, update, destroy and query existing entries. A repository needs an adapter and credentials to communicate to the database.

- schemas are used to map any data source into an Elixir struct. We will often use them to map tables into Elixir data but that's one of their use cases and not a requirement for using Ecto.

- changesets provide a way for developers to filter and cast external parameters, as well as a mechanism to track and validate changes before they are applied to your data.

- written in Elixir syntax, queries are used to retrieve information from a given repository. Queries in Ecto are secure, avoiding common problems like SQL Injection, while still being composable, allowing developers to build queries piece by piece instead of all at once.

--

Background Processing

Oban

Oban is a robust job processing library which uses PostgreSQL for storage and coordination.

Oban consists of three libraries.

    • Free - Distributed under Apache 2.0.

    • The core of the whole framework.

    • Provide the basic background processing features like priority queues, scheduled jobs, graceful shutdown, etc.

    • Commercial product.

    • Provide more sophisticated management like rate limiting, job encryption, etc.

    • Provide the canned solutions for batches, workflows, etc.

    • Commercial product.

    • Provide the web portal to monitor and manage the enqueued jobs.

Testing

Mock

Mock modules for testing purposes.

Hammox

Hammox is a library for rigorous unit testing using mocks, explicit behaviours and contract tests.

Use Hammox when the module to be mocked is an external module that implements a behaviour.

Bypass

Bypass provides a quick way to create a custom plug that can be put in place instead of an actual HTTP server to return prebaked responses to client requests.

Use Bypass when the module under test is the API client to integrate with the external HTTP service.

NOTE If the module under test is a wrapper of the API client, it is suggested to mock the API client by Mock or Hammox, instead of mocking the HTTP server directly.

Faker

Faker is a pure Elixir library for generating fake data.

Others

Alchemy

Safely perform refactoring experiments in production.

--

()

Refer to for the feature comparison.

--

Use Mock when the module to be mocked is an internal module, or does not implement a .

--

--

--

--

Phoenix
Ecto.Repo
Ecto.Schema
Ecto.Changeset
Ecto.Query
Ecto
Oban
Oban
Oban Pro
Oban Web
demo
the official website
Mock
behaviour
Hammox
Bypass
Faker
Alchemy