Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ivanshamatov/automagically

Micro framework to build API with UI
https://github.com/ivanshamatov/automagically

Last synced: about 1 month ago
JSON representation

Micro framework to build API with UI

Awesome Lists containing this project

README

        

# Automagically
Micro-framework to build API for your frontend app and simple admin to be able to store some content. Works automagically.
UNDER CONSTRUCTION. Read the story in progress `https://medium.com/@wi11son`
---
## Why do you need this?
Inpired by:
* sinatra + padrino
* grape
* goliath
* active_model_serializer
* active_admin + rails_admin
* and rails of couse

Yep, there are bunch of solutions how to create backend for SPA or simple website. In most cases you just use Sinatra if you need simple backend processing, or Grape if you need API. You can even use Padrino to have backend with generators and create some code and get Admin panel. Finally you can create `rails --api` now to create really simple api+DB using active_model_serializer and one of gems to generate admin panel.

But what if you want:
* simplicity of sinatra (like routes driven framework)
* simplicity of Grape to generate API mostly for frontend app,
* still have to use database to get out some information like rails ActiveRecord
* need a restricted area like autogenerated padrino-admin/rails_admin/active_admin, where you can put some data inside database through UI
* and it should be really light solution

Each of these frameworks can do the parts, but there is no one, who can fulfill everything. That's why I will try to implement that in `automagically`.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'automagically'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install automagically

## Quick start

```ruby
require 'automagically'
route :reports, Report.all
```

It means that you can make a `GET /reports` request and it will respond you with a collection of reports like:

```json
{
"reports": [
{
"title": "First one",
"author": "Kent Willson"
},
{
"title": "Report last",
"author": "Maria Brown"
}
]
}
```

More than that, it will give you access to CRUD your model via admin panel.
`/admin/reports` is really heavy because it's gonna be frontend app, which will use api to create/edit and store data.

## Restrictions

Yep, first of all there should be a bunch of restrictions, so then you have to use other instuments and don't use `automagically` when it is not appropriate. For example
Don't use `automagically`:
* when you need complex data processing on backend. It is not for processing, but just giveback some JSON.
* ...

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).