Skip to content

A working example of a Grape API mounted alongside Rails app that uses Trailblazer with Service Object Pattern / DDD.

Notifications You must be signed in to change notification settings

yunanhelmy/minicommerce

Repository files navigation

Minicommerce

A working example of a Grape API mounted alongside Rails app that uses Trailblazer with Service Object Pattern / DDD.

Stacks

  • Rails
  • Grape
  • Trailblazer

Dependencies

  • PostgreSQL
  • Elasticsearch

Pattern

Model

Using default model directory app/models from Rails. Handle primitive database only.

Repository

In directory app/concepts/*/repository. Handle any persistent transaction.

Contract

In directory app/concepts/*/contract. Handle any use case validation.

Entity

In directory app/concepts/*/entity. Handle response to endpoint.

Operation

In directory app/concepts/*/operation. Handle use case / business process.

Policy

In directory app/concepts/*/policy. Handle user permission to use case.

Endpoint

In directory app/controllers/API. Handle endpoint API.

Playing Around

  1. Clone the repository
  2. bundle install
  3. rake db:create
  4. rake db:migrate
  5. rake db:seed
  6. rails s
  7. Check swagger doc on http://localhost:3000/doc
  8. Go to Auth and then click Explore button
  9. Generate token
  10. Use the token to play around in main API

Test

  • rake db:test:prepare
  • rspec

The Boring Legal Things

Copyright

Use whatever you wish if this repository inspire you

About

A working example of a Grape API mounted alongside Rails app that uses Trailblazer with Service Object Pattern / DDD.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published