Skip to content

Latest commit

 

History

History
231 lines (125 loc) · 7.39 KB

README.md

File metadata and controls

231 lines (125 loc) · 7.39 KB

MeetupMarket

This project was generated by Flatlogic Platform.

  • Frontend: React.js

  • Design: Material UI

    Frontend Folder Structure

    The generated application has the following frontend folder structure:

    src folder which contains your working files that will be used later to create the build. the src folder contains folders as:

    • actions - the instructions the user issue to the redux to either write or fetch data from the store;

    • components - this module consists of a collection of UI components of your project;

    • context - contains all your context files;

    • images - contains all images used in your project ;

    • pages - this module contains the general components for CRUD:

      • CRUD/Users folder, which includes form, helpers, page, tables folders;

      • dashboard folder;

      • error folder;

      • login folder;

      • reset folder;

      • starter folder;

      • user folder;

      • verify folder.

    • reducer - contains functions that take actions from the application, perform an action and return a new state based on the action passed into it.

    public - is the web-accessible root of the site. Basically whatever is in that folder can be opened from the browser address bar. The server won't provide user access to files outside the public.

  • Backend: NodeJS

    Backend Folder Structure

    The generated application has the following backend folder structure:

    src folder which contains your working files that will be used later to create the build. The src folder contains folders as:

    • auth - config the library for authentication and authorization;

    • db - contains such folders as:

      • api - documentation that is automatically generated by jsdoc or other tools;

      • migrations - is a skeleton of the database or all the actions that users do with the database;

      • models- what will represent the database for the backend;

      • seeders - the entity that creates the data for the database.

    • routes - this folder would contain all the routes that you have created using Express Router and what they do would be exported from a Controller file;

    • services - contains such folders as emails and notifications.

  • Database: mySQL


We offer 2 ways how to start the project locally: by running Frontend and Backend or with Docker.


To start the project:

Backend:

Please change current folder: cd backend

Adjust local db:

MacOS:

  1. Download MySQL database server: (https://dev.mysql.com/downloads/mysql/)
  2. Install the package.
  3. Afterwards, in the terminal move to the next directory: cd backend/src/db/db.config.js
  4. Change development.password to that you set for the root on MySQL installation process.

Windows:

  1. Download MySQL database server from the following link: (http://dev.mysql.com/downloads/installer/).
  2. Install the package and select Server Machine as the configuration type.

Ubuntu:

  1. sudo apt update
  2. sudo apt install mysql-server

Create database:

yarn db:create

Start production build:

yarn start

Frontend:

Please change current folder: cd frontend

Quick Start

1. Run yarn install

This will install both run-time project dependencies and developer tools listed in package.json file.

2. Run yarn start

Runs the app in the development mode.

Open http://localhost:3000 to view it in the browser. Whenever you modify any of the source files inside the /src folder, the module bundler (Webpack) will recompile the app on the fly and refresh all the connected browsers.

3. Run yarn build

Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes. Your app is ready to be deployed!

To start the project with Docker:

Description:

The project contains the docker folder and the Dockerfile.

The Dockerfile is used to Deploy the project to Google Cloud.

The docker folder contains a couple of helper scripts:

  • docker-compose.yml (all our services: web, backend, db are described here)

  • start-backend.sh (starts backend, but only after the database)

  • wait-for-it.sh (imported from https://github.com/vishnubob/wait-for-it)

    To avoid breaking the application, we recommend you don't edit the following files: everything that includes the docker folder and Dokerfile.

Run services:

  1. Install docker compose (https://docs.docker.com/compose/install/)

  2. Move to docker folder. All next steps should be done from this folder.

    cd docker

  3. Make executables from wait-for-it.sh and start-backend.sh:

    chmod +x start-backend.sh && chmod +x wait-for-it.sh

  4. Download dependend projects for services.

  5. Review the docker-compose.yml file. Make sure that all services have Dockerfiles. Only db service doesn't require a Dockerfile.

  6. Make sure you have needed ports (see them in ports) available on your local machine.

  7. Start services:

    7.1. With an empty database rm -rf data && docker-compose up

    7.2. With a stored (from previus runs) database data docker-compose up

  8. Check http://localhost:3000

  9. Stop services:

    9.1. Just press Ctr+C

Most common errors:

  1. connection refused

    There could be many reasons, but the most common are:

  • The port is not open on the destination machine.

  • The port is open on the destination machine, but its backlog of pending connections is full.

  • A firewall between the client and server is blocking access (also check local firewalls).

After checking for firewalls and that the port is open, use telnet to connect to the IP/port to test connectivity. This removes any potential issues from your application.

MacOS:

If you suspect that your SSH service might be down, you can run this command to find out:

sudo service ssh status

If the command line returns a status of down, then you’ve likely found the reason behind your connectivity error.

Ubuntu:

Sometimes a connection refused error can also indicate that there is an IP address conflict on your network. You can search for possible IP conflicts by running:

arp-scan -I eth0 -l | grep <ipaddress>

arp-scan -I eth0 -l | grep <ipaddress>

and

arping <ipaddress>

  1. yarn db:create creates database with the assembled tables (on MacOS with Postgres database)

    The workaround - put the next commands to your Postgres database terminal:

    DROP SCHEMA public CASCADE;

    CREATE SCHEMA public;

    GRANT ALL ON SCHEMA public TO postgres;

    GRANT ALL ON SCHEMA public TO public;

    Afterwards, continue to start your project in the backend directory by running:

    yarn start