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

https://github.com/datacite/lupo

DataCite REST API
https://github.com/datacite/lupo

doi graphql jsonapi lupo rails-api ruby

Last synced: about 1 month ago
JSON representation

DataCite REST API

Awesome Lists containing this project

README

          

# DataCite REST API

[![Identifier](https://img.shields.io/badge/doi-10.5438%2F8gb0--v673-fca709.svg)](https://doi.org/10.5438/8gb0-v673)
![Release](https://github.com/datacite/lupo/workflows/Release/badge.svg)
[![Maintainability](https://api.codeclimate.com/v1/badges/dddd95f9f6f354b7af93/maintainability)](https://codeclimate.com/github/datacite/lupo/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/dddd95f9f6f354b7af93/test_coverage)](https://codeclimate.com/github/datacite/lupo/test_coverage)

Rails API application for managing DataCite providers, clients, prefixes and DOIs. The API uses the [JSONAPI](http://jsonapi.org/) specification.

## Key Concepts

* **Provider**: An organization that manages clients (e.g., a university or research institute).
* **Client**: A data center or repository that registers DOIs.
* **DOI**: Digital Object Identifier, the core entity managed by the system.
* **Prefix**: DOIs are assigned within a prefix (e.g., 10.1234).

## Tech Stack

* Ruby on Rails
* MySQL
* OpenSearch (Elasticsearch)
* Memcached
* S3 compatible storage (Minio in dev and test)
* Shoryuken (AWS SQS) for Background Jobs
* Inline Background Jobs in development and test environments

## Development

We use Docker Compose for development to ensure a consistent environment.

### Project Structure

* `app/graphql`: GraphQL schema, types, mutations, and resolvers.
* `app/models`: Core domain logic (Provider, Client, Doi, etc.).
* `app/jobs`: Background jobs (Shoryuken).
* `app/serializers`: JSONAPI serializers.
* `app/controllers`: API controllers.

### Prerequisites

* Docker
* Docker Compose

### Configuration

You do not need a complicated `.env` file to get started. Reasonable defaults are set for both development and test environments and are loaded automatically by Rails. You can start with an empty `.env` file or override specific values as needed.

### Starting the Application

To build and start the application and its dependencies:

```bash
docker-compose -f docker-compose.yml -f docker-compose.local.yml up --build
```

### Database Setup

Once the containers are running, you can set up the database (create, schema load, seed):

```bash
docker-compose exec web bundle exec rake db:setup RAILS_ENV=development
```
### Accessing the Application

The application will be available at `http://localhost:8065`.

Useful endpoints to visit include:
* `http://localhost:8065/dois`
* `http://localhost:8065/clients`

### Running Tests

To run the entire test suite:

```bash
docker-compose exec web bundle exec rspec
```

To run a specific test file:

```bash
docker-compose exec web bundle exec rspec spec/models/doi_spec.rb
```

To run a specific test at a specific line:

```bash
docker-compose exec web bundle exec rspec spec/models/doi_spec.rb:10
```

### Linting and Checking

To run code linting:

```bash
docker-compose exec web bundle exec rubocop
```

To run security checks:

```bash
docker-compose exec web bundle exec brakeman
```

To check for vulnerable gem versions:

```bash
docker-compose exec web bundle exec bundle-audit check --update
```

### Rails Console

To access the Rails console:

```bash
docker-compose exec web env DISABLE_SPRING=true bundle exec rails console
```

Alternatively, you can open a shell inside the container to run commands:

```bash
docker-compose exec web bash
```

Follow along via [Github Issues](https://github.com/datacite/lupo/issues).

### Note on Patches/Pull Requests

- Fork the project.
- Write tests for your new feature or a test that reproduces a bug.
- Implement your feature or make a bug fix.
- Do not mess with Rakefile, version or history.
- Commit, push and make a pull request. Bonus points for topical branches.

## License

**Lupo** is released under the [MIT License](https://github.com/datacite/lupo/blob/master/LICENSE).