Skip to content

Repository files navigation

So-Yummy Application

So-Yummy is a production-grade RESTful API service developed with Kotlin and the Spring Boot framework, crafted to celebrate healthy cooking through effortless recipe and ingredient management. Containerized using Docker for consistent deployment across development, testing, and production environments, the platform transforms how users discover, organize, and share nutritious meals — making healthy eating both accessible and enjoyable.

The application leverages MongoDB as its primary NoSQL database for flexible, document-based data storage, while implementing token-based authentication via JSON Web Tokens (JWTs) to ensure secure user access. Through its comprehensive RESTful API, users can create, search, and manage personalized collections of favorite recipes and ingredients. The API features pagination across all collection endpoints for efficient data loading and * aggregation pipelines* for advanced analytics, including top-rated recipes, most-used ingredients, and popularity-based rankings.

Features

  • Authentication API powered by Spring Security with a custom JWT filter for secure user registration, login, and logout.
  • Secure Token-Based Authentication implemented using JSON Web Tokens (JWTs) to ensure secure user access to application resources.
  • Pagination Support: All collection endpoints support pagination with customizable page size, page number, and sorting parameters for optimal data loading (fun getAllIngredients, fun searchIngredients, fun getAllRecipes, fun searchRecipesByCategory, etc.).
  • Aggregation Pipelines: Advanced MongoDB aggregation queries for analytics:
    • Top recipes by popularity ranking (fun getTopRecipesByPopularity);
    • Most frequently used ingredients across recipes (fun getTopIngredientsByUsage);
    • Rating-based sorting for favorite recipes (fun getFavoritesByRatingDesc());
  • Modern Development with Kotlin: Leverage Kotlin's concise syntax, null safety, and data classes to enhance code readability, reduce boilerplate, and improve maintainability.
  • Structured and organized JSON data storage backed by MongoDB.
  • Containerized Deployment with Docker: Seamlessly build and run the entire ecosystem — including the Spring Boot application and MongoDB database — using Docker and Docker Compose for consistent, "one-command" environment setup.
  • CRUD operations available through RESTful API endpoints for the following collections:
    • Recipes
    • Ingredients
    • Shopping lists
    • Recipe favorites
    • Subscribes
  • Advanced Bean Lifecycle Management: Implemented Method Injection using @Lookup to handle stateful prototype-scoped components (class ExecutionTracker, class RecipeValidator, class IngredientValidator) within singleton services, enabling per-operation tracking and validation without shared state conflicts.
  • Reduced boilerplate code through the use of data classes.
  • Streamlined setup and build processes using Gradle.

Requirements

The following configurations are required to launch the project:

  • Java Platform (JDK): 25
  • Gradle: 9.2.0
  • Spring Boot: 4.0.2
  • Docker: 29.1.3
  • Kotlin: 2.3.0

Getting Started

  1. Clone the repository:
    git clone https://github.com/Bohdan100/so-yummy
    cd so-yummy
    
  2. Build and Run the Application Using Docker in Terminal:
    docker-compose up -d --build app
    
  3. Make your HTTPS requests using the following endpoints (e.g., via Postman), for authentification:

1. Authentication Endpoints

  • Register: http://localhost:8080/api/v1/auth/register
    • POST: Registers a new user. Requires a JSON body with user credentials. User Registration Request Body:
      {
       "name": "User",
       "email": "user@example.com",
       "password": "secret123456"
       }
    Admin Registration Request Body:
    {
     "name": "Admin",
     "email": "admin@example.com",
     "password": "secret12345678", 
     "role": "ADMIN"
     }

Important:

After successful authentication, include the Bearer token in the Authorization header for all subsequent requests:


2. Ingredients Endpoints

Pagination Parameters: page: Page number (default: 0) size: Items per page (default: 10) sort: Sort field and direction, e.g., title,asc or title,desc


3. Recipes Endpoints


4. Recipe Favorites Endpoints

Pagination Parameters: page: Page number (default: 0) size: Items per page (default: 10) sort: Sort field and direction, e.g., title,asc or title,desc


5. Additional Endpoints

Collection: base URL

Available Operations:

  • GET / - Get all items
  • GET /{id} - Get item by ID
  • POST / - Create new item
  • PUT /{id} - Update existing item
  • DELETE /{id} - Delete item

All endpoints require Bearer token authentication.

About

Kotlin Spring Boot API for a recipe and meal planning platform. Includes secure user registration and login with JWT, MongoDB storage, and Docker containerization. Manages recipes, ingredients, favorites, subscriptions, and personal shopping lists. Built with Spring Boot, Kotlin, MongoDB, JWT, Docker, and Gradle.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages