Skip to main content

React Redux starter kit - Rekit

I have been developing applications using React and Redux for quite some time now and I feel there are several starter kits out there. Although some add too much of boilerplate code, some include several libraries (to make it one kit that includes all) and some take the route of adding minimal boilerplate to include only the required libraries. I plan to write about these React-Redux starter kits/boilerplates in the coming weeks. This post focuses on a starter kit called Rekit. Rekit provides basic scaffolding and comes with a CLI that allows you to add features to your React application. Rekit focuses on application structure. It divides the application in terms of features, wherein each feature acts as a decoupled component and then assembled at the root level.

Since I mentioned the word 'boilerplate', a React-Redux application would have to include some boilerplate code before one starts to write any functional code. Even a simple application would need some boilerplate code added. A project created with Rekit has basic scaffolding and also includes boilerplate code such as configuring a store, adding middleware such as redux-thunk and router (react-router-redux), adding root path (/) to the list of routes and defining an App container where the route components would be rendered etc. It brings developer to a place where he's are ready to add functional code to the application.

Rekit follows feature oriented architecture to structure the application. Instead of building the application in terms of containers, components and actions; an application built with Rekit is organized in terms of features. Here, each feature is decoupled and would have its own set of containers, components, routes and actions. For example, consider an application that allows you to add a to-do and list the to-dos; it would have two routes - /add and /list, two containers - 'Add' and 'List' that connect to the Redux store and dispatch actions that update the state variables in the Redux store, actions - 'addTodo' and 'getTodos' that update and read from the Redux state. Also, the CLI allows you to create dumb components(view-only) that are then included in container's render method whose sole responsibility would be to display the values passed to it and invoke handlers defined in its parent container.

Rekit CLI makes it really easy to create an application and add features to it. After installing Rekit (npm i -g rekit), you can use rekit command to create a project.

rekit create todo-app

this would create a todo-app with package.json in it. Change the directory to the newly created project and then do 'npm i' to install the dependencies.

The next step would be to add a feature and a couple of Containers and Actions in the feature:

rekit add feature todo
rekit add component todo/List -c // -c flag to create a container component
rekit add component todo/Add -c
rekit add action todo/add

+ todo-app
    + src
        + common
            - configStore.js
            - history.js
            - rootReducer.js
            - routeConfig.js
         + features
             + todo
                 + redux
                        - actions.js
                        - add.js
                        - constants.js
                        - initialState.js
                        - reducer.js
                        - update.js
                  - Add.js
                  - Add.less
                  - index.js
                  - List.js
                  - List.less
                  - ListItem.js
                  - ListItem.less
                  - route.js
                  - style.less
        + images
        + styles
         - index.html
         - index.js
         - Root.js
        + tests
        + tools

Rekit scaffolds the project with a basic setup which includes the entry point to the application in index.js, redux store and route configuration related files in common directory and it also includes a 'default page' as a feature (not shown above). It adds/updates directories and files in the project as and when you add a feature, component or an action.

On one action per file methodology:

Rekit makes it a mandate to create one action per file instead of several actions in a single file and calling it as a reducer. I was initially not comfortable with this approach but then by following through the application structure, it made more sense. Every action is defined in a file and it exports two functions – an action and a reducer.

The CLI then includes this file in feature’s root reducer file - todo/redux/reducer.js:

Notice the last line - return reducers.reduce((s, r) => r(s, action), newState); it returns the reducer function for each of the reducers defined in the feature. The feature root reducer was earlier imported into the application’s root reducer:

The CLI adds the import statements, updates the reducer list and keeps the application updated whenever a new feature is added or updated. I've been very happy with this starter kit so far, not to forget, it adds unit test files, linting rules and build configuration files. Also, there is an option to replace redux-thunk with redux-saga.

I've created a sample todo app and have posted the code on GitHub -


  1. What an informative article! If you happen to need academic writing help, our expert writers will provide you with amazing essays and other types of work. They guarantee high-quality service and fair prices. Check it out and it will become your favourite website.

  2. I’ve ordered coursework at Gurudissertation service. Well, the order was completed quite fast. The prices are affordable for most students. The writer I was dealing with was very friendly and professional. The book review he has done is perfect. Such a great service and affordable pricing! The final paper requires no further proofreading or corrections. I am sure our paths will cross once again in the nearest future.

  3. You wouldn't pass a clunk to both of those - createReducer makes a query table of move types to "case reducer" capacities, and createSlice takes a few Professional Essay Writers UK alternatives including a query table of activity types to "cut reducer" capacities.

  4. i am for the first time here. I came across this board and I find It really useful & it helped me out a lot. Write My Essay For Me Cheap Uk


Post a Comment

Popular posts from this blog

De-obfuscating javascript code in Chrome Developer Tools

I had blogged about JavaScript debugging with Chrome Developer Tools some time back, wherein I have explained how these developer tools can help in debugging javascript code. Today Google Chrome 12 was released and my Chrome browser was updated to this version. As with every release, there have been some improvements made on performance, usability etc,. One feature that stood out for me is the ability to De-obfuscate the javascript code.

What is Minification?

Minification is the process of removing unnecessary characters such as white spaces, comments, new lines from the source code. These otherwise would be added to make the code more readable. Minifying the source code helps in reducing the file size and thereby reducing the time taken to download the file. This is the reason why most of the popular javascript libraries such as jQuery are minified. A minified jQuery file is of 31 KB in size where as an uncompressed one is about 229 KB. Unfortunately, debugging minified javascript file…

A cheat sheet of keyboard shortcuts in ColdFusion Builder

In my last post I have explained about keyboard shortcuts in ColdFusion Builder 2.0. This blog post contains a list of all shortcut keys and I have listed these keyboard shortcuts based on the categories that it falls into. Well, this post was not planned since users can easily get to know the keyboard shortcuts by navigating to the preferences (ColdFusion -> Profiles -> Keys). However, I met Joshua at Scotch on the rocks in Edinburgh and he suggested that it would be nice to have the list of keyboard shortcuts handy. So this post is for those who would like to have the list with them and refer it whenever required.

Keyboard shortcuts for inserting text:

These are the keyboard shortcuts which are used to insert some text into the editor:

CommandKeyboard shortcuts on WindowsKeyboard shortcuts on MacInsert anchor tagCTRL + T, LCMD + T, LInsert bold tagCTRL + T, BCMD + T, BInsert br tagCTRL + T, RCMD + T, RInsert cfabortCTRL + T, ACMD + T, AInsert cfdumpCTRL + T, DCMD + T, DInsert cfs…

Adding beforeRender and afterRender functions to a Backbone View

I was working on a Backbone application that updated the DOM when a response was received from the server. In a Backbone View, the initialize method would perform some operations and then call the render method to update the view. This worked fine, however there was scenario where in I wanted to perform some tasks before and after rendering the view. This can be considered as firing an event before and after the function had completed its execution. I found a very simple way to do this with Underscore's wrap method.