Home

Awesome

<a href="https://ibb.co/cuWEim"><img width="100%" src="https://preview.ibb.co/kkCy9R/project_logo.png" alt="project_logo" border="0"></a>

Build Status Conventional Commits

A project to learn a lot of tecnologies and build something awesome and great inspired on Medium the blog website.

You can use this API to create your own front end to study new frameworks of stacks.

You can inspect the API in Graphiql in the url: http://localhost:3000/graphiql

<p align="center"> <img width="650px" src="https://user-images.githubusercontent.com/12489333/253039348-17477d43-0903-49b3-81c5-4d6b91a05eb9.png"> </p>

Getting Started

The easy way to start is to clone this repo, read the prerequisites and then get a Ruby package manager to install everything. We recommend rbenv or RVM to handler this task.

Prerequisites

Installing

Get only one package manager and install Ruby depending of your choice

$ rbenv install 2.4.2
$ rvm install 2.4.2

Then follow the next instrucctions:

  1. Integrate bundler :
$ gem install bundler
  1. Go to the Project's directory and install all the dependencies with:
$ bundle install
  1. Configurate the Data Base with:
$ rails db:schema:load && rails db:seed

Docker Compose

Resource: https://www.digitalocean.com/community/tutorials/containerizing-a-ruby-on-rails-application-for-development-with-docker-compose

$ docker-compose up -d
$ docker-compose exec app bundle exec rake db:setup db:migrate db:seed

How to build the Dockerfile without Docker Compose

$ docker run --name database_for_ruby -e POSTGRES_DB=medium_graphql -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:9.4
$ docker build . -t ruby && docker run --env-file ./.env -p 3000:3000 --link database_for_ruby ruby -t ruby_graphql_backend

Check http://localhost:3000/graphiql

Built With

You can build your own front end, some ideas:

GraphQL Mutations and Queries:

GraphQL MutationDescription
addOrRemovePostsToCollectionAdd or remove posts from a collection based on the provided post IDs.
addOrRemoveTagsToPostAdd or remove tags from a post based on the provided tag IDs.
createBookmarkCreate a bookmark to save a post for later reading.
createClapAdd claps to a post with the specified number of claps.
createCollectionCreate a collection and add posts to it.
createCommentCreate a comment on a post.
createPostCreate a new post with the specified title, body, picture, topic, and tags.
createUserCreate a new user with the provided username, first name, last name, bio, picture, and credentials.
deleteBookmarkPermanently delete a bookmark with the provided ID.
deleteCollectionPermanently delete a collection with the provided ID.
deleteCommentPermanently delete a comment with the provided ID.
deletePostPermanently delete a post with the provided ID.
editCollectionEdit the title, description, and/or picture of a collection.
editCommentEdit the body of a comment.
editPostEdit the title, body, picture, and/or topic of a post.
refreshPasswordUpdate the password using an email, password, and token for password recovery.
signInUserAuthenticate a user using email and password and retrieve a token.
updateTokenUpdate the token for password recovery using the email.
GraphQL QueryDescription
allCollectionsGet all collections based on the provided filter.
allPostsGet all posts based on the provided filter.
allTagsGet all tags based on the provided filter.
allTopicsGet all topics.
allUsersGet all users based on the provided filter.
searchBookmarkSearch for a bookmark with the provided ID.
searchCollectionSearch for a collection with the provided ID.
searchCommentSearch for a comment with the provided ID.
searchPostSearch for a post with the provided ID.
searchTopicSearch for a topic with the provided ID.
searchUserSearch for a user with the provided ID or username.

Project Status

Backend ready to use, tested. But you can improve this, some ideas: