Skip to content

The Table Talk backend is a Spring Boot application that provides a robust API for managing restaurant operations. It features real-time communication through WebSockets, secure authentication, and a comprehensive set of REST endpoints for table, order, menu, and product management.

License

Notifications You must be signed in to change notification settings

gorocode/tt-spring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table Talk - Backend Service

Spring Boot Java PostgreSQL Docker

Demo credentials (all with password Password1234$):

Username Role
admin Administrator (full access)
manager Manager (reporting and management)
worker Staff (day-to-day operations)

📋 Overview

The Table Talk backend is a Spring Boot application that provides a robust API for managing restaurant operations. It features real-time communication through WebSockets, secure authentication, and a comprehensive set of REST endpoints for table, order, menu, and product management.

✨ Features

  • RESTful API: Complete set of endpoints for managing all aspects of the restaurant
  • WebSocket Support: Real-time updates for kitchen and table order management
  • Authentication & Authorization: Secure user authentication and role-based access control
  • Database Integration: Persistent storage with PostgreSQL
  • Data Validation: Comprehensive input validation and error handling
  • Printing Support: Integration with receipt and kitchen printers

🛠️ Technology Stack

  • Framework: Spring Boot 3.x
  • Language: Java 17
  • Database: PostgreSQL
  • ORM: Spring Data JPA
  • API Documentation: Swagger/OpenAPI
  • Security: Spring Security with JWT
  • Real-time Communication: WebSocket (STOMP)
  • Build Tool: Maven
  • Containerization: Docker

🚀 Installation

Prerequisites

  • JDK 17+
  • Maven
  • PostgreSQL (or Docker)

Local Development Setup

  1. Clone the repository:

    git clone https://gitlab.com/goromigue/tt-bar-manager.git
    cd tt-bar-manager/tt-spring
  2. Configure database in application.properties:

     FRONTEND_URL=http://localhost:5173
     SPRING_DATASOURCE_URL=jdbc:postgresql://postgres-db:5432/tabletalk
     SPRING_DATASOURCE_USERNAME=user
     SPRING_DATASOURCE_PASSWORD=tableuser
     SPRING_JPA_HIBERNATE_DDL_AUTO=update
     SPRING_JPA_SHOW_SQL=false
     JWT_SECRET=yourStrongSecretKeyHere
     JWT_EXPIRATION_MS=86400000
  3. Build the application:

    mvn clean install
  4. Run the application:

    mvn spring-boot:run
  5. The API will be available at http://localhost:8080

🏗️ Architecture

The backend follows a layered architecture with the following components:

Controller Layer

  • REST controllers that handle HTTP requests
  • WebSocket message handlers

Service Layer

  • Business logic implementation
  • Transaction management

Data Access Layer

  • JPA repositories for database operations
  • Entity mappings

DTOs (Data Transfer Objects)

  • Objects for data exchange with clients
  • Separation from internal entities

Mappers

  • Conversion between entities and DTOs
  • Using MapStruct for efficient mapping

📦 API Endpoints

The backend exposes several endpoints for different aspects of the application:

  • /auth: Authentication endpoints
  • /menu: Menu and category management
  • /products: Product information and stock management
  • /orders: Order creation and management
  • /tables: Table management
  • /map: Restaurant layout management
  • /kitchen: Kitchen-specific endpoints
  • /invoice: Invoice generation and management
  • /print: Printing service integration

For detailed API documentation, refer to the API Documentation.

🧪 Testing

The application includes different types of tests:

# Run unit tests
mvn test

# Run integration tests
mvn verify -P integration-test

🔄 Database Migrations

Database schema is managed through JPA entity definitions with Hibernate DDL:

spring.jpa.hibernate.ddl-auto=update

For production, it's recommended to use a proper database migration tool like Flyway or Liquibase.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

The Table Talk backend is a Spring Boot application that provides a robust API for managing restaurant operations. It features real-time communication through WebSockets, secure authentication, and a comprehensive set of REST endpoints for table, order, menu, and product management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published