Coder Social home page Coder Social logo

cafeplugguardian-server's Introduction

CafePlugGuardian-Server

CafePlugGuardian Project

Introduction

CafePlugGuardian is a capstone design project at the Chung-Ang University's Department of Software Engineering.

Please note that we will not be accepting contributions for CafePlugGuardian, as it is a Capstone Design Project.

The Goal of CafePlugGuardian Project

  1. The pin number allows only cafe customers to use the plug, preventing unauthorized use of the plug.
  2. Limit the amount of electricity to restrict customers who use excessive power or stay for long periods of time.
  3. By analyzing the current patterns of devices in use, devices not permitted in the cafe, such as smartphones and laptop chargers, are automatically blocked through machine learning.

Structure of CafePlugGuardian

Sub Projects of CafePlugGuardian

Additional Requirements

  • MongoDB
    • NoSQL DBMS
    • In our project, we install and use mongoDB on an ec2 instance.
    • Install and run mongoDB, or use a mongoDB server.
  • MQTT Broker
    • In our project, we install and use mosquitto as an MQTT broker on an ec2 instance.
    • You can install another MQTT broker or use a separate broker server if you have one.

CafePlugGuardian-Server

Introduction

CafePlugGuardian-Server is a part of CafePlugGuardian project.

The goal of the CafePlugGuardian-Server project is to implement a backend server to act as an intermediary for the CafePlugGuardian project.

  • Web, App: Receives http API requests and performs service logic.
  • Smart plug: Except when the app directly accesses the plug's AP when connecting the plug for the first time, all communication with the plug is done using the MQTT protocol through an MQTT broker in the backend.
  • Artificial intelligence Server: The current pattern is transmitted to a separate artificial intelligence server to check whether the device is allowed and process the logic accordingly.
  • Database: This backend server is the only one in the CafePlugGuardian project that accesses the database and manages data.

How to use CafePlugGuardian-Server

  1. Prepare a computer to run the backend server
    • In our project, we ran it on Amazon Linux 2 on an ec2 instance of AWS (Amazon Web Service).
  2. Install node.js in the environment
    • Version 16 of node was used.
    • It is highly likely that a lower version is possible, but it has not been verified.
    • Conversely, operation was confirmed in version 18.
  3. Prepare mongoDB server
    • In our project, we installed and used mongoDB on the same ec2 instance as the backend server.
    • You can also use a server such as AWS's DocumentDB or Atlas' mongoDB Cloud.
  4. Prepare the MQTT broker server
    • In our project, we installed and used an MQTT broker called mosquitto on the same ec2 instance as the backend server.
    • You can install an MQTT broker other than mosquitto, or use a server that provides an MQTT broker.
  5. Clone or Fork CafePlugGuardian-Server project
    • Download directly from the environment where you will run the server, or download it locally and set the environment before uploading it.
  6. Set environment with .env file
    • Rename or copy the /src/config/private/.env-sample file to use.
    • DB, MQTT broker URL, password, encryption key, etc. are stored and used in this file.
    • You can change the name to whatever you want, but the name previously used in the project is as follows.
      • .env.development.local: Environment configuration file used when developing locally.
      • .env.production.local: Environment configuration file used during deployment.
      • .env.test.local: Configuration file used when using a different database by separating the test environment and development environment.
    • If you want to use any other name, do the following:
      1. Be careful not to expose sensitive information to GitHub by creating an .env file with the desired name and adding it to .gitignore.
      2. Modified conditional statements for environments added to /src/config/environment.ts.
      3. Add a command to execute the environment in the scripts of package.json or modify the existing script.
  7. Install pm2 globally in the environment where the backend server will run
    • npm install -g pm2
    • pm2 is a non-stop service based on node.js. Unlike other dependency packages, pm2 must be installed globally, so install it using the above command in the terminal.
  8. Install dependency packages with npm
    • npm install
    • Install dependency packages using the above command in the project directory in the environment where the server will run.
  9. Running backend server
    1. npm start
      • This command runs the server in the deployment environment.
      • Runs as an uninterrupted service using pm2.
    2. npm run dev
      • This command runs the server in the local development environment.
      • When developing using nodemon, when you modify the code, it is automatically reflected without the need to turn off and restart the development server.

License

This program is licensed under MIT

cafeplugguardian-server's People

Contributors

keylime7 avatar

Stargazers

 avatar

Watchers

 avatar

cafeplugguardian-server's Issues

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.