Skip to content

This is a basic MERN boilerplate that can be used to jumpstart any app ideas you can think of.

Notifications You must be signed in to change notification settings

theycallmetyson/tcmt-mern-app-boilerplate

Repository files navigation

MERN app with TS, Vite and Vitest ready to deploy into Docker container.

This is a simple boilerplate with React as frontend, Express & Node as backend and Mongodb as database with Redis in between. The whole project is using Typescript, Vite and Vitest as test framework.

Installation

Use the package manager npm to install all the dependencies for both backend and frontend by running the command from the root folder.

TIP: when you're in root folder and running this cmd, the cmd will run for both frontend and backend.

npm install

Running local dev environment

TIP: when you're in root folder and running this cmd, the cmd will run for both frontend and backend.

npm run dev

Preview prod

Build, compile and previews the compilated app.

TIP: when you're in root folder and running this cmd, the cmd will run for both frontend and backend.

npm run preview

Tests

Run tests

npm run test

There's also a ui for the tests.

npm run test-ui

Build

The build is going to delete any existing dist folder and then compile new files in a new dist folder.

TIP: when you're in root folder and running this cmd, the cmd will run for both frontend and backend.

npm run build

Docker

When deploying to docker, it will simulate a production environment and deploy the compiled files in the dist folders to make the app as small as possible.

Deploy (detached mode)

docker compose up -d

Update

Remember to undeploy before building the new image.

docker compose build

Undeploy

docker compose down