/shop-finder

A Spring Boot+React/Redux+MongoDB App that lists shops nearby your current location.

Primary LanguageJavaMIT LicenseMIT

Shop Finder App

This app lists shops nearby the current location of the user.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

The Java code is available in the backend sub-project. The frontend sub-project contains the javascript code.

Application Data

First of all, you need to setup the MongoDB database.

A MongoDB dump with ~300 shops is provided. To import the data, you need to extract the zip file then execute the command below :

mongorestore --db shop_finder shop_finder/

→ → A shop_finder database will be created with shops, blacklisted_shops, preferred_shops, and users collections.

→ → Dump File : here

The recommended way to launch the server is to use your favorite java IDE.The main method of the application is in the ShopFinderApplication class.

You will need node 8.9.4+ and yarn to run the dev server and build the project

I strongly recommend that you install yarn on your development machine.

After running the backend, in the project directory you can run:

./gradlew frontend:start

This command runs the frontend in development mode.
Open http://localhost:3000 to view it in the browser

Alternatives for running the projects

There is also a gradle task to run the spring server.
In the project directory you can run:

./gradlew frontend:bootRun

This command runs the backend in development mode.

Hot reloading

With the dev server running, saving your javascript or css files will automatically trigger the hot reloading (without browser refresh) of the application.

For the backend, recompiling the project in your IDE will trigger the reloading of the application’s class loader.

Deployment

This command will build the frontend and include it in the jar.

./gradlew clean build

The jar will be available in ./build/libs/shop-finder-1.0.0.RELEASE.jar

You can then launch it with:

java -jar build/libs/shop-finder-1.0.0.RELEASE.jar

Then, you can open http://localhost:8080 to view the application in the browser.

NB: The frontend can be build alone with the bundle task so you can use frontend:bundle. The backend build task depends on the frontend bundle task.

Built With

  • Axios - Promise based HTTP client for the browser and node.js

  • Create React App - Used to generate React app as the frontend with no build configuration

  • com.moowork.node - Gradle plugin for executing node scripts

  • Gradle - Dependency Management and Build tool

  • jjwt - JSON Web Token for Java

  • node-jsonwebtoken - JsonWebToken implementation for node.js

  • MongoDB - A NoSQL Document Database

  • ModelMapper - Simple, Intelligent, Object Mapping

  • react-geolocated - React Higher-Order Component for using Geolocation API

  • Redux - A predictable state container for JavaScript apps

  • Redux First Router - Seamless redux-first routing — just dispatch actions

  • Semantic-UI-React - A modern front-end development framework that empowers designers and developers by creating a shared vocabulary for UI

  • Spring Boot - Allows to create executable Spring applications with a convention over configuration approach

  • Spring MVC - Provides Model-View-Controller (MVC) architecture and ready to use components to develop flexible and loosely coupled web applications

  • Spring Security - The de-facto standard for securing Spring-based applications

  • Yarn - A package manager for node.js modules

Authors