Skip to content

davidkelley/showcase

Repository files navigation

Showcase

This micro API is for demonstration purposes only.

I have built this opinionated micro API as a demonstration of a micro service running inside an Alpine Linux hardened container with grsec configured, locked down permissions and suid files removed.

It is built to be lightweight, fast and easily expandable, by providing eased interactivity through GraphQL, which can easily be incorporated into many different projects.

dry-rb are a set of libraries that are actively being worked on to provide solid implementation for emergent (and already well-established) behaviors inside Ruby. This demonstration API implements domain-level, isolated, modular-based classes (with Application[...] accessors) which are eager loaded at runtime, utilizing only very basic require and $LOAD_PATH logic. System dependencies or bulky third-party libraries are loaded "when required" to ensure that application overheads remain as low as possible.

ROM removes "persistence" coupling from inside domain objects, helping to ensure that data persistence and any accompanying business logic remain strictly de-coupled. Data is persisted to specific stores using adapters standardized with well-defined interfaces.

Roda provides a fast, closure-style routing tree framework that provides simple syntactical sugar as a thin layer on top of Rack. However, it is not extensively used in this showcase as the implementation of GraphQL means that only one endpoint is required.

Development

Development takes place in Docker (using docker-compose). Guard is setup to restart the server (using the tmp_restart plugin in Puma), test and run code analyses whenever a change is detected.

Testing

RSpec, Rubocop and Reek are also setup to ensure code is up to standard. Coveralls provides test coverage analysis and Airborne is ensuring that any API remain easily testable. GraphQL can be tested in isolation to ensure that schema definitions are functioning correctly.

The API is based on a few key gems:

Gem Stars Summary
puma ⭐️ 4,526 A fast, concurrent web server for Ruby
dry-rb ⭐️ ~500 Container-based, logical encapsulation for modular applications.
roda ⭐️ 679 Super-lightweight routing framework
graphql ⭐️ 1,378 Solid implementation of GraphQL inside Ruby, with support for Relay
rom ⭐️ 1,323 Super fast, modular-based persistence, type and mapping toolkit.

About

Example demonstration microservice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages