Giter Site home page Giter Site logo

bellizio / rails-react-vite Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 5.63 MB

A sandbox application for exploring the capabilities of Rails + React + Vite

Ruby 61.43% JavaScript 14.28% CSS 1.95% TypeScript 4.84% SCSS 0.98% HTML 16.33% Shell 0.19%

rails-react-vite's Introduction

Rails + React + Vite

A sandbox application for exploring how Vite can be used to develop & build Rails with React applications.

The app uses the Vite Ruby, which acts as the 'glue' between the React view layer and the Rails view layer.

Getting Started

  1. Install Node >= 16
  2. Install Ruby 3.1.1
  3. gem install bundler
  4. brew install postgresql
  5. npm install
  6. bundle install
  7. rails db:seed

Scripts

Run the following commands to start the app:

  1. rails s - starts the Rails server
  2. npm start - starts the Vite dev server

Front-end

All front-end related code lives under app/frontend.

Apps

The apps directory contains client-side React apps, which correspond to the entrypoints.

Components

The components directory contains any React components that may be used in the apps or pages.

Entrypoints

The entrypoints directory contains entries to the apps. These are what the Rails views essentially point to, and what Rails renders when a respective route is hit. More info on entrypoints can be found here.

Pages

The pages directory contains client-side React pages, which are used in the client-side routing config of the React apps.

Routes

For demonstration purposes, there is a mix of Rails routes and React routes. Each Rails route corresponds to a separate React app, which can define its own routing on the client-side.

Rails Routes

  • /
  • /help
  • /browse

React Routes

  • /help/account-settings

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.