Skip to content

RateMyStocks/ratemystocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RateMyStocks

ratemystocks.com is a community-driven stock market research platform and investor social network. This is a Nx monorepo that contains a NestJS backend API that connects to a PostgreSQL database, and an Angular UI that consumes the API.

For more info on our development processes, visit our wiki

ratemystocks example screenshot

Getting Started

Recommended Workspace Setup

  1. Install Visual Studio Code
  2. Install the Workspace Recommendations which are plugins specified in the .vscode/extensions.json file. When you open the project in VS Code, a prompt at the bottom right saying "Do you want to install the recommended extensions for this repository?". When you see this,

Prerequisites

  1. Install Node.js & npm: Node.js Download. Currently this application is verified to work with Node v14.x & npm v6.x & may or may not work fine with the latest versions.
  2. Install Angular CLI: npm install -g @angular/cli. Currently this application is on Angular 12, but it may be fine to use later versions of the CLI.
  3. Install Nx CLI Globally: npm install -g nx.
  4. Install Docker: Docker Download.
  5. (Optional) Install Heroku CLI.

Running the app locally

  1. cd into the root directory of the project from a command line.
  2. npm install - Install the dependencies in the local node_modules folder.
  3. Create a .env file based off of .env.example. You will need to update this file with your API keys for all the 3rd-party APIs we use - Contact us to get setup with API keys.
  4. docker-compose up -d - This will run the Postgres database & Redis cache as containers in the background. NOTE: You don't need to run this command every time you run the app, only if the containers have stopped (run docker-compose down to stop them). As long as the containers are running, the app should be able to connect.
  5. npm run dev - This will run NestJS (backend) & Angular (frontend) dev servers in parallel, both in watch mode.
  6. Go to localhost:4200 in your browser. IMPORTANT: Makes sure you are not connected to any VPN - it might block your requests made to the 3rd party APIs we use.

Common Tasks

Common Nx commands

  • Generate NestJS module ng g @nrwl/nest:module app/modules/<MODULE-NAME> --project=backend
  • Generate Angular component ng g c modules/<MODULE-NAME>/<COMPONENT-NAME>

Generating TypeORM Migrations:

  1. Update or add a new .entity.ts file.
  2. Import the new enitity into the entities array of ormconfig.ts.
  3. Generate a Migration file under the src/migration directory using npm run typeorm:migration:generate -- Some_Migration_Name (replace Some_Migration_Name with something appropriate). This will automatically create a new migration file with SQL statements to update the schema and rollbacks to revert those changes.
  4. Import the new migration into the migrations array of ormconfig.ts.
  5. Since we have migrationsRun: true in ormconfig.ts, you just have to run the application to run the migrations. If you for some reason do need to run migrations manually, you can do npm run typeorm:migration:run.

Heroku

  1. Login to Heroku to use the CLI: heroku login
  2. Heroku Exec (SSH Tunneling) - Remotely connect to Heroku web dyno: heroku ps:exec -a <heroku-environment-name>
  3. Tail Heroku Logs in Real-Time: heroku logs --tail -a <heroku-environment-name>
  4. Remotely connect to Heroku Postgres database: heroku pg:psql -a <heroku-environment-name>
  5. See Heroku config vars: heroku config -a <heroku-environment-name>

Accessing pgAdmin

  1. After you have run docker-compose up, navigate to http://localhost:5050/ and login with the admin credentials specified in the docker-compose.yml (see the values for PGADMIN_DEFAULT_EMAIL & PGADMIN_DEFAULT_PASSWORD).

Nx

This project was generated using Nx.

🔎 Powerful, Extensible Dev Tools

Quick Start & Documentation

Nx Documentation

10-minute video showing all Nx features

Interactive Tutorial

Adding capabilities to your workspace

Nx supports many plugins which add capabilities for developing different types of applications and different tools.

These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well.

Below are our core plugins:

  • Angular
    • ng add @nrwl/angular
  • React
    • ng add @nrwl/react
  • Web (no framework frontends)
    • ng add @nrwl/web
  • Nest
    • ng add @nrwl/nest
  • Express
    • ng add @nrwl/express
  • Node
    • ng add @nrwl/node

There are also many community plugins you could add.

Generate an application

Run ng g @nrwl/angular:app my-app to generate an application.

You can use any of the plugins above to generate applications as well.

When using Nx, you can create multiple applications and libraries in the same workspace.

Generate a library

Run ng g @nrwl/angular:lib my-lib to generate a library.

You can also use any of the plugins above to generate libraries as well.

Libraries are shareable across libraries and applications. They can be imported from @ratemystocks/mylib.

Development server

Run ng serve my-app for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng g component my-component --project=my-app to generate a new component.

Build

Run ng build my-app to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test my-app to execute the unit tests via Jest.

Run nx affected:test to execute the unit tests affected by a change.

Running end-to-end tests

Run ng e2e my-app to execute the end-to-end tests via Cypress.

Run nx affected:e2e to execute the end-to-end tests affected by a change.

Understand your workspace

Run nx dep-graph to see a diagram of the dependencies of your projects.

Further help

Visit the Nx Documentation to learn more.

☁ Nx Cloud

Computation Memoization in the Cloud

Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly.

Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers.

Visit Nx Cloud to learn more.

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

NPM Version Package License NPM Downloads Travis Linux Coverage Gitter Backers on Open Collective Sponsors on Open Collective

Description

Nest framework TypeScript starter repository.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

Angular CLI Help

This project was generated with Angular CLI.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

About

ratemystocks.com is a stock market research platform and investor social network. This repo is an Nx workspace containing an Angular frontend and NestJS backend.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors