Skip to content

Mindera-Labs/copilot-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Todo Application with Quarkus

A modern RESTful Todo application built with Quarkus, following best practices in software architecture including layered design, proper separation of concerns, and comprehensive testing.

Project Overview

This application demonstrates a well-structured Quarkus application with:

  • Layered architecture (resource, service, repository, entity, DTO layers)
  • RESTful API patterns with proper validation
  • Reactive programming with Quarkus
  • Integration with PostgreSQL database
  • Comprehensive test coverage

Model Context Protocol (MCP) Integration Possibilities

This application could be enhanced with Model Context Protocol (MCP) servers to extend its capabilities and enable AI assistants to interact with various services directly.

MCP Servers for Integration

  1. GitHub MCP Server
    • Repository management and file operations
    • Pull request and issue handling
    • Issues creation and more

Additional MCP Resources

Find more MCP servers and resources at:

GitHub Copilot Commands in VS Code

GitHub Copilot in VS Code provides several ways to reference code and context in your prompts using hash (#) commands.

Code Reference Commands

  1. #file: Reference specific files in your workspace

    Explain the validation in #file:src/main/java/io/avios/entity/Todo.java
    
  2. #selection: Reference your currently selected code

    Generate a test for this method: #selection
    
  3. #editor: Reference code in the active editor

    Refactor this: #editor
    
  4. #terminalOutput: Reference output from the terminal

    Explain this error: #terminalOutput
    

Web Search and Documentation Commands

  1. #websearch: Search the web for current information

    #websearch Quarkus best practices for validation
    
  2. #fetch: Fetch and analyze content from a specific URL

    #fetch https://quarkus.io/guides/validation
    

TDD Workflow with GitHub Copilot

  1. Writing Tests First:

    /tests
    

    This slash command generates tests for methods in your editor

  2. Setting Up Test Framework:

    /setupTests
    

    This slash command helps configure a testing framework for your project

  3. Implementing Features:

    Implement the TodoService method to pass this test: #selection
    
  4. Researching Implementation Methods:

    #websearch efficient SQL query for filtering todos by multiple criteria in Quarkus
    
  5. Checking Documentation:

    #fetch https://quarkus.io/guides/hibernate-orm-panache
    

Example Complete Workflow

To implement a "search todos by keyword" feature:

  1. Research First:

    #websearch PostgreSQL text search with Quarkus Panache
    
  2. Check Documentation:

    #fetch https://quarkus.io/guides/hibernate-orm-panache#query-methods
    
  3. Create Test: Use the /tests command to generate tests for your search feature

  4. Implement Feature:

    Implement the search method in TodoService based on this test: #selection
    
  5. Add Endpoint:

    Add a REST endpoint in TodoResource for this search feature: #selection
    
  6. Document the API:

    Update the OpenAPI documentation for the new search endpoint: #selection
    
  7. Learn Best Practices:

    #websearch RESTful API pagination best practices with Quarkus
    

Running the application in dev mode

You can run your application in dev mode that enables live coding using:

./mvnw quarkus:dev

NOTE: Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.

Packaging and running the application

The application can be packaged using:

./mvnw package

It produces the quarkus-run.jar file in the target/quarkus-app/ directory. Be aware that it's not an über-jar as the dependencies are copied into the target/quarkus-app/lib/ directory.

The application is now runnable using java -jar target/quarkus-app/quarkus-run.jar.

If you want to build an über-jar, execute the following command:

./mvnw package -Dquarkus.package.jar.type=uber-jar

The application, packaged as an über-jar, is now runnable using java -jar target/*-runner.jar.

Testing

Run the tests using:

./mvnw test

The application uses TestContainers for integration tests, ensuring tests run against a real PostgreSQL database.

API Documentation

When running in dev mode, access the Swagger UI at:

http://localhost:8080/q/swagger-ui/

Related Guides

  • Hibernate ORM with Panache (guide): Simplify your persistence code for Hibernate ORM via the active record or the repository pattern
  • RESTEasy Reactive (guide): A Jakarta REST implementation utilizing build time processing and Vert.x.
  • JDBC Driver - PostgreSQL (guide): Connect to the PostgreSQL database via JDBC
  • GitHub Copilot (documentation): AI pair programming tool

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published