diff --git a/authentication/pom.xml b/authentication/pom.xml
new file mode 100644
index 0000000..5ffcb72
--- /dev/null
+++ b/authentication/pom.xml
@@ -0,0 +1,15 @@
+
+
+ 4.0.0
+
+
+ com.coded.spring
+ Ordering
+ 0.0.1-SNAPSHOT
+
+
+ authentication
+
+
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/CustomerDetailsService.kt b/authentication/src/main/kotlin/authentication/CustomerDetailsService.kt
new file mode 100644
index 0000000..62df910
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/CustomerDetailsService.kt
@@ -0,0 +1,26 @@
+package com.coded.spring.authentication
+
+import com.coded.spring.users.UserEntity
+import com.coded.spring.users.UsersRepository
+import org.springframework.security.core.userdetails.User
+import org.springframework.security.core.userdetails.UserDetails
+import org.springframework.security.core.userdetails.UserDetailsService
+import org.springframework.security.core.userdetails.UsernameNotFoundException
+import org.springframework.stereotype.Service
+
+
+@Service
+class CustomerDetailsService(
+ private val userRepo : UsersRepository
+): UserDetailsService {
+ override fun loadUserByUsername(username: String): UserDetails {
+ val user: UserEntity = userRepo.findByUsername(username) ?:
+ throw UsernameNotFoundException("User not found ...")
+
+ return User.builder()
+ .username(user.username)
+ .password(user.password)
+ .build()
+ }
+
+}
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/JWT/AuthenticationController.kt b/authentication/src/main/kotlin/authentication/JWT/AuthenticationController.kt
new file mode 100644
index 0000000..6d68589
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/JWT/AuthenticationController.kt
@@ -0,0 +1,54 @@
+package com.coded.spring.authentication.JWT
+
+import com.coded.spring.users.UsersService
+import org.springframework.security.authentication.*
+import org.springframework.security.core.userdetails.UserDetailsService
+import org.springframework.security.core.userdetails.UsernameNotFoundException
+import org.springframework.web.bind.annotation.*
+import java.security.Principal
+
+
+@RestController
+@RequestMapping("/auth")
+class AuthenticationController(
+ private val authenticationManager: AuthenticationManager,
+ private val userDetailsService: UserDetailsService,
+ private val jwtService: JwtService,
+ private val usersService: UsersService
+) {
+
+ @PostMapping("/login")
+ fun login(@RequestBody authRequest: AuthenticationRequest): AuthenticationResponse {
+ val authToken = UsernamePasswordAuthenticationToken(authRequest.username, authRequest.password)
+ val authentication = authenticationManager.authenticate(authToken)
+
+ if (authentication.isAuthenticated) {
+ val userDetails = userDetailsService.loadUserByUsername(authRequest.username)
+ val token = jwtService.generateToken(userDetails.username)
+ return AuthenticationResponse (token)
+ } else {
+ throw UsernameNotFoundException("Invalid user request!")
+ }
+ }
+ @PostMapping("/check-token")
+ fun checkToken(
+ principal: Principal
+ ): CheckTokenResponse {
+ return CheckTokenResponse(
+ userId = usersService.findByUsername(principal.name)
+ )
+ }
+}
+
+data class AuthenticationRequest(
+ val username: String,
+ val password: String
+)
+
+data class AuthenticationResponse(
+ val token: String
+)
+
+data class CheckTokenResponse(
+ val userId: Long
+)
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/JWT/JwtAuthenticationFilter.kt b/authentication/src/main/kotlin/authentication/JWT/JwtAuthenticationFilter.kt
new file mode 100644
index 0000000..131259d
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/JWT/JwtAuthenticationFilter.kt
@@ -0,0 +1,49 @@
+package com.coded.spring.authentication.JWT
+
+import jakarta.inject.Named
+import jakarta.servlet.FilterChain
+import jakarta.servlet.http.*
+import org.springframework.context.annotation.Bean
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken
+import org.springframework.security.core.context.SecurityContextHolder
+import org.springframework.security.core.userdetails.UserDetailsService
+import org.springframework.security.web.authentication.WebAuthenticationDetailsSource
+import org.springframework.stereotype.Component
+import org.springframework.web.filter.OncePerRequestFilter
+
+
+
+@Component
+class JwtAuthenticationFilter(
+ private val jwtService: JwtService,
+ private val userDetailsService: UserDetailsService
+) : OncePerRequestFilter() {
+
+ override fun doFilterInternal(
+ request: HttpServletRequest,
+ response: HttpServletResponse,
+ filterChain: FilterChain
+ ) {
+ val authHeader = request.getHeader("Authorization")
+ if (authHeader == null || !authHeader.startsWith("Bearer ")) {
+ filterChain.doFilter(request, response)
+ return
+ }
+
+ val token = authHeader.substring(7)
+ val username = jwtService.extractUsername(token)
+
+ if (SecurityContextHolder.getContext().authentication == null) {
+ if (jwtService.isTokenValid(token, username)) {
+ val userDetails = userDetailsService.loadUserByUsername(username)
+ val authToken = UsernamePasswordAuthenticationToken(
+ userDetails, null, userDetails.authorities
+ )
+ authToken.details = WebAuthenticationDetailsSource().buildDetails(request)
+ SecurityContextHolder.getContext().authentication = authToken
+ }
+ }
+
+ filterChain.doFilter(request, response)
+ }
+}
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/JWT/JwtService.kt b/authentication/src/main/kotlin/authentication/JWT/JwtService.kt
new file mode 100644
index 0000000..69f76fb
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/JWT/JwtService.kt
@@ -0,0 +1,47 @@
+package com.coded.spring.authentication.JWT
+
+
+import io.jsonwebtoken.*
+import io.jsonwebtoken.security.Keys
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.stereotype.Component
+import java.util.*
+import javax.crypto.SecretKey
+
+@Component
+class JwtService (
+ @Value("\${jwt-secret}")
+ private val secretKeyString: String
+){
+ private val secretKey: SecretKey = Keys.hmacShaKeyFor(secretKeyString.encodeToByteArray())
+// private val secretKey: SecretKey = Keys.secretKeyFor(SignatureAlgorithm.HS256)
+ private val expirationMs: Long = 1000 * 60 * 60
+
+ fun generateToken(username: String): String {
+ val now = Date()
+ val expiry = Date(now.time + expirationMs)
+
+ return Jwts.builder()
+ .setSubject(username)
+ .setIssuedAt(now)
+ .setExpiration(expiry)
+ .signWith(secretKey)
+ .compact()
+ }
+
+ fun extractUsername(token: String): String =
+ Jwts.parserBuilder()
+ .setSigningKey(secretKey)
+ .build()
+ .parseClaimsJws(token)
+ .body
+ .subject
+
+ fun isTokenValid(token: String, username: String): Boolean {
+ return try {
+ extractUsername(token) == username
+ } catch (e: Exception) {
+ false
+ }
+ }
+}
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/Loggerfilter.kt b/authentication/src/main/kotlin/authentication/Loggerfilter.kt
new file mode 100644
index 0000000..e048104
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/Loggerfilter.kt
@@ -0,0 +1,38 @@
+package com.coded.spring.authentication
+
+import jakarta.servlet.FilterChain
+import jakarta.servlet.http.HttpServletRequest
+import jakarta.servlet.http.HttpServletResponse
+import org.springframework.stereotype.Component
+import org.springframework.web.filter.OncePerRequestFilter
+import org.springframework.web.util.ContentCachingRequestWrapper
+import org.springframework.web.util.ContentCachingResponseWrapper
+
+
+@Component
+class LoggingFilter: OncePerRequestFilter(){
+ override fun doFilterInternal(
+ request: HttpServletRequest,
+ response: HttpServletResponse,
+ filterChain: FilterChain
+ ) {
+ val cachedRequest = ContentCachingRequestWrapper(request)
+ val cachedResponse = ContentCachingResponseWrapper(response)
+
+ filterChain.doFilter(cachedRequest, cachedResponse)
+
+ logRequest(cachedRequest)
+ logResponse(cachedResponse)
+ cachedResponse.copyBodyToResponse()
+ }
+
+ private fun logRequest(request: ContentCachingRequestWrapper) {
+ val requestBody = String(request.contentAsByteArray)
+ logger.info("Request: method=${request.method}, uri=${request.requestURI}, body=$requestBody")
+ }
+
+ private fun logResponse(response: ContentCachingResponseWrapper) {
+ val responseBody = String(response.contentAsByteArray)
+ logger.info("Response: status=${response.status}, body=$responseBody")
+ }
+}
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/Profiles/ProfileController.kt b/authentication/src/main/kotlin/authentication/Profiles/ProfileController.kt
new file mode 100644
index 0000000..ff0819d
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/Profiles/ProfileController.kt
@@ -0,0 +1,20 @@
+package com.coded.spring.Profiles
+
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RestController
+
+@RestController
+class ProfileController(
+ val profilesRepository: ProfilesRepository,
+ val profilesService: ProfilesService
+){
+ @PostMapping("/auth/users/v1/profiles")
+ fun createProfiles(@RequestBody request: ProfileRequest): ProfileResponse{
+ return profilesService.createProfile(request)
+ }
+
+ @GetMapping("/auth/users/v1/profiles/list")
+ fun showProfiles() = profilesRepository.findAll()
+}
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/Profiles/ProfileEntity.kt b/authentication/src/main/kotlin/authentication/Profiles/ProfileEntity.kt
new file mode 100644
index 0000000..fd6240c
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/Profiles/ProfileEntity.kt
@@ -0,0 +1,18 @@
+package com.coded.spring.Profiles
+
+import jakarta.persistence.*
+
+
+@Entity
+@Table(name="profiles")
+data class ProfileEntity(
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ val id: Long? = null,
+ val userID: Long,
+ val firstName: String,
+ val lastName: String,
+ val phoneNumber: Long
+){
+ constructor() : this(null,0, "","",0)
+}
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/Profiles/ProfilesRepository.kt b/authentication/src/main/kotlin/authentication/Profiles/ProfilesRepository.kt
new file mode 100644
index 0000000..fdd9c47
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/Profiles/ProfilesRepository.kt
@@ -0,0 +1,7 @@
+package com.coded.spring.Profiles
+
+import jakarta.inject.Named
+import org.springframework.data.jpa.repository.JpaRepository
+
+@Named
+interface ProfilesRepository : JpaRepository
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/Profiles/ProfilesService.kt b/authentication/src/main/kotlin/authentication/Profiles/ProfilesService.kt
new file mode 100644
index 0000000..9d28883
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/Profiles/ProfilesService.kt
@@ -0,0 +1,39 @@
+package com.coded.spring.Profiles
+
+import com.coded.spring.users.UsersRepository
+import jakarta.inject.Named
+import org.springframework.security.core.context.SecurityContext
+import org.springframework.security.core.context.SecurityContextHolder
+
+@Named
+class ProfilesService (
+ private val profilesRepository: ProfilesRepository,
+ private val usersRepository: UsersRepository
+){
+ fun createProfile(request: ProfileRequest): ProfileResponse{
+ val userId = usersRepository.findByUsername(SecurityContextHolder.getContext().authentication.name)?.id ?:
+ throw IllegalArgumentException()
+ val newProfile = ProfileEntity(
+ userID = userId,
+ firstName = request.firstName,
+ lastName = request.lastName,
+ phoneNumber = request.phoneNumber
+ )
+ val savedProfile = profilesRepository.save(newProfile)
+ return ProfileResponse(savedProfile.firstName,savedProfile.lastName,savedProfile.phoneNumber)
+ }
+}
+
+data class ProfileRequest(
+ val firstName: String,
+ val lastName: String,
+ val phoneNumber: Long
+)
+
+data class ProfileResponse(
+ val firstName: String,
+ val lastName: String,
+ val phoneNumber: Long
+
+)
+
diff --git a/authentication/src/main/kotlin/authentication/SecurityConfig.kt b/authentication/src/main/kotlin/authentication/SecurityConfig.kt
new file mode 100644
index 0000000..a688500
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/SecurityConfig.kt
@@ -0,0 +1,70 @@
+package com.coded.spring.authentication
+
+import com.coded.spring.authentication.JWT.JwtAuthenticationFilter
+import jdk.jfr.Enabled
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.security.authentication.AuthenticationManager
+import org.springframework.security.authentication.AuthenticationProvider
+import org.springframework.security.authentication.dao.DaoAuthenticationProvider
+import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration
+import org.springframework.security.config.annotation.web.builders.HttpSecurity
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
+import org.springframework.security.config.http.SessionCreationPolicy
+import org.springframework.security.core.userdetails.UserDetails
+import org.springframework.security.core.userdetails.UserDetailsService
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
+import org.springframework.security.crypto.password.PasswordEncoder
+import org.springframework.security.web.SecurityFilterChain
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
+
+
+@Configuration
+@EnableWebSecurity
+class SecurityConf (
+ private val userDetailsService: UserDetailsService,
+ private val jwtAuthFilter: JwtAuthenticationFilter,
+
+ ){
+
+ @Bean
+ fun passwordEncoder(): PasswordEncoder = BCryptPasswordEncoder()
+
+ @Bean
+ fun securityFilterChain(http: HttpSecurity): SecurityFilterChain{
+ http.csrf{ it.disable()}.authorizeHttpRequests {
+// it.requestMatchers("/users/v1/list").permitAll()
+// .anyRequest().authenticated()
+// it.requestMatchers("/users/v1/create/menu").permitAll()
+// .anyRequest().permitAll()
+// it.requestMatchers("/Public/**").permitAll().requestMatchers("/users/v1/**")
+// .authenticated()
+// }
+// .formLogin {
+// it.defaultSuccessUrl("/Public/menu", true)}
+// .userDetailsService(userDetailsService)
+// return http.build()
+ it.requestMatchers("/auth/**", "/users/v1/**","/api-docs","/welcome","/Public/**").permitAll()
+ .anyRequest().authenticated()
+ }
+ .sessionManagement {
+ it.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
+ }
+ .authenticationProvider(authenticationProvider())
+ .addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter::class.java)
+
+ return http.build()
+ }
+
+ @Bean
+ fun authenticationManager(config: AuthenticationConfiguration): AuthenticationManager =
+ config.authenticationManager
+
+ @Bean
+ fun authenticationProvider(): AuthenticationProvider {
+ val provider = DaoAuthenticationProvider()
+ provider.setUserDetailsService(userDetailsService)
+ provider.setPasswordEncoder(passwordEncoder())
+ return provider
+ }
+}
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/users/UserService.kt b/authentication/src/main/kotlin/authentication/users/UserService.kt
new file mode 100644
index 0000000..32863c2
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/users/UserService.kt
@@ -0,0 +1,65 @@
+package com.coded.spring.users
+
+import jakarta.inject.Named
+import org.springframework.security.crypto.password.PasswordEncoder
+
+@Named
+class UsersService(
+ private val usersRepository: UsersRepository,
+ private val encoder: PasswordEncoder,
+) {
+
+ fun createUser(request: AddUserRequest): addedUserResponse{
+ val myNewUserEntity = UserEntity(
+ name = request.name,
+ age = request.age,
+ username = request.username,
+ password = encoder.encode(request.password),
+ )
+ if (request.username.isBlank()){
+ throw IllegalArgumentException("username not correct")}
+
+ val savedUser= usersRepository.save(myNewUserEntity)
+
+ return addedUserResponse(savedUser.id,savedUser.username)
+ }
+
+ fun listUsers(): List = usersRepository.findAll().map {
+ User(
+ name = it.name,
+ age = it.age
+ )
+ }
+
+ fun findByUsername(name: String): Long {
+ return usersRepository.findByUsername(name)?.id ?:
+ throw IllegalArgumentException("username not found")
+ }
+
+}
+
+
+fun isValidPassword(password: String): Boolean {
+
+ return password.length >= 6 && password.any { it.isDigit() } && password.any { it.isUpperCase() }
+}
+
+
+data class AddUserRequest(
+ val name: String,
+ val username: String,
+ val password: String,
+ val age: Int
+)
+
+
+
+data class addedUserResponse(
+ val id: Long?,
+ val username: String
+)
+
+data class User(
+ val name: String,
+ val age: Int
+)
\ No newline at end of file
diff --git a/authentication/src/main/kotlin/authentication/users/UsersController.kt b/authentication/src/main/kotlin/authentication/users/UsersController.kt
new file mode 100644
index 0000000..5de4230
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/users/UsersController.kt
@@ -0,0 +1,39 @@
+package com.coded.spring.users
+
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.http.ResponseEntity
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RestController
+
+@RestController
+class UsersController(
+ val usersRepository: UsersRepository,
+ val usersService: UsersService,
+ @Value("\${server-welcome-message}")
+ val companyMessage: String,
+){
+
+ @GetMapping("/welcome")
+ fun welcome() = "Welcome to Online Ordering by $companyMessage"
+
+
+ @GetMapping("/users/v1/list")
+ fun sayUsers() = usersRepository.findAll()
+
+
+ @PostMapping("/users/v1/create")
+ fun createUser(@RequestBody request: AddUserRequest):Any{
+ return try {
+ usersService.createUser(request)
+ ResponseEntity.ok("user is good to go")
+ } catch (e: IllegalArgumentException){
+ ResponseEntity.badRequest().body(e.message)
+ }
+
+
+ }
+
+}
+
diff --git a/authentication/src/main/kotlin/authentication/users/UsersRepository.kt b/authentication/src/main/kotlin/authentication/users/UsersRepository.kt
new file mode 100644
index 0000000..12c0120
--- /dev/null
+++ b/authentication/src/main/kotlin/authentication/users/UsersRepository.kt
@@ -0,0 +1,27 @@
+package com.coded.spring.users
+
+import jakarta.inject.Named
+import jakarta.persistence.*
+import org.springframework.data.jpa.repository.JpaRepository
+
+@Named
+interface UsersRepository : JpaRepository {
+ fun age(age: Int): MutableList
+
+ fun findByUsername(username: String): UserEntity?
+}
+
+@Entity
+@Table(name = "users")
+data class UserEntity(
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ var id: Long? = null,
+ var name: String,
+ var age: Int,
+
+ val username: String,
+ val password: String
+){
+ constructor() : this(null, "", 0,"","")
+}
diff --git a/ordering/pom.xml b/ordering/pom.xml
new file mode 100644
index 0000000..bb6a78e
--- /dev/null
+++ b/ordering/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+ com.coded.spring
+ Ordering
+ 0.0.1-SNAPSHOT
+
+
+ ordering
+
+
+
+
+
\ No newline at end of file
diff --git a/ordering/src/main/kotlin/client/AuthenticationClient.kt b/ordering/src/main/kotlin/client/AuthenticationClient.kt
new file mode 100644
index 0000000..e1dab33
--- /dev/null
+++ b/ordering/src/main/kotlin/client/AuthenticationClient.kt
@@ -0,0 +1,35 @@
+package com.coded.spring.client
+
+import jakarta.inject.Named
+import org.springframework.core.ParameterizedTypeReference
+import org.springframework.http.HttpEntity
+import org.springframework.http.HttpMethod
+import org.springframework.util.MultiValueMap
+import org.springframework.web.client.RestTemplate
+import org.springframework.web.client.exchange
+
+
+@Named
+class AuthenticationClient {
+
+ fun checkToken(token: String): CheckTokenResponse {
+ val restTemplate = RestTemplate()
+ val url = "http://localhost:8080/authentication/v1/check-token"
+ val response = restTemplate.exchange(
+ url = url,
+ method = HttpMethod.POST,
+ requestEntity = HttpEntity(
+ MultiValueMap.fromMultiValue(mapOf("Authorization" to listOf("Bearer $token")))
+ ),
+ object : ParameterizedTypeReference() {
+ }
+ )
+ return response.body ?: throw IllegalStateException("Check token response has no body ...")
+ }
+
+}
+
+
+data class CheckTokenResponse(
+ val userId: Long
+)
\ No newline at end of file
diff --git a/ordering/src/main/kotlin/ordering/MenuController.kt b/ordering/src/main/kotlin/ordering/MenuController.kt
new file mode 100644
index 0000000..f74b8f6
--- /dev/null
+++ b/ordering/src/main/kotlin/ordering/MenuController.kt
@@ -0,0 +1,26 @@
+package com.coded.spring.ordering
+
+import org.springframework.http.ResponseEntity
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestParam
+import org.springframework.web.bind.annotation.RestController
+
+@RestController
+class MenuController(
+ val menuRepository: MenuRepository,
+ val menuService: MenuService
+){
+
+ @GetMapping("/Public/menu")
+ fun sayUsers(@RequestParam(required = false) search: String?) = menuService.listMenu(search)
+
+
+ @PostMapping("Public/users/v1/create/menu")
+ fun menuAdd(@RequestBody requestMenu: RequestMenu): Any {
+// val newMenu = menuService.addMenu(request)
+ return ResponseEntity.ok().body(menuService.addMenu(requestMenu))
+ }
+
+}
\ No newline at end of file
diff --git a/ordering/src/main/kotlin/ordering/MenuEntity.kt b/ordering/src/main/kotlin/ordering/MenuEntity.kt
new file mode 100644
index 0000000..ee0b055
--- /dev/null
+++ b/ordering/src/main/kotlin/ordering/MenuEntity.kt
@@ -0,0 +1,18 @@
+package com.coded.spring.ordering
+
+import jakarta.persistence.*
+import java.math.BigDecimal
+
+@Entity
+@Table(name="menu")
+data class MenuEntity(
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ val id: Long? = null,
+// @Column(name = "name")
+// val myFieldName: String,
+ val name: String,
+ val price: BigDecimal
+){
+ constructor() : this(null,"", BigDecimal.ZERO)
+}
\ No newline at end of file
diff --git a/ordering/src/main/kotlin/ordering/MenuRepository.kt b/ordering/src/main/kotlin/ordering/MenuRepository.kt
new file mode 100644
index 0000000..d07cacd
--- /dev/null
+++ b/ordering/src/main/kotlin/ordering/MenuRepository.kt
@@ -0,0 +1,7 @@
+package com.coded.spring.ordering
+
+import jakarta.inject.Named
+import org.springframework.data.jpa.repository.JpaRepository
+
+@Named
+interface MenuRepository : JpaRepository
\ No newline at end of file
diff --git a/ordering/src/main/kotlin/ordering/MenuService.kt b/ordering/src/main/kotlin/ordering/MenuService.kt
new file mode 100644
index 0000000..f103cb4
--- /dev/null
+++ b/ordering/src/main/kotlin/ordering/MenuService.kt
@@ -0,0 +1,56 @@
+package com.coded.spring.ordering
+
+import com.coded.spring.serverCache
+import org.springframework.stereotype.Service
+import java.math.BigDecimal
+
+@Service
+class MenuService(
+ val menuRepository: MenuRepository
+) {
+ fun addMenu(request: RequestMenu): MenuEntity {
+ val newMenu = MenuEntity(
+ name = request.menuName,
+ price = request.price
+ )
+ return menuRepository.save(newMenu)
+ }
+
+ fun listMenu(search: String?): List