All Projects → ghondar → crassa

ghondar / crassa

Licence: MIT license
Create React App Server Side Application

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
Handlebars
879 projects
HTML
75241 projects

Projects that are alternatives of or similar to crassa

Youtube React
A Youtube clone built in React, Redux, Redux-saga
Stars: ✭ 421 (+2531.25%)
Mutual labels:  redux-saga, create-react-app
Arc
React starter kit based on Atomic Design
Stars: ✭ 2,780 (+17275%)
Mutual labels:  redux-saga, universal
Patternfly React Demo App
DEPRECATED: This project is no longer active. See https://github.com/patternfly/patternfly-react-seed for PF4 demos.
Stars: ✭ 26 (+62.5%)
Mutual labels:  redux-saga, create-react-app
coincharts
Cryptocurrency Price Chart (GDAX)
Stars: ✭ 75 (+368.75%)
Mutual labels:  redux-saga, create-react-app
media-library
An online media library application with React, Redux and redux-saga
Stars: ✭ 27 (+68.75%)
Mutual labels:  redux-saga, create-react-app
create-react-redux-app
React boilerplate based on create-react-app
Stars: ✭ 49 (+206.25%)
Mutual labels:  redux-saga, create-react-app
Todo Redux Saga
Todo app with Create-React-App • React-Redux • Redux-Saga • Firebase • OAuth
Stars: ✭ 184 (+1050%)
Mutual labels:  redux-saga, create-react-app
React Boilerplate Cra Template
🔥 Setup Create React App with React Boilerplate. Highly scalable & Best DX & Performance Focused & Best practices.
Stars: ✭ 859 (+5268.75%)
Mutual labels:  redux-saga, create-react-app
webservices
Prestashop Web Services + React JS App
Stars: ✭ 34 (+112.5%)
Mutual labels:  redux-saga, create-react-app
react-redux-hackernews
React Redux Hackernews Application
Stars: ✭ 19 (+18.75%)
Mutual labels:  redux-saga, create-react-app
Sambell
wake me when it's quitting time
Stars: ✭ 101 (+531.25%)
Mutual labels:  create-react-app, universal
inside-client
Human Resources Department Tool. https://ifactory-solutions.github.io/inside-client/
Stars: ✭ 42 (+162.5%)
Mutual labels:  redux-saga, create-react-app
Apployees Nx
A collection of builders and extensions for the https://nx.dev monorepo tooling.
Stars: ✭ 43 (+168.75%)
Mutual labels:  create-react-app, universal
React Social Network
Simple React Social Network
Stars: ✭ 409 (+2456.25%)
Mutual labels:  redux-saga, create-react-app
Cra Universal
🌏 Create React App companion for universal app. No eject, auto SSR, zero config, full HMR, and more (inactive project)
Stars: ✭ 419 (+2518.75%)
Mutual labels:  create-react-app, universal
antonybudianto-web-old
Personal website
Stars: ✭ 14 (-12.5%)
Mutual labels:  create-react-app, universal
ts-ui
Telar Social Network using Reactjs
Stars: ✭ 35 (+118.75%)
Mutual labels:  redux-saga, create-react-app
marvel-jarvig
Marvel JARVIG (Just A Rather Very Interesting Game) is a game that lets you find and discover Marvel Comics characters based on their name, image and description!
Stars: ✭ 13 (-18.75%)
Mutual labels:  redux-saga, create-react-app
react-native-basekit
Basic setup for react-native projects using react-native , redux, redux-sagas, react-navigation
Stars: ✭ 16 (+0%)
Mutual labels:  redux-saga
react-firebase-template
Bootstrap a React + Firebase full stack application with every thing you need pre-configured: hosting, database, authentication, CI, Typescript, Material UI, PWA and other goodies.
Stars: ✭ 24 (+50%)
Mutual labels:  create-react-app

Create React App Server Side Application

🔋 A CLI tool to create React + Server Side with one command

This project is a fork of Crana

💡 To get up and running with an application with a node.js backend and a React frontend, just execute:

yarn global add crassa
crassa init <projectName> [projectFolder]

...and you are ready to go!

This will equip you with all important tools you're going to need to develop powerful applications, for example Live reaload for the server and the frontend out of the box. Webpack, Babel, ESLint, StyleLint, Nodemon etc. etc., all preconfigured out of the box, so that you can focus on the important stuff!

💻 Now start developing!

yarn dev

This will fire up the backend and the frontend development server. Just edit files under src and see what happens!

⚠️ Crassa is in early stage of development and may not meet all your requirements. That's why contributions of any kind are highly appreciated, as the best tools are built by communities!

RoadMap

  • Analize and crate paramater in crassa to generate templates
  • Create server templates
  • Migrate to plop library
  • Generate advance template
    • Create folder function with validation
    • Create file function
    • Create reduce index file template
    • Concate new reducer to index.js reducers file from project
    • Concate new takes to rootSaga
    • Create sagas file template
    • Create takes file template
  • Generate basic template
  • Update documentation

Usage

🆘 Show all crassa's commands.

crassa --help

Create a new crassa project.

crassa init <projectName> [projectFolderName]

💫 Concurrently starts the frontend and the backend in development mode.

yarn dev

📚 See how many LOC you've already written.

yarn count

🔍 Executes eslint and styleling in autofix mode.

yarn lint

🚗 Starts the project for production with server side.

yarn start

💫 Starts the project for production with server side with nodemon.

yarn start:dev

🚙 Creates a production build for the frontend application.

yarn build

Project structure

The interesting files for you are all located in the src folder. The src folder has three subfolders:

  • src
  • server

As you can imagine, the src folder contains all files for the React frontend application and the server folder contains all files for the node.js backend.

Custom Template

You'll be able create custom template from github to generate your initial project: Github repository structure like:

.
└── template
    ├── nodemon.json
    ├── public
    │   ├── favicon.ico
    │   ├── index.html
    │   └── manifest.json
    ├── server
    │   ├── index.js
    │   └── v1
    │       ├── counter
    │       │   └── index.js
    │       └── index.js
    └── src
        ├── App.js
        ├── App.test.js
        ├── components
        │   └── Common
        │       └── Loading.js
        ├── containers
        │   ├── Dashboard.js
        │   ├── DevTools.js
        │   ├── Root.dev.js
        │   ├── Root.js
        │   └── Root.prod.js
        ├── index.js
        ├── lib
        │   └── Request.js
        ├── reducers
        │   ├── base.js
        │   ├── counter.js
        │   └── index.js
        ├── registerServiceWorker.js
        ├── routes
        │   └── index.js
        ├── sagas
        │   ├── counter.js
        │   └── index.js
        ├── setupProxy.js
        └── store
            ├── configureStore.dev.js
            ├── configureStore.js
            └── configureStore.prod.js
├── .gitignore
├── .npmrc
└── package.json

Where package.json basically it must have name and displayName tag with {-- project-name --} and crassa with version tag {-- project-version --} like this:

{
    "name": "{-- project-name --}",
    ...
    "crassa": {
        "displayName": "{-- project-name --}",
    },
    ...
    "dependencies": {
        "crassa":  "{-- project-version --}",
        ...
    },
    ...
}

You can put your git when crassa cli ask you to choose between next or custom template, the url mus to have this structure:

  • ghondar/counter-with-redux-ducks-and-sagas-template
  • grovertb/crasa-template-antd
  • grovertb/crasa-template-material-ui

Environments

You can configure the project environment variables

  > REACT_APP_PORT_SERVER=5000 // Port of server this is optional 
  > REACT_APP_REST_API_LOCATION=http://localhost:5000 // Domain the server application
  > REACT_APP_API_VERSION=v1 // Api version for default is v1
  > BODY_PARSER_LIMIT=10mb // Configure size limit body-parser

Extensions

Here (server folder) you can extend universal middleware creating preLoadState.js file to dispatch action from server to load initial state into redux store.

Example: (/server/preLoadState.js)

import counterDuck from 'reducers/counter'

export default function(req, res, next) {
  // Get store from locals
  const { store } = res.locals
  // Show local resources
  console.log(res.locals)
  // Dispatch a action to change initial state
  store.dispatch(counterDuck.creators.addCount())
  // Resave new store
  res.locals.store = store
  // Pass middlerware
  next()
}

Here (server folder) you can get the html created in universal.js to modify the initial load of DOM or wrapping your app src react project.

Example: (/server/universal.js)

import { renderToString } from 'react-dom/server'

export const setRenderUniversal = (locals, app, extractor) => {
    const { htmlData } = locals // htmlData, store, history
    
    // store => access to store ( redux )
    // extractor.getStyleTags() => access to styles of the app

    const renderString = renderToString(app) // wrapping optional

    const style = `
      <style id='css-server-side' type="text/css">
        html { margin:0px; padding:0px }
      </style>
    `

  return {
    prevHtml: html.replace('<head>', `<head>${style}`),
    renderString // optional
  }
}

We handle initial configuration here adding babel plugins (transform-imports, loadable-components and transform-react-remove-prop-types) and webpack alias (basic alias from package.json) but you can extend this initial configuration adding to your root project config-overrides.js file.

Example: (/configExpress.js)

import express from 'express'
import session from 'express-session'
import { resolve } from 'path'

export default function(app) {
  app.use(
    session({
      secret           : 'Cr4ss4',
      resave           : true,
      saveUninitialized: true
    })
  )

  app.use('/src', express.static(resolve(__dirname, './static')))
   
  return app
}

With configExpress.js you can add configurations to express, like statics, uses or add web sockets too.

Example: (/config-overrides.js)

const { override, addWebpackAlias, addBundleVisualizer } = require('customize-cra')

module.exports = override(
  process.env.BUNDLE_VISUALIZE == 1 && addBundleVisualizer()
)

Technologies

As soon as you bootstrapped a new project, you have an application running with:

Under the hood it uses Webpack, Babel, ESLint with a few other plugins enabling a powerful development workflow.

Known constraints/issues

Windows Linux Subsystem

If you're using Windows Linux Subsystem, eslint will not immediatly work. You need to edit the path under .vscode/settings.json. Replace C:/mnt/c with C: and it should work.

Contributing

Have a look at CONTRIBUTING.md

Code of conduct

Have a look at CODE_OF_CONDUCT.md

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].