Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

kkamara/nodejs-reactjs-boilerplate

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodejs-reactjs-boilerplate.png

nodejs-reactjs-boilerplate2.png

nodejs-reactjs-boilerplate

(22-Jun-2021) An MVC NodeJS boilerplate with ReactJS 19 Redux SPA.

Using Postman?

Get Postman HTTP client.

Postman API Collection for NodeJS ReactJS Boilerplate.

Postman API Environment for NodeJS ReactJS Boilerplate.

Important Note

You should remove config.json from version-control because all database credentials are stored there.

For database usage in pipelines, I recommend creating a testing_config.json and adding database commands to package.json, like migrate:test and seed:all:test.

Installation

# Create our environment file.
# Update values in .env file like port and timezone.
# Not using Docker?
cp .env.example .env
# Using Docker?
cp .env.docker .env
# Install Yarn globally.
npm install --global yarn
# Install our app dependencies.
yarn
# Before running the next command:
# Update your database details in config.json
yarn migrate
yarn seed:all

Frontend Installation

cd frontend
yarn
yarn build

Sequelize tutorial

See package.json for helpful commands related to using the database.

# Docs:
#   https://sequelize.org/docs/v6/other-topics/migrations/
# Running a specific database seeder
NODE_ENV=development npx sequelize-cli db:seed --seed 20230814135938-demo-user.js
# Creating a model & migration
NODE_ENV=development npx sequelize-cli model:generate --name User --attributes firstName:string,lastName:string,email:string
# Creating a migration
NODE_ENV=development npx sequelize-cli migration:generate --name migration-skeleton
# Running migrations
NODE_ENV=development npx sequelize-cli db:migrate
# Revert the most recent migration
NODE_ENV=development npx sequelize-cli db:migrate:undo
# Revert to a specific migration
NODE_ENV=development npx sequelize-cli db:migrate:undo:all --to XXXXXXXXXXXXXX-create-posts.js
# Creating a seed (fake database data) to simulate production environment
NODE_ENV=development npx sequelize-cli seed:generate --name demo-user
# Running seeds
NODE_ENV=development npx sequelize-cli db:seed:all
# Undo the latest seed
NODE_ENV=development npx sequelize-cli db:seed:undo
# Undo all seeds
NODE_ENV=development npx sequelize-cli db:seed:undo:all

Usage

yarn start # Runs Start-script `yarn node src/app.js`
# Serves app to http://localhost:8000 .
# Serves API to http://localhost:8000/api/v1 .
#   Example API route: http://localhost:8000/api/health .

Reload server on project files change

yarn dev

Reload server and frontend app on project files change

yarn dev:frontend

Using docker?

cp .env.docker .env
docker-compose up --build -d

Mail Server With Docker

docker-mailhog.png

Mail environment credentials are at .env.docker.

The Mailhog Docker image runs at http://localhost:8025in this app.

API Tests

NODE_ENV=test yarn test

Misc.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

BSD

About

(22-Jun-2021) An MVC NodeJS boilerplate with ReactJS 19 Redux SPA.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.