Git Product home page Git Product logo

react-redux-webpack-meteor's Introduction

Demo: React, Webpack, Redux and Meteor as a backend only

Sorry, project is not maintained anymore. But it is a very good example of the topic. Check out #9 for more info.

You can read article about it:

This is just a standard React - Redux app based on my boilerplate. It uses Meteor, but only as a backend. So you need to run both apps.

This is really awesome that I needed only one file to create realtime backend for a custom React app! Thanks to Meteor!

How to start:

  • if you don't have Meteor install it: curl https://install.meteor.com/ | sh
  • clone the repo
  • cd react-redux-webpack-meteor
  • npm install
  • npm start (to start dev servers - meteor (server folder) and webpack (client folder) you can also run them separately from client/server folders. Go to server and run 'meteor -p 9000' and then in the next terminal window go to client folder and run 'npm start')
  • you can bundle React app and use it as a standard css, html and js static files it will still be able to connect to the Meteor backend which should be running (hosted somewhere). You can bundle the files by running: npm run build in the client folder. The files will land in client/public folder. It allows you to host your client files on a very basic hosting which can serve static files. Also you can use one Meteor instance as a backend for many React apps. Of course it should be used wisely ;)

The React app will start on localhost:3000 and it will connect to the Meteor backend on localhost:9000. (Meteor backend isn't secured - just demo).

For production you should be able to bundle client app and use static files from public folder. Read more here. You also need to host your Meteor app somewhere and you should change connection host in client/app/asteroid/asteroid.js file.

I use Asteroid here as my DDP client.

Why?

I like Meteor as a backend and for DDP, but not so much for its React integration and build system. It is good, but I have a feeling that it's missing something. It isn't elastic. I like Webpack and all tools around it. I also like separation and Redux usage here. I can use my custom React configuration with Meteor backend and still have my realtime updates where I want. What is more important I can configure backend in minutes. Also with such structure I am able to switch to another backend very quickly.

If you have any suggestions, go ahead!

Tests (not complete)

Check out tests. Go to the client and tun npm test.

react-redux-webpack-meteor's People

Contributors

juliancwirko avatar wxqee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-redux-webpack-meteor's Issues

Meteor Debugging Tools Support?

I cannot get the Meteor devtools to work this approach. Is this just a known trade-off or am I doing something wrong? I am not passing any additional configuration options.

What about optimistic UI?

Hey Julian,

I really like this approach and the only downside I can come up with atm is that you loose Meteors optimistic UI, since the meteor methods are only executed server side. What is your take on that? One would need to find a way, to write the logic inside meteor methods so generic that it could be used in reducers, or just duplicate business logic on the client (which obviously is more work, but how most of the other apps/frameworks outside of Meteor do it)
I think optimistic UI for free is still one of - and maybe the only - the benefits of using Meteor also client side.

Thanks for creating this repo and getting the community to explore different directions ๐Ÿ‘

background image not working in Stylus

I tried this

.after-header
    background #1fc8db unquote('url(/images/hero1.jpg)') no-repeat center top !important;

but the image won't show up. Do you mind help

Updating WebPack to version 3

Hi there,
I really like the concept behind your boilerplate of separating the frontend from the backend.
I am trying to update the whole boilerplate starting from WebPack.
The version included in your boilerplate is WebPack 1 if I am not mistaken.
I tried upgrading it to version 3. Apparently I only need to upgrade it to the version 2 since upgrading to version 3 is smooth and done through the command line via updating WebPack only.
I followed mainly the official guide and some other separate ressources of course to try to modify the "webpack.config.js" file.
I ended up with the following "webpack.config.js" file:

var sGrid = require('s-grid');
var rupture = require('rupture');
var autoprefixer = require('autoprefixer');
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  devtool: 'eval',
  entry: [
    'webpack-dev-server/client?http://localhost:3000',
    'webpack/hot/only-dev-server',
    './app/App.js'
  ],
  output: {
    pathinfo: true,
    path: path.resolve(__dirname, 'public'),
    filename: 'bundle.js',
    publicPath: 'http://localhost:3000/'
  },
  plugins: [
    new webpack.LoaderOptionsPlugin({
     options: {
       //postcss: [autoprefixer],
       context: __dirname,
       minimize: true
       //stylus: [sGrid, rupture]
     }
    }),
    new HtmlWebpackPlugin({
      title: 'React with Webpack and Redux - Meteor as a backend only!',
      template: './index_template.ejs',
      inject: 'body'
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.optimize.UglifyJsPlugin({
      sourceMap: true, //in WebPack 2 it defaults to false so need to be explicitly set.
      compress: {
        warnings: true
      }
    })
  ],
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: ['babel-loader'] //'use' and 'loaders' are interchangeable
      },
      {
        test: /\.css$/, //scss??
        use: [
          {
            loader: 'style-loader'
          },
          {
            loader: 'css-loader',
            options: {
              sourceMap: true,
              importLoaders: 2,
              localIdentName: '[name]__[local]__[hash:base64:5]',
              //plugins: autoprefixer,//WTF??
            }
          },
          {
            loader: 'postcss-loader',
            options: {
              plugins: function(){
                return [autoprefixer]
              }
            }
          }
        ]
        //loader: 'style!css?sourceMap&importLoaders=2&localIdentName=[name]__[local]__[hash:base64:5]!postcss'
      },
      {
        test: /\.styl$/,
        exclude: /(node_modules|bower_components)/,
        use: [
          {
            loader: 'style-loader'
          },
          {
            loader: 'css-loader',
            options:{
              sourceMap: true,
              modules: true,
              importLoaders: 2,
              localIdentName: '[name]__[local]__[hash:base64:5]'
              //plugins: sGrid, rupture
            }
          },
          {
            loader: 'postcss-loader',
            options: {
              plugins: function(){
                return [autoprefixer]
              }
            }
          },
          {
            loader: 'stylus-loader',
            options: {
              plugins: function(){
                return [sGrid, rupture]
              }
            }
          }
        ]
        //  loader: 'style!css?sourceMap&modules&importLoaders=2&localIdentName=[name]__[local]__[hash:base64:5]!postcss!stylus-loader'
      },
      {
        test: /\.(png|jpg)$/,
        exclude: /(node_modules|bower_components)/,
        use: [
          {
            loader: 'url-loader',
            options:{
              name: 'images/[name].[ext]',
              limit: '8192' //Maybe INT????
            }
          }
        ]
        //loader: 'url-loader?name=images/[name].[ext]&limit=8192'
      }
    ]
  },
  resolve: {
    //root: path.join(__dirname, '..', 'app'),
    modules: [
      path.join(__dirname, "app"), // 2 or 3 arguments??
      "node_modules"
    ],
    extensions: ['.js', '.jsx', '.json', '.css', '.styl', '.png', '.jpg', '.jpeg', '.gif'],
    enforceModuleExtension: false
  },
/*  stylus: function () {
    return [sGrid, rupture]
  },*/
/*  postcss: function () {
    return [autoprefixer];
  }*/
};

Still when I run npm start fron the client side I get the error in the picture attached, which is not really verbose. I can't pin the exact problem.

This is the debug file from npm.

2017-08-17T23_03_54_168Z-debug.txt
gitissue

I would highly appreciate your help on this, and I apologize i this is not the right place for this question.

Code License

Hey, thanks for the amazing post and work. I also love both React and Meteor.

I was wondering if I can use this example as a base for a small personal project that will also be on GitHub (MIT).

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.