Coder Social home page Coder Social logo

Rails REST API + NextJS boilerplate 🇻🇳

Description

Rails REST API boilerplate for typical project can connect and interact with Posgres default by Prisma

Table of Contents

Features

  • Database (activerecord).
  • Seeding.
  • Config Service (rails/config).
  • Mailing (activemail).
  • Sign in and sign up via email.
  • Social sign in (Apple, Facebook, Google, Twitter).
  • Admin and User roles.
  • I18N (rails-i18n).
  • File uploads. Support local and Amazon S3 drivers.
  • Swagger.
  • E2E and units tests.
  • Docker.
  • 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
cp client/env-example client/.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:drop

cd client &&
npx prisma generate && 
npx prisma migrate dev (rails db:migrate)

manhpc@manhpc-B660M-D3H-DDR4:~/code/ruby-rails-boilerplate/client$ npx prisma migrate dev
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "verceldb", schema "public" at "ep-bold-voice-a4yp8xc9.us-east-1.aws.neon.tech:5432"

Applying migration `20240722050134_ruby_rails_boilerplate_development`

The following migration(s) have been applied:

migrations/
  └─ 20240722050134_ruby_rails_boilerplate_development/
    └─ migration.sql



Your database is now in sync with your schema.

Running generate... (Use --skip-generate to skip the generators)

✔ Generated Prisma Client (v5.17.0) to ./node_modules/@prisma/client in 130ms


manhpc@manhpc-B660M-D3H-DDR4:~/code/ruby-rails-boilerplate/client$ 
 1953  git checkout 6757f51096580846978602258ea87eabee204ef2 -- Dockerfile
 1954  git status
 1955  git checkout 6757f51096580846978602258ea87eabee204ef2 -- docker-compose.yml


rails db:seed (prisma introspect && npx prisma db pull && npx prisma db push)
cd ..
rails s -p 3001
(git checkout 1242dc57c527178d6bffd6980c884ba4478bafd4 -- db/migrate)
(rails status code symbol: https://gist.github.com/mlanett/a31c340b132ddefa9cca)

Links

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>:3001/api/v1/users

mark's Projects

api icon api

https://railstutorialapi.onrender.com/api

bugbook icon bugbook

Mobile: Expo React Native https://github.com/maearon/bugbook Web1: Next 15 Social Media use Prisma Postgres https://ruby-rails-boilerplate.vercel.app/ Web2: https://github.com/maearon/FunnyMovies Web3: https://github.com/maearon/next-js-boilerplate Backend1: https://github.com/maearon/api Backend2: https://ruby-rails-boilerplate-3s9t.onrender.com

eshoponcontainers icon eshoponcontainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 6, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor.

flappy_bird icon flappy_bird

https://react-flappy-bird-fun-b4e80619815d.herokuapp.com

generator-jhipster icon generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.

hust icon hust

CS 500 at BachKhoa University (HUST) https://lab.soict.hust.edu.vn/login/index.php

java-springboot-boilerplate icon java-springboot-boilerplate

🌙 SpringBoot2(Java)の学習用サンプルアプリケーションです。SpringBootを初めて学習してみたい方、Dockerを利用したJavaの開発環境を構築したい方、ECサイトを学習してみたい方、管理画面も作成(マルチログイン)を作成したい方、Stripeを利用した決算処理を作成してみたい方、ソーシャルログインを作成してみたい方、オブジェクトストレージへの画像アップロードを作成してみたい方、フロントエンドをReactで作成してみたい方にオススメです。

laravel-nuxt icon laravel-nuxt

NUXT + Laravel only API app use Postgres https://medium.com/@web-artisan/laravel-11-and-nuxt-js-3-boilerplate-4a61bf69c84a

micro icon micro

An API first development platform

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.