This repository contains the backend made for the Urban Infusion project from NTNU's Application Development (IDATA2306) subject. The project counts towards 100% of the final grade in the subject.
The front-end part can be found here: https://github.com/Marko19907/urban-infusion-website
- Kotlin - A modern, cross-platform, statically typed, general-purpose programming language.
- Spring Boot - Server framework used to build the REST API.
- Docker - Used to containerize the app.
- MySQL - For the persistent database.
- Apache Derby - Used for the embedded database.
- HTTPS - Used for communications security in production.
- JWT - As the authentication mechanism.
To get a local copy up and running follow these simple steps.
This is a list of things you need in order to use this application.
- IntelliJ IDEA 2022.1.0 or newer, necessary as Kotlin is bundled in the IDE, not needed if building directly with Maven
- JDK 17 or newer, always needed
- Docker is not needed
- A database installation is not needed, the server can run in embedded mode with the Apache Derby database
Via HTTPS:
git clone https://github.com/Marko19907/Urban-Infusion-server.git
Via SSH:
git clone [email protected]:Marko19907/Urban-Infusion-server.git
or download it directly as a zip from here.
- Download the latest build from this repository's "Releases" page
- Run the downloaded
.jar
with the CMD using thejava -jar nameOfTheJarFile.jar
command. - The server should then start with an embedded database and be available at http://localhost:8080
This is the preferred method.
- Make sure you have installed the correct version of IntelliJ as specified in the "Prerequisites" section.
- Download and the extract zip-file or clone project to the desired location as specified in the "Downloading the project" section.
- Open the
pom.xml
file with IntelliJ. - In IntelliJ, launch the
Application
class located in theno.ntnu.webdev.webproject7
package. - The server should then start with an embedded database and be available at http://localhost:8080
Options in other IDEs may vary.
- Clone or download the repo as a zip as specified in the "Downloading the project" section.
- Run
mvn package
in the project folder with an IDE of your choice. - Navigate to the
/target
folder and launch the generated.jar
with the CMD. - The server should then start with an embedded database and be available at http://localhost:8080
webproject7
├───configs
├───controllers
├───dto
├───exceptions
├───models
├───repositories
├───security
├───serializers
├───services
└───utilities
We have tried to keep the project organized by categorizing classes into packages by their respective domains.
Contains the different configurations, for ex. cors and security configs
Houses the controller classes that provide the REST endpoints for the app
Contains all the different DTOs (Data Transfer Objects)
Contains the different exceptions that are used to signal errors
Contains the repository classes tasked with connecting to the DB
The JWT implementation
Houses the custom JSON deserializers that translate strings to enum types
Contains all the service classes that house the business logic
Contains mostly static functions that are used throughout the app
The following is our database schema:
The application has two main roles:
- Admin
- User
An admin can do everything that a user can but admins can access extra functionality that is not available to users.
A user can:
- Signup and log in
- View products
- Send in an order
- Write a comment for a product
- Edit their own comment
- See other user's comments
An admin can:
- Add a new product
- Update a product
- Delete a product
- See all user orders
- Mark an order as processed
- See all user comments for each product
- Delete any user comment
Our app currently has a predefined admin user and a regular user used under testing:
Admin:
- username: admin
- password: admin
User:
- username: user
- password: user
Note: These predefined users are only meant to be used for demo and development purposes, they should not be included in a real scenario.
- All product images used were fetched from pngegg.com and are covered by their non-commercial use only license.
- The user images used in this project have been generated by an AI and do not depict any person currently alive or dead.