All Projects β†’ nadavpodjarski β†’ postgres-nest-react-typescript-boilerplate

nadavpodjarski / postgres-nest-react-typescript-boilerplate

Licence: GPL-3.0 license
No description or website provided.

Programming Languages

typescript
32286 projects
shell
77523 projects
HTML
75241 projects
CSS
56736 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to postgres-nest-react-typescript-boilerplate

Ngx Starter Kit
πŸ…°οΈ Angular πŸš€ NestJS πŸ’ Starter Kit
Stars: ✭ 479 (+415.05%)
Mutual labels:  postgres, nestjs
chronos-pipeline
A data pipeline for processing event data
Stars: ✭ 20 (-78.49%)
Mutual labels:  expressjs, nodejs-server
Node Express Postgresql Sequelize
Node.js, Express.js, Sequelize.js and PostgreSQL RESTful API
Stars: ✭ 148 (+59.14%)
Mutual labels:  postgres, expressjs
teanjs
πŸ”₯ TypeORM - Express - Angular 8 - NestJS Server Side Rendering (SSR) 😺
Stars: ✭ 62 (-33.33%)
Mutual labels:  postgres, nestjs
connect4
Connect 4️⃣Game
Stars: ✭ 1 (-98.92%)
Mutual labels:  postgres, nestjs
nest-blog-api
Blog Web API with NestJs, Postgres, and Sequelize ORM
Stars: ✭ 69 (-25.81%)
Mutual labels:  postgres, nestjs
in-memory-db
Simple In-Memory DB Service for NestJS projects
Stars: ✭ 55 (-40.86%)
Mutual labels:  expressjs, nestjs
hackerAPI
πŸ“ API for registration, live-site
Stars: ✭ 20 (-78.49%)
Mutual labels:  expressjs, nodejs-server
clock-in-out
A clock-in/out system using nestJS, PostgreSQL, TypeORM, Angular, Arduino, RxJS
Stars: ✭ 61 (-34.41%)
Mutual labels:  postgres, nestjs
nestjs-rest-sample
NestJS RESTful APIs Sample
Stars: ✭ 204 (+119.35%)
Mutual labels:  expressjs, nestjs
Nest Mean
NestJS Tutorial Repository
Stars: ✭ 250 (+168.82%)
Mutual labels:  expressjs, nestjs
next
δΈε†η»΄ζŠ€οΌŒθ―·η›΄ζŽ₯ζŸ₯ηœ‹ https://github.com/notadd/notadd
Stars: ✭ 15 (-83.87%)
Mutual labels:  expressjs, nestjs
Books-Library-API
A starter template for building a restful API with nestjs, nodejs , expressjs , monogdb, mongoose
Stars: ✭ 21 (-77.42%)
Mutual labels:  expressjs, nestjs
nestjs-starter-kit
Nest.js+Postgres+Nginx+Docker starter kit
Stars: ✭ 41 (-55.91%)
Mutual labels:  postgres, nestjs
nestjs-cookie-session
Idiomatic Cookie Session Module for NestJS. Built on top of `cookie-session` 😻
Stars: ✭ 35 (-62.37%)
Mutual labels:  expressjs, nestjs
Stator
Stator, your go-to template for the perfect stack. πŸ˜πŸ™
Stars: ✭ 217 (+133.33%)
Mutual labels:  postgres, nestjs
nestjs-session
Idiomatic Session Module for NestJS. Built on top of `express-session` 😎
Stars: ✭ 150 (+61.29%)
Mutual labels:  expressjs, nestjs
nodetomic-api
RESTful API Nodejs designed for horizontal scalability with support for cluster, based on Express, MongoDB, Redis, JWT, Socket.io, Passport.
Stars: ✭ 41 (-55.91%)
Mutual labels:  expressjs, nodejs-server
ng-nest-cnode
Angular 10 Front-End and Nestjs 7 framework Back-End build Fullstack CNode
Stars: ✭ 17 (-81.72%)
Mutual labels:  expressjs, nestjs
nestjs-config
NestJS Module for Nonfig services. Nonfig combines Configurations and Features. So you change features, and release swiftly, and measure to digital impact.
Stars: ✭ 40 (-56.99%)
Mutual labels:  nestjs

Postgres - Nest.js - React.js Boilerplate

docker compose build License: GPL v3

Introduction

This is a Full-stack Dockerized boilerplate. A vanilla infrastructure made to simplify the develpoment and deploying processes.

Stack

  • React.js
  • Redux
  • Node.js
  • Nest.js
  • Postgres
  • Docker

Prerequisites

Make sure you have the below installed on your machine.

File strcutre

project-name
    |
    |---/ client
            |
            |---/ public
            |---/ src
            |
            .env
            .dockerignore
            .gitignore
            Dockerfile
            Dockerfile.dev
            nginx.conf
            tsconfig.json
            package.json
    |
    |---/ database
            .env
            initdb.sql
            .gitignore
    |---/ server
            |
            |---/src
            |
            ormconfig.json
            .dockerignore
            .gitignore
            Dockerfile
            Dockerfile.dev
            nodemon.json
            package.json
            wait-for-it.sh
    |
    |
    docker-compose.yml
    docker-compose-dev.yml
    .prettierrc
    README.md

Demo

Demo is a simple Todolist using React and Material-UI on client side, nest on backend and postgres as our database demo can be started in development mode and in production mode as well.

Quick start

Clone this repo to your local machine

git clone https://github.com/nadavpodjarski/postgres-express-react-typescript-boilerplate.git project-name

Before we run our container lets calm down our editor and npm install dependecies locally. For that let's run the following command

# install server dependencies

cd project-name/server && npm i

# instal client dependencies

cd ../client && npm i

Now Let's check our Demo, for that run the following command

cd ../ && sudo docker-compose --file docker-compose-dev.yml up

it will be served on http://localhost:3000

Replace project-name with your own

Client

Client has been created with create-react-app and located in ./project-name/client

Development

In develpoment mode the client will be run in a container built with ./client/Dockerfile.dev and will be exposed on port 3000, with docker volumes every change thats been saved will be reflected within the running container.

Production

In production mode the client build will be created and will run in a container built with ./client/Dockerfile. The client build/static-files will be served with nginx server and will be exposed on port 80.

Environment Variables

Enviornment variables are located in ./client/.env but can be declared into the dockerfile itself under ENV or in the docker compose file under enviornemt property. In order to use docker stack deploy its needed to use one of the other options and not env_file.

note that nginx server has a minimalistic configuration

Data-base

Postgres data-base is created with an official postgres image which can be found in docker hub https://hub.docker.com/_/postgres

Enviornment variables will be located in the docker-compose file.` and will contain our database credentials :

POSTGRES_USER=admin
POSTGRES_PASSWORD=admin
POSTGRES_DB=pern_db

Volumes of our database will be located in ./server/database/data

Production volume is located in ./server/data/prod
Development volume is located in ./server/data/dev

Server

Server is located in ./projec-name/server using express.

Development

In development mode the server will run in a container built with ./server/Dockerfile.dev. and will be exposed on port 5500 to the "outside" world, with docker volumes and nodemon, every change thats been saved will be refelected within the running container.

Production

In production mode the server will run in a container built with ./server/Dockerfile. and be exposed on port 5500 only to the docker composer internal services within the same network. in our case server and client are on the same network "webapp" , hence only the client can communicate with the server, and will do thatthrough the /api location. for more locations, its needed to configure them in the ./client/nginx.conf file.

Data-base connection

Data-base connection is handled with ormconfig.json that is located at ./server/ormconfig.json and will contain postgres credentials to establish connection to our data-base. Thanks to https://github.com/vishnubob/wait-for-it for the wait-for-it.sh script, we can set that the server image will run only after getting confirmation that postgres container is available. by that we wont get connection failures due to bad order of docker composing.

Docker compose

Development

To establish a development environment, simply run the following command from the project root folder.

sudo docker-compose --file docker-compose-dev.yml up

On save changes in client and server, containers will be automatically updated, no need to restart any servers.

Production

To establish production environment, simply run the following command from the root folder.

sudo docker-compose up

This will creates build for both server and client, will serve client build with nginx server on port 80 and will communicate with server on port 5500 in the location /api.

Good to know

  • To drop the use of sudo run the folowing command in your terminal
sudo usermod -aG docker $USER
  • If you are making changes within the dockerfiles you will need to rebuild them, for that add the --build flag to the docker compose up command.

Enjoy

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].