Giter Club home page Giter Club logo

luisgcenci / restaurant-booking-system Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 5.0 5.96 MB

A booking web app for Restaurants built with MERN stack. Users can signup/signin and book tables.

Home Page: https://restaurant-booking-system.netlify.app/home

License: MIT License

HTML 4.77% JavaScript 81.54% CSS 9.71% TypeScript 3.83% Shell 0.14%
express flex-box jwt-authentication mern-stack mongodb nodejs react react-router-dom redux-persist restaurant-booking-system

restaurant-booking-system's Introduction

Restaurant Booking System

A booking system for restaurants where users can signin/signup and reserve tables for a given date and time.

alt text

Table of Contents

General Info
Technologies
Architecture
Application Structure
Set Up

General Info

The goal of this project was to design, develop and deploy in the Cloud a full stack web app using Figma, the MERN stack and AWS services. MVCS pattern was used in the backend of this application. This project was for training purposes.

Technologies

  • UI
    • Figma
  • Frontend
    • React
    • Yarn
    • Typescript
    • Redux (redux-persist)
    • React Router
    • Axios
    • Konva
  • Backend
    • Node.js
    • Express
    • MongoDB Atlas (mongoose)
    • JSON Web Tokens
    • Bcrypt
  • Backend Infrastructure (AWS)
    • EC2
      • Ubuntu 22.04
      • PM2
      • Snap
      • Apache (Reverse Proxy)
      • Certbot (SSL Certificate)
    • Elastic IPs
    • Route53

Architecture

alt text

Application Structure

backend
├── config
│   └── database.js
├── controllers
│   └── User.controller.js
│   └── Company.controller.js
├── middleware
│   └── auth.js
├── models
│   └── User.js
│   └── Company.js
├── routes
│   └── User.routes.js
│   └── Company.routes.js
├── services
│   └── UserService.js
│   └── CompanyService.js
├── server.js
└── .env
  • config/ - Mongoose config to connect with MongoDB.
  • controllers/ - Serves the responses.
  • middleware/ - Verifies JWT Token.
  • models/ - Schema definitions for mongoose models.
  • routes/ - Routes for API.
  • services/ - Business logic between controllers and models.
  • server.js - Entry point of application.
  • .env - Environment Variables
client
└── src
    ├── apps
    │   ├── auth-app
    │   │   └── components
    │   └── internal-app
    │       ├── components
    │       ├── containers
    │       └── pages
    │           ├── booking
    │           ├── home
    │           └── settings
    ├── hooks
    │   └── hooks.ts
    ├── public
    └── store
    │   ├── features
    │   └── store.ts
    └── index.js
  • src/ - Source Files.
  • apps/ - Applications within the main app.
  • hooks/ - Hooks for Redux.
  • public/ - Assets folder.
  • store/ - Redux Store and reducers.
  • index.js - Entry point of the main app.

Set Up

Backend

  • Clone this repo https://github.com/luisgcenci/restaurant-booking-system.git

  • Install Dependencies

    cd backend/
    yarn install
    
  • Open .env file and insert mongodb uri and replace TOKEN_KEY with a random string.

    TOKEN_KEY is used to create JWT Auth.

    MONGO_URI="mongodb+srv://username:[email protected]/?retryWrites=true&w=majority"
    TOKEN_KEY="RANDOMSTRING"
    
  • SSL/HTTPS Config

    Adjust server.js to server https when deployed in EC2 Instance.

    const https = require('https');
    const fs = require('fs');
    
    const options = {
    key: fs.readFileSync('privkey.pem'),
    cert: fs.readFileSync('cert.pem')
    }
    
    const httpsServer = https.createServer(options, app);
    httpsServer.listen(port, () => console.log(`Listening on port ${port}`));
  • How to Run
    node server.js

  • How to Deploy
    Deploy NodeJS in AWS EC2 - My Notes from Notion

Frontend

  • Clone this repo https://github.com/luisgcenci/restaurant-booking-system.git
  • Install Dependencies
    cd client/
    yarn install
    
  • Open index.js file and insert and point axios default baseUrl to your API endpoint.
    axios.defaults.baseURL = 'https://restaurant-booking-system.ga:5000/'
    Now you can send axios requests through the app like this
        axios.get('api/v1/user/auth').
        then( (response) =>{
            //do something with response
        }).catch((err) => {
            // handle errors
        });
  • How to Run
    yarn start
  • How to Deploy
    Deploy React on Netlify

Status and Bugs

restaurant-booking-system's People

Contributors

luisgcenci avatar

Stargazers

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

Watchers

 avatar  avatar  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.