#Perflow
Our development environment for a full-stack web application will consist of three main parts:
- Database (Postgres).
- Backend server (Spring).
- Frontend development server (React).
We will need to set up and start these three components in the order above for everything to work.
- Install
dockeranddocker-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.
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.
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.
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.
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.
This project was bootstrapped with Create React App.
In the project directory, you can run:
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.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
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.
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.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
To build the image slider on our landing page, we are indebted to this walkthrough.