Skip to content

Part of Pubber project REST API for managing pubs data using Spring Boot in Java

Notifications You must be signed in to change notification settings

Sewery/pubber-rest-api

Repository files navigation

Pubber REST API

The Pubber REST API is part of the Pubber project, platform designed to help users discover and explore their favorite pubs in nearby locations. This repository is reposnible for the backend REST API, which handles pub management and data access. It provides:

  • Secure Admin Endpoints: For managing pub data, including creation, updates, and deletion.
  • Public Data Access: For users to retrieve pub information for their searches.

Summary

The REST API for sharing and managing pub informations shares data about:

  • Pub details
  • Drinks & drinks styles
  • Opening hours of pubs
  • Tags & photos Built with Spring Boot in Java using JPA for database connection and OpenAPI for documentation.

Development environment

Toolchain:

  • IntelliJ IDEA
  • Gradle build system
  • Docker (for local MySQL instance)

Database configuration

  • Production - Mysql (configure via environment variables)
  • Testing - H2 in-memory database
  • Local Development (dev profile)- use included docker-compose.yml file to run MySQL server locally

API documentation

Documentation is automatically generated by OpenApi and is available at: http://{YOUR_HOST}:{YOUR_PORT}/edit/swagger-ui/index.html

Application architecture

Security Model

  • Public Endpoints (/pubs/**): Read-only access to pub details, Available without authentication
  • Admin Endpoints (All other routes): Basic authentication required

Used programming techniques

  • DTO Separation
    • clientdto - for public access
    • editdto - for admin in order to make easier access and modification of data
  • Validation
  • Error Handling
  • Controller-service-repository pattern
  • Integration tests (for now not working)

Database diagram

Database is hosted in RDS server in AWS. Screenshot showing Database Diagram

Configuration

To run application in production profile, set up following environment variables:

DB_URL=jdbc:mysql://localhost:3306/Pubber
DB_USER=root
DB_PASSWORD=securepassword
APP_USERNAME=admin
APP_PASSWORD=secret

It is also possiblity to run in develepoment profile. For this .env file is not needed. Run Docker Compose file, then execute Spring Boot application using IntelliJ IDEA.

About

Part of Pubber project REST API for managing pubs data using Spring Boot in Java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published