/elixir_app_gen

Config as code generation for elixir applications

Primary LanguageElixirMIT LicenseMIT

AppGen

This tool generates various parts of our elixir applications to simplify our workflows.

Generators

  • Absinthe API & Tests
  • Ecto Schema
  • Ecto Context, Factories & Tests
  • State Diff and Regeneration
  • Typespecs for all files
  • Phoenix Application++ (prometheus/sentry)
    • no_phx - Skip phx.new generation (back-add this to already generated project)
    • absinthe - Pulls in absinthe dependency and sets it up in router.ex & endpoint.ex
    • no_prometheus - By default prometheus and exporter config will be setup with basic metrics
    • no_sentry - By default prometheus and exporter config will be setup with basic metrics
    • no_libcluster - By default libcluster setup will be installed and dependency imported
    • no_config_mod - By default a config.ex module will be installed to gatekeep access to app env config
    • no_cors - By default Corsica is installed into the endpoint.exs
    • no_log_hide - By default we remove 200 logs to save log space in prod
  • State Transitions
  • Logic Nodes
  • Logic Gateways

Installation

Available in Hex, the package can be installed by adding app_gen to your list of dependencies in mix.exs:

def deps do
  [
    {:app_gen, "~> 0.1.0", only: [:dev, :test]}
  ]
end

The docs can be found at https://hexdocs.pm/app_gen.

Example

Checkout app_gen.exs for an example

Available Mix Commands

mix app_gen          # Lists help for app_gen commands
mix app_gen.api      # Utilizes all the config files and generates a GraphQL API
mix app_gen.context  # Creates a ecto context with functions from EctoShorts as well as tests
mix app_gen.resource # Used to create app_gen.exs files or to add new CRUD resources in
mix app_gen.schema   # Creates a ecto schema that has a factory
mix app_gen.phx.new  # Create a new phx project, replaces `mix phx.new`