Skip to content

yersonargote/restaurant

Repository files navigation

Restaurant app

App to manage menu, orders and customers for a restaurant.

My first app using spring boot 3 and gradle.

Build and run

I will use docker and docker-compose.

  1. Clone the repository
git clone yersonargote/restaurant && cd restaurant
  1. Load env variables
source .env

Note: The environment variables needed are in docker-compose.yml and application.yml.

  1. Build app
DOCKER_BUILDKIT=1 docker build -t yersonargote/restaurant . 
  1. Run app
docker-compose up

Shutdown the app do docker-compose down

API

Auth

Register user

POST request localhost:8080/api/v1/auth/register

Body request example:

{
  "username": "test",
  "password": "test"
}

Login

POST request localhost:8080/api/v1/auth/login

Body request example:

{
  "username": "test",
  "password": "test"
}

Todo list

Security and Auth

  • Register user
  • Login
    • Oauth2 with GitHub
  • Logout
  • Redirect to page when login

Dinning Room

  • Create entities
  • Relationships between entities
  • Create repositories
  • Create services
  • Create controllers

Native Compilation

  1. Native images with spring boot and gradle

Install plugin.

plugins {
  id 'org.graalvm.buildtools.native' version '0.9.14'
}
./gradlew nativeCompile

Commands

  • To run the app using only console
./gradlew bootRun
  • To compile a native image in a container
./gradlew bootBuildImage --imageName=yersonargote/restaurante
  • To compile app
./gradlew nativeCompile
  • To have AOT optimized app
./gradlew bootJar

Resources

Spring Security, demystified by Daniel Garnier Moiroux

Spring boot 3.0 - Secure your API with JWT Token 2023

Spring Boot and OAuth2