Giter Club home page Giter Club logo

xenelectronic's Introduction

XenElectronic

This is a full-stack mono repository for XenElectronic, one of electronics and home appliance store.

As part of XenElectronic MVP, this application has the following features:

  • Customers should be able to view the list of the products based on the product categories
  • Customers should be able to add the products to the shopping cart
  • Customers should be able to view the products listed on the shopping cart
  • Customers should be able to remove the products listed on the shopping cart
  • Customers should be able to checkout shopping cart and continue their transaction to payment

This project will be built using React (for front-end) and Node.js Express (for back-end). As part of a full-stack JavaScript application, TypeScript is implemented to ensure type-safety in the development phase.

Getting Started

Prerequisites

Installing the Project

$ git clone https://github.com/PrawiraGenestonlia/xenelectronic
$ cd xenelectronic
$ npm install

Running the project (locally)

$ npm run dev

There will be 2 services being run - api and ui. api-service will be listening to port 8080 and ui-service will be listening to port 3000. The development environment is hot-reload enabled, as such, there is no need to restart the program when changing source code files. For OpenAPI documentation, you can navigate to http://localhost:8080/api/docs/ to access swagger application.

Running the tests

If you want to run unit test for the project, run npm run test command. However, if you want to run coverage test, run npm run coverage command. If there are no failed test cases, lcov html files will be generated and this command will automatically opens the coverage results for both api and ui.

Test suites

api

As the api is written in TypeScript (node.js), the following technology is used:

  • mocha - JavaScript test framework
  • chai - JavaScript asserting library
  • nyc - Code coverage generation tool

The following screenshot shows the code coverage as of 27th Feb 2022. API Code Coverage

ui

As the ui is developed using React UI Library, the following technology is used:

The following screenshot shows the code coverage as of 27th Feb 2022. UI Code Coverage

Deployment

The application is deployed in heroku. Two versions are made public:

A single URL entry instead of separate url for api and ui is decided to ensure the project is accessible and secure through CORS control. If you would like to explore REST API services, do visit the swagger file.

CI/CD pipeline

CI/CD

When there are changes to the development branch in the repository, the application will be deployed to development environment. Upon successful testing and verification, a pull request to main branch is to be made. This will trigger a deployment in production environment.

Built With

  • React - The web UI library
  • Tailwindcss - A utility-first CSS framework
  • Express - Node.js web application framework (for REST APIs)
  • TypeORM - A typescript-enabled Object-Relational Mapping
  • PostgreSQL - A powerful, open source object-relational database

Project Implementation Details

The project is a monorepo project with npm workspace. This enables global scripts to start, build or test both api and ui repository with a single command. This is the project structure.

- api                   //api application
- images               
- ui                    //ui web application
  .gitignore
  checklist.md
  package-lock.json
  package.json
  Procfile
  README.md

Database Entity-Relationship Diagram

ER

Data seeding

To improve development productivity, the database will be seeded with necessary information if it is empty. The seeding data can be found in {project}/src/database/seeding/* folder.

API Details

In this MVP, a total of 24 APIs were developed. The complete API request (path, query or body) and response body schemas can be found in the swagger file. This is done through programatic generation of OpenAPI spec. To view this spec locally, you can run this project and find the file at {project}/api/tsoa/swagger.json path.

UI Details

To improve the state management in the React UI, redux and redux-saga are implemented. This is to ensure a high level of responsiveness when user navigates from pages to pages. A detailed implementation of redux can be found in {project}/ui/src/redux/* folder.

Authors

Acknowledgements

  • Unsplash - For categories' images
  • Alicdn = For products' images
  • Xendit - For this opportunity and problem statement
  • David - For enablement

xenelectronic's People

Contributors

prawiragenestonlia avatar

Watchers

 avatar

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.