All Projects → chadfurman → Rpg Boilerplate

chadfurman / Rpg Boilerplate

Relay (React), Postgres, and Graphile (GraphQL): A Modern Frontend and API Boilerplate

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Rpg Boilerplate

React App
Create React App with server-side code support
Stars: ✭ 614 (+890.32%)
Mutual labels:  graphql, relay, webpack, ssr, server-side-rendering
React Firebase Starter
Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay
Stars: ✭ 4,366 (+6941.94%)
Mutual labels:  graphql, relay, postgresql, ssr, server-side-rendering
Reactql
Universal React+GraphQL starter kit: React 16, Apollo 2, MobX, Emotion, Webpack 4, GraphQL Code Generator, React Router 4, PostCSS, SSR
Stars: ✭ 1,833 (+2856.45%)
Mutual labels:  graphql, webpack, ssr, server-side-rendering
Ssr Sample
A minimum sample of Server-Side-Rendering, Single-Page-Application and Progressive Web App
Stars: ✭ 285 (+359.68%)
Mutual labels:  graphql, webpack, ssr, server-side-rendering
React Starter Kit
React Starter Kit — front-end starter kit using React, Relay, GraphQL, and JAM stack architecture
Stars: ✭ 21,060 (+33867.74%)
Mutual labels:  graphql, webpack, ssr, relay
Node Pg Migrate
Node.js database migration management for Postgresql
Stars: ✭ 838 (+1251.61%)
Mutual labels:  sql, migrations, postgresql, postgres
Crate
👕 👖 📦 A sample web and mobile application built with Node, Express, React, React Native, Redux and GraphQL. Very basic replica of stitchfix.com / krate.in (allows users to get monthly subscription of trendy clothes and accessories).
Stars: ✭ 2,281 (+3579.03%)
Mutual labels:  graphql, webpack, ssr, server-side-rendering
Graphql Starter
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, and Material UI.
Stars: ✭ 3,377 (+5346.77%)
Mutual labels:  graphql, postgresql, postgres, relay
Beam
A type-safe, non-TH Haskell SQL library and ORM
Stars: ✭ 454 (+632.26%)
Mutual labels:  sql, postgresql, postgres
Openrecord
Make ORMs great again!
Stars: ✭ 474 (+664.52%)
Mutual labels:  graphql, sql, postgresql
Scala Db Codegen
Scala code/boilerplate generator from a db schema
Stars: ✭ 49 (-20.97%)
Mutual labels:  sql, postgresql, postgres
Universal Starter
Angular 9 Universal repo with many features
Stars: ✭ 518 (+735.48%)
Mutual labels:  webpack, ssr, server-side-rendering
React Imported Component
✂️📦Bundler-independent solution for SSR-friendly code-splitting
Stars: ✭ 525 (+746.77%)
Mutual labels:  webpack, ssr, server-side-rendering
Loadable Components
The recommended Code Splitting library for React ✂️✨
Stars: ✭ 6,194 (+9890.32%)
Mutual labels:  webpack, ssr, server-side-rendering
Citus
Distributed PostgreSQL as an extension
Stars: ✭ 5,580 (+8900%)
Mutual labels:  sql, postgresql, postgres
React Router Server
Server Side Rendering library for React Router v4.
Stars: ✭ 443 (+614.52%)
Mutual labels:  webpack, ssr, server-side-rendering
After.js
Next.js-like framework for server-rendered React apps built with React Router
Stars: ✭ 4,051 (+6433.87%)
Mutual labels:  webpack, ssr, server-side-rendering
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 7,712 (+12338.71%)
Mutual labels:  sql, migrations, postgres
Efcore.pg
Entity Framework Core provider for PostgreSQL
Stars: ✭ 838 (+1251.61%)
Mutual labels:  sql, postgresql, postgres
Niklick
Rails Versioned API solution template for hipsters! (Ruby, Ruby on Rails, REST API, GraphQL, Docker, RSpec, Devise, Postgress DB)
Stars: ✭ 39 (-37.1%)
Mutual labels:  graphql, postgresql, postgres

RPG Boilerplate

Relay, PostgreSQL, Graphile (GraphQL)

Danger: This boilerplate is outdated and should only be used for inspiration

There is an effort underway to revamp the boilerplate, and you can contribute to the new boilerplate here: https://github.com/clevertech/boilerplate/tree/rpg-next

A Modern Frontend and API Boilerplate

This boilerplate provides a starting point for developers, especially the community of Postgraphile developers, to build applications powered by Relay Modern.

GraphQL and Relay Modern allow fast, modular apps. For more on how they work, check out the respective links.


Requirements

Things to change

  • copy rpg-boilerplate/example_docker-compose.yml to rpg-boilerplate/docker-compose.yml
  • Set the secrets in the docker-compose.yml file
  • copy api/env_example to api/.env
  • Set the secret in api/.env
  • copy the frontend/example_certs and api/example_certs to frontend/certs and api/certs respectively
  • Re-generate the frontend/certs and api/certs:
# to regenerate the certs:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout rpg-boilerplate/frontend/certs/cert.key -out rpg-boilerplate/frontend/certs/cert.crt
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout rpg-boilerplate/api/certs/cert.key -out rpg-boilerplate/api/certs/cert.crt

Note: you'll likely want to explore the components and views to implement further changes. See below for tips on development using this boilerplate

Installation

# clone down the code
git clone https://github.com/chadfurman/rpg-boilerplate.git

# enter into the folder
cd rpg-boilerplate

# install dependencies
yarn install

# start docker to prep db
cd rpg-boilerplate && docker/run.sh

# after db init runs, docker will hang -- this is fine pending the next step
# in a new terminal, deploy migrations to db
cd rpg-boilerplate/db && sqitch deploy

# once migrations finish, ctrl-c docker-compose:
# you can now re-run when you are ready and everything should work
cd rpg-boilerplate && docker/run.sh

# navigate to https://localhost:3001/graphiql to verify API running
# navigate to https://localhost:3000/ to verify front-end running

Running

# Start the app
cd rpg-boilerplate
docker/run.sh

Note: The API and the Frontend SSR server both use HTTPS -- there should be a redirect, but at the moment it's not working. ** MAKE SURE YOU USE HTTPS ** :)

Development

Overview

The application is divided into three primary directories: /api, /frontend, and /db

The /api folder contains the src of our GraphQL api -- if you look, you'll notice it simply attaches postgraphile and passes in our config from api/.env

the /db folder is interesting in that it contains the migrations (i.e. db/deploy / db/revert) and the sqitch.conf/sqitch.plan files

The frontend folder is further divided into three main parts:

  • client is the code that renders in the browser w/o the SSR server
  • server is the code that runs on the SSR server
  • shared is the code that runs on both, and is responsible for the UI of the website.

NOTE: Given that the frontend client and server folders are pretty barren and the code therein is somewhat straight-forward, they do not require much explanation. Take a look and see :)

Shared Folder

The shared folder is broken up as follows:

  • components - these are the bulk of the UI elements of the site. Each component stores its own stylesheet, images, JavaScript, and data dependency declarations
  • relay - houses the apiManager (sets/cancels our JWT during transit) and all of our mutations (queries are built into the components)
  • routes - Each route file must be manually linked in routes.js -- more on routes below.
  • templates - These are the general skeleton elements that multiple views will share
  • theme - this folder contains global assets (like a background, not like a logo), and global CSS (reset rules, utility styles, scss variabls)
  • views - these are the root component rendered for a route. Each route has a view. Each view is used by only one route. Reusable aspects of views should be components.
  • App.js - This separates public and private routes from eachother, querying for the currentProfile to determine if we're logged in or not.
  • BaseError.js - An extensible error class
  • routes.js - exports an array of imported route files to be matched by the SSR server and iterated over in App.js

How to add a new route

TODO

How to add a new mutation

TODO

How to add a new component

TODO

How to add a new view

TODO

How to add a new migration

TODO

How to rework an existing migration

TODO

How to extend the GraphQL API

TODO

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].