An API template build with Plain Old Ruby.
This template aims to deliver a small starting point for building a Ruby API:
- rack
- Puma
- Grape
- Swagger (Open API)
- MiniTest
It's fully customizable, and can be extended in anyway you want.
Pull the source code from the repository:
git clone git@github.com:jveillet/ruby-api-template.git
Local install:
bundle install
Docker install:
docker compose build
Use the example .env
file, and change the variables to your linking:
cp .env.template .env
Local exec:
bundle exec puma -p $PORT # Assuming $PORT is set
Docker exec:
docker compose up
curl --request GET \
--url http://localhost:3000/api/v1/ping \
--header 'Accept-Encoding: deflate, gzip;q=1.0, *;q=0.5' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost'
Thank you for thinking about contributing! Contributors are always welcome! 👍
There is no wrong way to contribute, and there are many ways you can participate:
- Writing documentation
- Squashing bugs
- Implementing new features
- Adding or updating tests
- Suggesting new features or things to improve
If you find bugs, first go to the issues page and search if a related issue isn't already listed there. Otherwise, feel free to create new ones 😎.
Create a new issue and include any informations that can help to reproduce the observed behavior:
- Stack trace
- Expected bahevior
- Current behavior
- OS / Browser
Consider adding the bug label on your ticket.
Create a new issue on the issues page and add a clear description of what the new feature should look like.
Consider adding the feature request label on your ticket.
- Fork the project
https://github.com/jveillet/ruby-api-template/fork
- Clone your fork
git clone https://github.com/$YOUR_USERNAME/ruby-api-template && cd ruby-api-template
- Create new branch
git checkout -b feature/issue_number
- Make your changes, and commit
git commit -am "[feature/issue_number] your commit message"
- Push your changes to origin!
(replace issue_number
with the related issue number ex: feature/1)
bundle exec rake test
# OR
docker compose run --rm web bundle exec rake test
Tests are located under the test/
folder.