Skip to content

akarengin/TikTakBackend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TikTak Backend

A modern vehicle inspection and documentation system built with Spring Boot. This application provides a robust backend for managing vehicle inspection workflows, including:

  • Vehicle Inspection Management: Track and document vehicle conditions with detailed reports
  • Questionnaire System: Customizable inspection checklists with yes/no questions
  • Photo Documentation: Attach multiple photos to each inspection item
  • RESTful API: Well-documented endpoints for seamless integration
  • Observability: Built-in OpenTelemetry support for monitoring and tracing

Built with Spring Boot 3, PostgreSQL, and Docker for easy deployment.

Prerequisites

  • Java 17
  • Docker and Docker Compose
  • Maven

Quick Start

  1. Clone the repository

    git clone <your-repo-url>
    cd tiktak-backend
  2. Start PostgreSQL with Docker

    docker-compose up -d postgres
  3. Run the application

    ./mvnw spring-boot:run

Profiles

  • dev: Development profile with PostgreSQL database and auto-created schema
  • test: Uses H2 in-memory database (automatically configured via test scope dependencies)
  • prod: Production profile with PostgreSQL and Flyway migrations

Docker Commands

  • Start PostgreSQL: docker-compose up -d postgres
  • Stop PostgreSQL: docker-compose stop postgres
  • View logs: docker-compose logs postgres
  • Access PostgreSQL shell: docker-compose exec postgres psql -U tiktak_user -d tiktak_db

Database Configuration

The application uses PostgreSQL with the following default configuration:

  • Host: localhost:5432
  • Database: tiktak_db
  • User: tiktak_user
  • Password: tiktak_password (default)

API Endpoints

  • Health Check: GET http://localhost:8080/actuator/health
  • Application Info: GET http://localhost:8080/actuator/info

Health & Monitoring

  • Health Check: GET http://localhost:8080/actuator/health
  • Metrics: GET http://localhost:8080/actuator/metrics
  • Tracing: View traces in Jaeger UI at http://localhost:16686

Monitoring

The application includes built-in monitoring capabilities:

  • Jaeger: Distributed tracing
  • Micrometer: Application metrics
  • Actuator: Production-ready features

Expertise API

Base path: /api/expertises

  • GET /api/expertises

    • Description: Get the latest expertise records for a car.
    • Query parameters:
      • carId (string, required)
    • Response: 200 OK with a JSON array of ExpertiseResponse
    • cURL example:
      curl -X GET "http://localhost:8080/api/expertises?carId=45DEF67"
  • POST /api/expertises

    • Description: Create a new expertise for a car.
    • Request body: CreateExpertiseRequest (application/json)
    • Response: 201 Created with empty body
    • cURL example:
      curl -X POST 'http://localhost:8080/api/inspections' \
      -H 'Content-Type: application/json' \
      -d '{
        "carId": "45DEF67",
        "answers": [
          {
            "questionId": 1,
            "yesNo": true,
            "description": "Headlight cracked",
            "photos": [
              "http://headlight1.jpg"
            ]
          },
          {
            "questionId": 2,
            "yesNo": false,
            "description": "",
            "photos": []
          },
          {
            "questionId": 3,
            "yesNo": true,
            "description": "Bald tires, immediate replacement needed",
            "photos": [
              "http://tire1.jpg",
              "http://tire2.jpg"
            ]
          }
        ]
      }'

Schemas

  • CreateExpertiseRequest

    {
      "carId": "string",
      "answers": [
        {
          "questionId": 0,
          "yesNo": true,
          "description": "string",
          "photos": ["string"]
        }
      ]
    }
  • ExpertiseResponse

    {
      "id": 0,
      "carId": "string",
      "createdAt": "2025-01-01T12:34:56Z",
      "answers": [
        {
          "questionId": 0,
          "yesNo": true,
          "description": "string",
          "photos": ["string"]
        }
      ]
    }

Development

  1. Make sure PostgreSQL is running: docker-compose up -d postgres
  2. Run tests: ./mvnw test
  3. Build application: ./mvnw clean package

Environment Variables (Optional)

You can override the default database configuration using environment variables:

  • POSTGRES_DB: Database name (default: tiktak_db)
  • POSTGRES_USER: Database user (default: tiktak_user)
  • POSTGRES_PASSWORD: Database password (default: tiktak_password)
  • DB_USERNAME: Spring Boot database username (default: tiktak_user)
  • DB_PASSWORD: Spring Boot database password (default: tiktak_password)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages