ruby-rails-boilerplate
ruby-rails-boilerplate copied to clipboard
A modular, high performance, headless e-commerce platform built with Ruby, GraphQL, RESTful, Rails, and React.
Rails REST API boilerplate 🇻🇳
Description
Rails REST API boilerplate for typical project
Table of Contents
- Features
- Quick run
- Comfortable development
- Links
- Automatic update of dependencies
- Database utils
- Tests
Features
- [x] Database (activerecord).
- [x] Seeding.
- [x] Config Service (rails/config).
- [x] Mailing (activemail).
- [x] Sign in and sign up via email.
- [x] Social sign in (Apple, Facebook, Google, Twitter).
- [x] Admin and User roles.
- [x] I18N (rails-i18n).
- [x] File uploads. Support local and Amazon S3 drivers.
- [x] Swagger.
- [x] E2E and units tests.
- [x] Docker.
- [x] CI (Github Actions).
Quick run
git clone --depth 1 [email protected]:maearon/rails-boilerplate.git my-app
cd my-app/
cp env-example .env
docker compose up -d
For check status run
docker compose logs
Comfortable development
git clone --depth 1 https://github.com/brocoders/nestjs-boilerplate.git my-app
cd my-app/
cp env-example .env
Change DATABASE_HOST=postgres
to DATABASE_HOST=localhost
Change MAIL_HOST=maildev
to MAIL_HOST=localhost
Run additional container:
docker compose up -d postgres redis
bundle
rails db:migrate
rails db:seed
rails s
Links
- Routes: http://localhost:3000/rails/info/routes
- Adminer (client for DB): http://127.0.0.1/pgadmin4/browser/
- Maildev: http://localhost:3000/letter_opener
Automatic update of dependencies
If you want to automatically update dependencies, you can connect Depfu for your project.
Database utils
Generate migration
rails generate migration CreateNameTable
Run migration
rails db:migrate
Revert migration
rails db:migrate:reset
Drop all tables in database
rails db:drop
Run seed
rails db:seed
Tests
# unit tests
rails t
# e2e tests
./node_modules/.bin/cypress run
Tests in Docker
docker compose -f docker-compose.ci.yaml --env-file env-example -p ci up --build --exit-code-from api && docker compose -p ci rm -svf
Test benchmarking
docker run --rm jordi/ab -n 100 -c 100 -T application/json -H "Authorization: Bearer USER_TOKEN" -v 2 http://<server_ip>:3000/api/v1/users