An engineering assessment based on the peck/engineering-assessment repository
Mongo DB
Spring Boot
, Spring Data
TypeScript
,React
, tailwind
, zustand
, Leaflet
, Vite
jest
,@testing-library
docker-compose
, github actions
-
Setup Database:
- Create a MongoDB database either by using
docker-compose run
or utilizing MongoDB Atlas.
- Create a MongoDB database either by using
-
Import Data and Create Index:
- Import JSON data into the database and ensure to create necessary indexes for efficient querying.
-
Build or Download Artifacts:
- Compile the backend and frontend projects, or opt to download ready-made artifacts from GitHub. If choosing the latter, note that pre-built artifacts from GitHub specify the API host as
http://127.0.0.1:8080
. To adapt to different hosts, create an.env
file with the following content:Afterward, execute the command:VITE_API_HOST=YOUR API HOST
npm run build
- Compile the backend and frontend projects, or opt to download ready-made artifacts from GitHub. If choosing the latter, note that pre-built artifacts from GitHub specify the API host as
-
Configure Application Properties:
- Create a file named
application.properties
and include the following content:spring.data.mongodb.uri=YOUR MONGODB URI
- Create a file named
-
Run Backend:
- Execute
java -jar xxx.jar --spring.config.location=YOUR application.properties PATH
to launch the backend artifact.
- Execute
-
Serve Frontend:
- Place the frontend artifact into an Nginx or any other server's static files directory to serve it.
- MongoDB offers geospatial indexing and querying capabilities, making it ideal for storing and retrieving location-based data efficiently.
- The primary reason is to convert the locations in the CSV file into GeoJSON objects. This allows for the utilization of max distance queries to find the nearest location efficiently.
mongoTemplate
provides greater flexibility compared to MongoRepository. In this project, dynamic queries were required, making MongoTemplate a better choice.
- For assessment purposes, only food items and location-related fields are handled in the RESTful API.
- Functional Components, Controllable Components,Hooks (Including Custom Hooks), Refs & ForwardRefs , Dynamic Imports.