Skip to content

abdnaqeeb/perflow

 
 

Repository files navigation

#Perflow

Setup

Our development environment for a full-stack web application will consist of three main parts:

  1. Database (Postgres).
  2. Backend server (Spring).
  3. Frontend development server (React).

We will need to set up and start these three components in the order above for everything to work.

Prerequisites

  • Install docker and docker-compose.
  • Install Nodejs.
  • Install a proper IDE/Text editor fo Java and Javascript. IntelliJ community edition is recommended for Java development but doesn't work very well with JavaScript. It's therefore recommended to use VS Code or any other JavaScript-friendly IDE when working with frontend code.

Starting the database

To start the database open the terminal and cd your way in to the project root folder. You can just simply run docker-compose up to start the database. Closing the terminal will kill the database. So you need to restart the database every time you need to use it.

Starting the backend server

Open the root folder in IntelliJ and import all the gradle dependencies (this has to be done only once of course).

Make sure that the database is running (see steps above) otherwise the backend won't have access to it. Then run the main class at src/main/java/se/kth/sda6/perflow/PerflowApplication.java to start the web server.

Starting the frontend development server

To install the project dependencies for the frontend, open the terminal and make sure that the current directory is frontend. You can then run npm install to install all the dependencies needed for the project (This has to be done only once).

To start the frontend server run npm start from the frontend directory. Make sure that database and backend server are also running so that the frontend can interact with the backend. When working on the frontend, open the frontend folder in your favorite Javascript IDE.

FAQ

How can I connect to running database from terminal?

Sometimes you might want to inspect the tables, run raw queries, seed the database, check that a certain backend action has been performed correctly. To do that you can simply run the following command

docker run -it --network host postgres:11-alpine psql -h localhost -U perflow_user -p 5003 -W perflow

Use the password specified in docker-compose.yaml.

Frontend Specific Information

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run 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!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

npm run build fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

Credits

Image Slider

To build the image slider on our landing page, we are indebted to this walkthrough.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 54.9%
  • Java 39.4%
  • CSS 4.1%
  • HTML 1.6%