Artventuria API

May 2, 2025 ยท View on GitHub

API backend for the Artventuria application, enabling the management of artworks, badges, points, and social interactions.

๐Ÿš€ Features

  • Authentication and authorization with JWT
  • Artwork and collection management
  • Points system and ranking
  • NFC tag validation
  • Firebase notification system
  • API documentation with Swagger

๐Ÿ› ๏ธ Technologies

  • Java 21
  • Spring Boot 3.x
  • PostgreSQL 16
  • MongoDB 5
  • Kafka & Zookeeper
  • Firebase
  • Spring Security
  • Spring Data JPA/MongoDB
  • Logback
  • Swagger/OpenAPI
  • Terraform
  • Docker
  • AWS

๐Ÿ“‹ Prerequisites

  • Java 21
  • Maven 4.0.0 or higher
  • Docker and Docker Compose
  • AWS CLI (for deployment)

๐Ÿ”ง Installation

  1. Clone the repository:
git clone https://github.com/Artventuria/API.git
cd API
  1. Install dependencies:
make deps
# or manually: ./mvnw dependency:resolve
  1. Set up development environment:
# Start required services (PostgreSQL, MongoDB)
docker-compose up -d
  1. Configure environment variables in .env file (for local development)

๐Ÿš€ Running the Application

To run the application in development mode:

make dev
# or manually: ./mvnw spring-boot:run -Pdev

To run the application in production mode:

make run
# or manually: ./mvnw spring-boot:run -Pprod

๐Ÿ—๏ธ Build

To build the application:

make build
# or manually: ./mvnw package

To build for Linux (for deployment):

make linux64

๐Ÿงช Tests

Run tests:

make test
# or manually: ./mvnw test

With code coverage:

make test_coverage
# or manually: ./mvnw verify

๐Ÿ“š API Documentation

Swagger documentation is automatically generated and available at:

http://localhost:8081/swagger-ui.html

To generate OpenAPI docs:

make openapi

๐Ÿ” Code Quality

To run code quality checks:

make lint
# or manually: ./mvnw checkstyle:check

๐Ÿ—„๏ธ Database Management

Run migrations:

make migrate
# or manually: ./mvnw flyway:migrate

View migration info:

make migrate_info

Clean and reapply migrations:

make migrate_clean

๐Ÿณ Docker

Build and run with Docker:

# Development environment
docker-compose up -d

# Production environment
docker-compose -f docker-compose.prod.yml up -d

๐Ÿšข Deployment

The project uses GitHub Actions for CI/CD. To deploy:

  1. Create a tag with version number:
git tag v1.0.0
git push origin v1.0.0
  1. GitHub Actions will automatically:
    • Build the application
    • Create a Docker image
    • Push to Docker Hub
    • Deploy to the production server

๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ .deploy/                # Deployment configuration
โ”œโ”€โ”€ .github/                # GitHub workflows (CI/CD)
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main/
โ”‚   โ”‚   โ”œโ”€โ”€ java/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ com/artventuria/api/
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ config/        # Application configuration
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ controller/    # REST controllers
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ dto/           # Data Transfer Objects
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ exception/     # Custom exceptions
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ domain/        # Domain models
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ repository/    # Data access layer
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ security/      # Security configuration
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ service/       # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ resources/             # Application resources
โ”‚   โ””โ”€โ”€ test/                      # Test files
โ”œโ”€โ”€ terraform/                     # Infrastructure as Code
โ”œโ”€โ”€ docker-compose.yml             # Development services
โ”œโ”€โ”€ docker-compose.prod.yml        # Production services
โ”œโ”€โ”€ Makefile                       # Development commands
โ””โ”€โ”€ pom.xml                        # Project dependencies

๐Ÿ“ License

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