Skip to content

This project is inspired by an idea to quickly create a production ready project with all the required infrastructure at low cost yet with important security measures in place and ability to quickly scale in order to ship a quality product to early adopters.

sandorTuranszky/react-express-docker-starter

Repository files navigation

This is an example of a Dockerized production ready application built with Create React App and Express.js

This project is inspired by an idea to quickly create a production ready project with all the required infrastructure at low cost yet with important security measures in place and ability to quickly scale in order to ship a quality product to early adopters.

Thus this project is the best choice if you want to quickly start an app (client app + api server) to validate your ideas and scale if needed. For landing page and admin section see my other projects in Features

As your project grows, you can easily upgrade storage or change it from NoSQL to SQL.

  • NoSQL DB provided by MongoDB Atlas which offers a free and secure replica set with 512Mb storage. And it can be easily scaled to a plan with production grade features starting at just $9.
  • Redis is provided by RedisLabs which has a free plan with 30Mb of storage and can be quickly upgraded to a paid plan with 100Mb for as low as $5 monthly. Since in this project Redis is used by priority job queue Kue and for caching that expires fast and gets removed from Redis, even 30Mb can be more than enough for an early stage project.
Using Database as a service (DBaaS) is an optimal solution for early stage projects where you need security and reliability at low cost (or even for free). Settings up and maintaining your own secure MongoDb replica set or Redis storage with such important features as auto-failover, daily backups, instant scalability and performance monitoring is a challenging, time-consuming and way more expansive.
  • TODO: CI is done with a FREE Travis CI however it integrates with GitHub only and for private projects you need to set up a paid account with GitHub which is $7/monthly. You can also choose to use Circle CI which offers 1,500 build minutes per month for FREE (might be sufficient on early stage) and connect it with your Bitbucket with a FREE plan. CI at no extra cost :)

  • TODO: For a landing page I advise to use either Gatsby or Next as both can export the code as static HTML making your landing page fast and fully SEO ready. See my another project [link project git here]

  • TODO: For admin section for you app there is my another project [link project git here]

  • As a VPS hosting I am using Zeit.co and their Premium plan for $15/monthly. It allows manual scaling up to 10 instances and in case if a project becomes successful, you can get as many as 25 instances with automatic scaling for just $50/monthly. They also automatically update ssl certificates for domains and have a simple deployment with Now that integrates with GitHub (out of the box) or CircleCi with some additional workaround. Of course, you can use just about any other VPS providers, e.g. Digitalocean, Linode or any other.

I am always open to your feedback

Features

  • Follows best practices from The largest Node.JS best practices list
  • Server powered by Express.js
  • SPA with rich features including PWA coming out of the box with Create React App
  • Helmet helps you secure your Express apps by setting various HTTP headers. Default setup is used. More on that here
  • Logging with Morgan
  • Uses mongoose Mongoose and MongoDB Atlas
  • TODO: Built with GraphQL query language
  • TODO: Transactional emails are sent with Kue backed by RedisLabs
  • TODO: Google and LinkedIn authentication with Passport
  • TODO: CI with travisCI or CircleCI
  • TODO: Sentry

Plans

Get started

Set up environment variables

Create config directory under server and add to files there:

server/config/default.js
server/config/production.js
// default.js

module.exports = {
    db: {
        mongoose: {
            port: 3000, //or any you prefer
            user: 'your mongodb user',
            password: 'your mongodb password',
            dbName: 'your db name'
        },
        redis: {
            url: 'redis url',
            retryStrategy: 1000
        }
    }
};

// production.js has the same structure but different credential, of course.

More details on how config works see node-config

About

This project is inspired by an idea to quickly create a production ready project with all the required infrastructure at low cost yet with important security measures in place and ability to quickly scale in order to ship a quality product to early adopters.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published