DISCLAIMER: This repository is an exercise to practice working with legacy code. Do not take it as a real project. It is not a real project.
This is the Brownfield library Monolith repository. It runs the library portal for both members and curators.
Before starting:
- Install the git hooks using the
setup.sh
Bash script - Make sure you are using Java 17 and that you have Maven installed
- To create a feature or when working in a User Story, use the User Story (or Task) code as a branch name (e.g
BL-16
). - Each new commit must start with the prefix
[BL-N]
, whereN
is the story or task number. You can exceptionally use the[fix]
prefix for short-lived branches and quick fixes.
- Every time you create a new Pull Request, make sure you add the repo administrators to the PR review + 1 person from a different team.
To compile and run the application, do
It will show the application running at localhost:8080
-
If you run
npm run dev
from theweb-client
directory, it will automatically start runningjson-server
at port 9001 and the react client at port 5173. -
json-server configuration: You will have to keep the files in
web-client/json-server
up to date if you want the web-client to work in standalone mode.
- We use
testing library
andmsw
to test components and the application. Usenpm test
to run the tests. - Make sure you keep the test server up to date when adding new tests.
The database schema is updated by using Flyway migrations. Everytime you need to update the schema, make sure you add and test the adecquate migration scripts.
Run the tests with Maven by doing mvn test
.
Use the -P
flag to control the application profiles: test
, dev
and prod
mvn -P{profile} spring-boot:run
- The
prod
profile connects the application to a Postgres database, whereas thedev
andtest
profiles use H2. - The
dev
profile loads initial data using sample.sql
statements placed in theresources
folder.
If you want to use docker instead of manually configuring a Posgres database:
docker run --name postgres-container -e POSTGRES_USER=leguin_admin -e POSTGRES_PASSWORD=leguin_forever -e POSTGRES_DB=library_db -p 5432:5432 -d postgres