A demo MANK stack (MonogoDB, AngularJS, NodeJS, Koa) stock item app that provides CRUD operations to store vehicle information. It makes use of NodeJS, Koa, and MongoDB to serve a RESTful API, and AngularJS to provide the user interface. The frontend and backend have both been written in Typescript.
You can visit this page for a Live Demo the login credentials can be found here
- Install a text editor, e.g. Visual Studio Code is recommended
- Install Node, e.g. brew install node
- Clone the repository
- Install Docker
The frontend was built using AngularJS.
- Navigate into the frontend folder
cd frontend - Run
npm install / yarn install - Run
npm run buildto build the project. The build artifacts will be stored in thedist/directory. Use the-prodflag for a production build, alternatively usenpm run build:prod - Run
npm run startfor a dev server. Navigate tohttp://localhost:4200/. The app will automatically reload if you change any of the source files. - Run
npm run testto execute the unit tests via Karma. - Run
npm run e2eto execute the end-to-end tests via Protractor.
- Run
ng generate component component-nameto generate a new component. You can also useng generate directive|pipe|service|class|guard|interface|enum|module.
- AngularJS
- Angular Material
- @ngrx/effects
- @ngrx/entity
- @ngrx/router-store
- @ngrx/store
- @ngrx/store-devtools
- HammerJS
- ngrx-store-freeze
- Rxjs
- Socket.IO
- Typescript
The backend is a NodeJS API, built using Koa, Typescript, and MongoDB.
- Navigate into the backend folder
cd backend - Run
npm install / yarn install - Run
docker-compose up, this will run the container for MongoDB. - Run
docker psto find the name of the docker container. - Run
docker exec -i -t <docker-container-name> /bin/bashto open a bash in the container, e.g.docker exec -i -t salespal /bin/bash - Run
npm run buildto compile the typescript into the dist folder. - Run
npm startto run the application. - Run
npm run serve:prodto run the server in a production environment. - Run
npm run test:unitto execute the unit tests. - To customize, update the configuration parameters in
./config/default.yml/./config/production.ymland the docker compose .yml files
The server automatically creates the following test credentials if there are no users in the database:
- Username:
Tester - Password:
hello123
You can use these credentials to execute the ../users/login api call and retrieve a JWT token.
There is local a generate script available via npm run, that will assist in generating new Controllers, Models, Repositories, and Services. For example, if you have a new table called 'Fish' in your database, you can use this command to help generate all of the boilerplate scaffolding required when using the repository pattern:
- Run
npm run generate - Select the component that you would like to generate, e.g.
Allwill generate a Controller, Model, Repository, and Service - Provide a name for the component, e.g.
Fish, if you need to generate a multi-word component please use LetterCasing, e.g.GoldFish.
The templates can customized as required in ./src/templates/