Giter Club home page Giter Club logo

gobeam / vending-machine-demo Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 1.0 440 KB

Application made with Nodejs typescript framework Nestjs and Reactjs Redux Saga to simulate simple vending machine workflow.

Home Page: https://vending-app.vercel.app/

JavaScript 51.91% TypeScript 44.91% Dockerfile 0.53% HTML 1.82% CSS 0.81% Shell 0.03%
nodejs vending-machine demo nestjs typescript reactjs redux-saga swagger nestjs-backend nestjs-mongoose nestjs-boilerplate react-components docker nestjs-docker nestjs-demo

vending-machine-demo's Introduction

Project Description

This project was made to simulate on how vending machine works. We have two application frontend and backend. Frontend is made with React & Redux saga. Meanwhile backend is made using Nodejs typescript framework Nestjs. See Live demo here.

Run application with docker

To run application with docker we have docker-compose.yml file in root of this project. This configuration is only for development purpose. Before running application be sure to checkout docker-compose.yml and review volumes attached in services.

In Mongodb service named db_mongo_service we have attached /data/db of host machine make sure its is accessible to docker otherwise feel free to attach your own custom directory.

In backend config I've added default configuration from docker-compose.yml for development so you don't need to change anything but if you made any changes on docker-compose.yml be sure to update backend configuration too.

  1. Make sure docker and docker-compose is configured in your machine.
  2. Run following command
    docker-compose build
    docker-compose up -d

Prerequisite without docker

To run it without using docker you need to have following installed:

  1. Backend
    • You need to install npx command globally for seeders.
      npm install -g npx
      
    • You have to have mongodb up and running for database follow this link if you haven't.

Run backend project

  1. Change directory to backend and install required packages:
    cd backend
    yarn i
  2. Install dependencies
    yarn i
  1. In backend there is config folder there are configuration related to application database and others. Be sure to change them according to your running environment.

  2. Seed data for vending machine and its product:

    npx nestjs-command seed:vend
    npx nestjs-command seed:product
  3. Now you can run you application. To run it in dev mode:

    yarn start:dev
  4. To run your backend test in development mode:

    yarn test:watch
  5. If everything goes well and you have set your backend default running port as 7777, you can visit your application through http://localhost:7777

  6. To view swagger documentation visit http://localhost:7777/api

Run Frontend App

  1. Change directory to frontend application:
    cd frontend
  1. Install dependencies
    yarn i
  1. Set up environment. Copy .env.example to create new .env file and add backend base url to env key. For Example:
    cp .env.example .env
    In .env file add:
        REACT_APP_API_BASE_URI=http://localhost:7777
  2. Run your application:
    yarn start
  3. If everything goes well, you can visit your application through http://localhost:3000

vending-machine-demo's People

Contributors

gobeam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lakshmankashyap

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.