LocChat/README.md

92 lines
1.7 KiB
Markdown
Raw Normal View History

2021-11-03 21:25:40 -04:00
# Nest Starter App
2021-10-29 20:57:24 -04:00
## Description
2021-11-16 21:14:46 -05:00
A starter app with Postgres, NestJS, and React
## Prerequisites
### asdf-vm
Tool versions are managed using `asdf-vm`. You will need to have `asdf-vm` installed first.
2021-10-29 20:57:24 -04:00
2021-11-03 21:25:40 -04:00
## Setup
2021-11-16 21:14:46 -05:00
### Tool versions
Install the tool versions by running
```bash
$ asdf install
```
### Install yarn
We will use `yarn` instead of `npm` for package managment
```bash
$ npm install -g yarn
```
### .env
2021-11-03 21:25:40 -04:00
Create a file in the root called `.env` and copy the contents of `.env.example`
2021-12-03 19:00:23 -05:00
In your new `.env` file update the values for each key as you would like
2021-11-16 21:14:46 -05:00
### Dependencies
2021-11-30 17:40:07 -05:00
To install the server dependencies run
2021-11-16 21:14:46 -05:00
```bash
$ yarn # this is same thing as `yarn install`
```
2021-11-03 21:25:40 -04:00
2021-11-30 17:40:07 -05:00
To install the client dependencies run
```bash
$ cd client && yarn && cd ..
```
2021-11-16 21:14:46 -05:00
### Database
Create the database
2021-11-03 21:25:40 -04:00
```bash
2021-11-30 17:40:07 -05:00
$ pg_ctl start # starts postgres
$ createdb neststarterappdevelopment # creates a postgres database
2021-11-03 21:25:40 -04:00
```
2021-10-29 20:57:24 -04:00
2021-11-16 21:14:46 -05:00
Run the migrations
```bash
2021-12-03 19:00:23 -05:00
$ yarn db:migrate
2021-11-16 21:14:46 -05:00
```
Migrations need to be run again everytime a new migration is created
2021-12-03 19:00:23 -05:00
Run the seeds
```bash
$ yarn db:seed
```
This should create roles and your admin level user in your database.
2021-11-16 21:14:46 -05:00
### SSL
2021-11-30 17:40:07 -05:00
Create a ssl key and certificate and place them in the root directory
2021-10-29 20:57:24 -04:00
```bash
2021-11-16 21:14:46 -05:00
$ openssl req -x509 -newkey rsa:4096 -keyout private-key.pem -out public-cert.pem -sha256 -nodes
2021-10-29 20:57:24 -04:00
```
2021-11-30 17:40:07 -05:00
Enter `US` for the country code. Where this key will only be used for development you can leave all of the rest of information blank.
2021-10-29 20:57:24 -04:00
## Running the app
2021-11-30 17:40:07 -05:00
To start the server run
2021-10-29 20:57:24 -04:00
```bash
# watch mode
2021-11-16 21:14:46 -05:00
$ yarn start:dev
2021-11-30 17:40:07 -05:00
```
2021-10-29 20:57:24 -04:00
2021-11-30 17:40:07 -05:00
To start the client run
```bash
$ yarn client:watch
2021-10-29 20:57:24 -04:00
```
## Test
```bash
# unit tests
2021-11-16 21:14:46 -05:00
$ yarn test
2021-10-29 20:57:24 -04:00
# e2e tests
2021-11-16 21:14:46 -05:00
$ yarn test:e2e
2021-10-29 20:57:24 -04:00
# test coverage
2021-11-16 21:14:46 -05:00
$ yarn test:cov
2021-10-29 20:57:24 -04:00
```