An easy and straight forward full-stack web application boilerplate using Node.js Express as backend and React as frontend.

Overview

ts-express-react

An easy and straight forward full-stack web application boilerplate using Node.js Express as backend and React as frontend. All packages are structured as Yarn Workspaces and written in Typescript. In addition, the web application can be built as Docker image using a multi stage built supported Dockerfile.

Introduction

This boilerplate uses yarn workspaces which allows both client and server workspaces to use common workspace for type definitions or any other information relevant.

Prerequisite

make sure yarn is installed.

npm i -g yarn

Common

A workspace that includes common logic to be imported from other relevant workspaces.

Server

A workspace that includes a Node.js Express web application.

Client

A workspace that includes a React single page application.

Quick Start

# Clone repository
git clone https://github.com/rok-tel/ts-express-react <Your_App_Name>

# Enter project root directory
cd <Your_App_Name>

# Install dependencies
yarn

# Running dev mode
yarn dev

# Build for production
yarn common build
yarn client build
yarn server build

# Running prod mode
yarn start

Development mode

Running yarn dev runs both client and server concurrently with live reloading mode. Which allows direct impact of changed code without build process.

  1. Server -> ts-node-dev --transpile-only src/index.ts
  2. Client -> react-scripts start

This enables running client react app at http://localhost:3000 with proxy to running server app at http://localhost:8080

  • See link for more information.

Production mode

Running yarn server start runs the web application with transpiled code of its workspaces.

  • Remember running build commands beforehand. (See Quick Start).

Docker container mode

  • Notice - If Docker is not installed on your machine, you can download it from here.
# Enter project root directory
cd <Your_App_Name>

# Build docker container image
# Notice - replace 
   
   
    
    , 
    
     
    
    
   
   
# with your chosen image name and tag
docker build . -t <Image_Name>:<Image_Tag>

# Run a docker image
# Notice - replace 
   
   
    
     with desired port
   
   
# in host machine
docker run -p <Port>:8080 <Image_Name>:<Image_Tag>

Documentation

Directory Structure

All workspaces are under packages directory.

Each workspace -

  1. contains src directory for Typescript code.
  2. contains tsconfig.json file for Typescript options and configuration.
  3. Would be built and transpiled to build directory.

Typescript

TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language.

Node js

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.

Express

Express is a backend web application framework for Node.js, It is designed for building web applications and APIs. It has been called the de facto standard server framework for Node.js.

React

React is a free and open-source front-end JavaScript library for building user interfaces or UI components.

Yarn

Yarn is a package manager that replaces the existing workflow for the npm client or other package managers while remaining compatible with the npm registry. It has the same feature set as existing workflows while operating faster, more securely, and more reliably.

Yarn Workspaces

Yarn Workspaces are a new way to set up your package architecture that’s available by default starting from Yarn 1.0. It allows you to setup multiple packages in such a way that you only need to run yarn install once to install all of them in a single pass.

Docker

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.

You might also like...
Free and open-source MERN Stack CRUD Application built with React v17+, RRDv6+, Node.js, Express.js MongoDB and Mongoose ODM
Free and open-source MERN Stack CRUD Application built with React v17+, RRDv6+, Node.js, Express.js MongoDB and Mongoose ODM

🤘 MERN Stack CRUD Application Free and open-source MERN Stack CRUD Application built with React v17+, RRDv6+, Node.js, Express.js MongoDB and Mongoos

Full Stack tutorial using ReactJS, NodeJS, Express and MySQL

Run this project If you want to try the finished project: Go to Start with MySQL to create the database Download the project Go to the client folder a

Create-t3-app - Interactive CLI to quickly set up an opinionated, full stack, typesafe NextJS project using the T3 Stack
Create-t3-app - Interactive CLI to quickly set up an opinionated, full stack, typesafe NextJS project using the T3 Stack

create-t3-app Interactive CLI to quickly set up an opinionated, full stack, typesafe NextJS project using the T3 Stack Usage npm npx [email protected]

Boilerplate for building applications with a React frontend and a C++ gRPC backend

Boilerplate for building applications with a React frontend and a C++ gRPC backend. How To Run Backend Install Bazel Bazel is for building the backend

My Anime List : A web app which is bulit using react as a frontend and firebase as a backend
My Anime List : A web app which is bulit using react as a frontend and firebase as a backend

Firebase_My_Anime_List Deployed Project on firebase - https://myanimelist-e637e.web.app/ My_Anime_List is webapp which is bulit using react as a front

A FULLSTACK Web Application built using MERN Stack (MongoDB, Express, React, Nodejs)
A FULLSTACK Web Application built using MERN Stack (MongoDB, Express, React, Nodejs)

Socialize This is a FULLSTACK MERN Website. This Website uses Reactjs on the Fro

updated frontend template for full stack evm-based dapps. tools: typescript, hardhat, ethers, solidity, react

updated frontend template for full stack evm-based dapps. tools: typescript, hardhat, ethers, solidity, react

GraphQL first full-stack starter kit with Node, React. Powered by TypeScript
GraphQL first full-stack starter kit with Node, React. Powered by TypeScript

GraphQL first full-stack starter kit with Node, React. Powered by TypeScript

This is a fully functional google search engine book it was created with Restful API and i refactored it to the GraphQL built with Apollo server with the use of the MERN stack with react front end MongoDB database, Node.js, Express and API
Comments
  • missing workspace package

    missing workspace package

    Executed yarn dev and it is giving error for missing packages,

    Error: Cannot find module '/Users/dipeshbeckham/Downloads/ts-express-react-master/node_modules/@my-app/common/build/index.js'. Please verify that the package.json has a valid "main" entry

    opened by kdstrides 2
Owner
null
Full Stack boilerplate with JWT Authentication - Built with React, Typescript, Node, Express, GraphQL, PostgreSQL, Redis, and Webpack

Full Stack boilerplate with JWT Authentication - Built with React, Typescript, Node, Express, GraphQL, PostgreSQL, Redis, and Webpack

Scott Jason 7 Sep 21, 2022
A ready to customize project to make a nice webapp using Node.js (Express.js) for the backend and React with Typescript and Redux for the frontend.

A ready to customize project to make a nice webapp using Node.js (Express.js) for the backend and React with Typescript and Redux for the frontend.

Elia Lazzari 3 Mar 16, 2022
Palo-mern-boilerplate - A MERN stack (Mongo, Express, React, Node) boilerplate to get Palowans up and running quickly.

palo MERN boilerplate A MERN stack (Mongo, Express, React, Node) boilerplate to get Palowans up and running quickly. Commands: npm install # install b

Jim 10 Oct 31, 2022
A web application for learning about your local politicians built with a React and Next.js front-end, an Express Node.js GraphQL backend API

Integra is a web application for learning about your local politicians. It is built with a React and Next.js front-end, an Express Node.js GraphQL backend API, and a MongoDB database with a Prisma schema.

Jeremy Nguyen 9 Dec 1, 2022
winwiz1 157 Dec 28, 2022
A demo repo to dockerize React Frontend(using Create React App) and Express Backend

This is a Demo Repository to dockerize a React frontend and an express backend in a single container. The two important files are: Dockerfile contains

Raghavendra Kaushik 7 Nov 2, 2022
CRUD App using MERN Stack, it uses ReactJS for Front-end, NodeJS, Express For the Backend and Mongo DB as database!

Book Collection List ?? Demonstration of the application | Features | Technologies used | Application installation ?? Demonstration of the application

Victor Lira 33 Nov 20, 2022
A MERN stack (Mongo, Express, React, Node) boilerplate to get Palowans up and running quickly.

Palo MERN boilerplate A MERN stack (Mongo, Express, React, Node) boilerplate to get Palowans up and running quickly on new projects. Commands: npm ins

Palo IT Singapore 10 Oct 31, 2022
Postgres, Express, React, Node - Stack Boilerplate

PERN Boilerplate ?? WORK IN PROGRESS ?? upcoming features: Email confirmation Socials Login Features GraphQL Server JWT Authentication Auto refresh ac

Prince Carlo Juguilon 15 Aug 9, 2022
Fyodor Simonov 3 Apr 15, 2022