Giter Club home page Giter Club logo

minter-elixir's Introduction

Token Mint µService - Elixir

Very much a WIP for implementing the specs outlined in the main folder; a gRPC service using the given protobuf definitions and providing the given endpoints.

Elixir?

Elixir is a compiled, functional, concurrent, general-purpose programming language that runs on the Erlang virtual machine (BEAM). Elixir builds on top of Erlang and shares the same abstractions for building distributed, fault-tolerant applications. Elixir also provides a productive tooling and an extensible design. The latter is supported by compile-time metaprogramming with macros and polymorphism via protocols. ~ Wikipadia

Who is using it

Erlang is known for powering telecom (3g and LTE) and more recently made waves as the core of WhatsApp and previously Facebook Chat. Elixir is currently known to be powering Pinterest, Discord, and Pager Duty amongst others. Looking closer to home, Elixir is powering Flatiron School's web-based IDE, as well as WeWork's new Hot Desk backend.

Features of Elixir inherited from erlang include:

  • Distributed (OTP apps and distributed storage via mnesia)
  • Fault tolerant (light-weight processes are siloed and communicate via messages)
  • Soft real-time (not UDP packet-style fire-and-forget)
  • High availability (processes "fail-fast" and restart necessary components)
  • Hot swapping (can deploy to nodes without taking them down)

Elixir features:

  • Piping getValues() |> useValues() is equivalent to useValues(getValues()), making functional programming natural feeling.
  • Pattern-matching syntax {status, [first | rest], %{key: val}} = {:ok, [1,2,3], %{key: "Hello"}} binds status=:ok, first=1, rest=[2,3], val="Hello"
  • Polymorphism via protocols & behaviors

Setup

Elixir and Mix (rake-like tool) Setup

brew install elixir

Dependency/database setup (postgres)

mix deps.get
mix ecto.create
mix ecto.migrate

Application commands

# run all tests
mix test

# run test watcher, recompiles/runs on file changes
mix test.watch

# run grpc server
mix grpc.server

# run test client (which should respond correctly with "bad params" since the token doesn't exist in db yet)
mix run priv/client.exs

# format is elixir's built-in rubocop (.formatter.exs)
mix format

# run static analysis tools (uses @spec, @behavior, and @protocol)
mix dialyzer

Installation

If available in Hex (spoiler alert, it's not yet), the package can be installed by adding tokenmint to your list of dependencies in mix.exs:

def deps do
  [ {:tokenmint, "~> 0.1.0"} ]
end

TODO List 🤔

[.] Implement first endpoint (MintRefreshToken) [ ] Utilize json_web_token_ex to sign via ECDSA using P-256 and SHA-256 per DSS. [ ] Implement other endpoints [ ] Profit

Please reach out with any/all questions/comments/feedback!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.