DEV Community

Akash Bhuiyan
Akash Bhuiyan

Posted on

Building EmbedQA: An Open Source API Testing Tool with Spring Boot ๐Ÿš€

๐Ÿš€ Build EmbedQA Backend: Professional API Testing Platform

EmbedQA GitHub Repository

Hey backend developers! ๐Ÿ‘‹

Are you passionate about Java, Spring Boot, and building robust APIs? Want to contribute to an open-source project that helps developers worldwide test their APIs better? Join us in building EmbedQA - a modern, open-source API testing platform (think Postman alternative)!

๐ŸŽฏ What is EmbedQA?

EmbedQA is a full-stack API testing platform designed to give developers a powerful, free alternative to commercial API testing tools. The backend is the heart of this platform, handling everything from executing HTTP requests to managing collections, environments, and request history.

What We're Building:

  • ๐Ÿ”ง HTTP request execution engine with full protocol support
  • ๐Ÿ“ฆ Collections management for organizing API endpoints
  • ๐ŸŒ Environment variables system for different deployment stages
  • ๐Ÿ“ Request history with analytics
  • ๐Ÿ” Multiple authentication mechanisms
  • ๐Ÿš€ High-performance, scalable REST API

๐Ÿ› ๏ธ Tech Stack

We're using industry-standard, modern Java technologies:

Technology Version Purpose
Java 21 Latest LTS with modern features
Spring Boot 3.5.7 Robust, production-ready framework
Spring Data JPA - Simplified database operations
PostgreSQL 16 Reliable, powerful relational database
Apache HttpClient 5.3 HTTP request execution
Maven 3.9+ Dependency management
Docker - Easy database setup & deployment

Why This Stack?

  • Java 21: Modern syntax, Records, Pattern Matching, Virtual Threads
  • Spring Boot 3.5: Production-proven, extensive ecosystem
  • PostgreSQL: Advanced features, JSON support, excellent performance
  • Apache HttpClient 5: Industry-standard HTTP client library

๐ŸŽฏ Project Goals

We're building EmbedQA backend to be:

  1. Robust: Handle edge cases, errors gracefully
  2. Scalable: Support thousands of concurrent requests
  3. Maintainable: Clean architecture, SOLID principles
  4. Testable: Comprehensive unit and integration tests
  5. Well-documented: Clear API docs with Swagger/OpenAPI

๐Ÿš€ Getting Started

Ready to contribute? Here's how to get the backend running locally:

Prerequisites

  • Java 21 (JDK)
  • Maven 3.9+
  • PostgreSQL 16 (we recommend Docker)
  • Your favorite IDE (IntelliJ IDEA, Eclipse, VS Code)

Quick Setup

# 1. Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/embedqa.git
cd embedqa

# 2. Start PostgreSQL with Docker (easiest way)
cd docker-compose/db
docker-compose up -d
cd ../..

# 3. Run the application
./mvnw spring-boot:run
Enter fullscreen mode Exit fullscreen mode

The API will be available at http://localhost:8085 ๐ŸŽ‰

Database Setup (Alternative)

If you prefer installing PostgreSQL locally:

# Create database and user
psql postgres
Enter fullscreen mode Exit fullscreen mode
CREATE DATABASE embedqa;
CREATE USER embedqa_user WITH ENCRYPTED PASSWORD 'embedqa_pass';
GRANT ALL PRIVILEGES ON DATABASE embedqa TO embedqa_user;
\c embedqa
GRANT ALL ON SCHEMA public TO embedqa_user;
\q
Enter fullscreen mode Exit fullscreen mode

Verify Installation

# Check if the API is running
curl http://localhost:8085/api/v1/collections

# View API documentation
open http://localhost:8085/swagger-ui.html
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“ Project Architecture

We follow clean architecture principles with clear separation of concerns:

src/main/java/com/akash/embedqa/
โ”œโ”€โ”€ EmbedqaApplication.java         # Main application entry point
โ”œโ”€โ”€ config/                         # Configuration classes
โ”‚   โ”œโ”€โ”€ HttpClientConfig.java       # Apache HttpClient setup
โ”‚   โ””โ”€โ”€ WebConfig.java              # CORS, interceptors
โ”œโ”€โ”€ controller/                     # REST API endpoints
โ”‚   โ”œโ”€โ”€ ApiExecutorController.java  # Execute HTTP requests
โ”‚   โ”œโ”€โ”€ CollectionController.java   # Collections CRUD
โ”‚   โ”œโ”€โ”€ EnvironmentController.java  # Environments CRUD
โ”‚   โ”œโ”€โ”€ RequestController.java      # Saved requests CRUD
โ”‚   โ””โ”€โ”€ HistoryController.java      # Request history
โ”œโ”€โ”€ service/                        # Business logic layer
โ”‚   โ”œโ”€โ”€ ApiExecutorService.java     # HTTP execution logic
โ”‚   โ”œโ”€โ”€ CollectionService.java      # Collections management
โ”‚   โ”œโ”€โ”€ EnvironmentService.java     # Environment management
โ”‚   โ”œโ”€โ”€ RequestService.java         # Request management
โ”‚   โ””โ”€โ”€ HistoryService.java         # History tracking
โ”œโ”€โ”€ repository/                     # Data access layer
โ”‚   โ”œโ”€โ”€ ApiCollectionRepository.java
โ”‚   โ”œโ”€โ”€ ApiRequestRepository.java
โ”‚   โ”œโ”€โ”€ ApiResponseRepository.java
โ”‚   โ”œโ”€โ”€ EnvironmentRepository.java
โ”‚   โ”œโ”€โ”€ EnvironmentVariableRepository.java
โ”‚   โ””โ”€โ”€ RequestHistoryRepository.java
โ”œโ”€โ”€ model/                          # Domain models
โ”‚   โ”œโ”€โ”€ entities/                   # JPA entities
โ”‚   โ”‚   โ”œโ”€โ”€ ApiCollection.java
โ”‚   โ”‚   โ”œโ”€โ”€ ApiRequest.java
โ”‚   โ”‚   โ”œโ”€โ”€ ApiResponse.java
โ”‚   โ”‚   โ”œโ”€โ”€ Environment.java
โ”‚   โ”‚   โ”œโ”€โ”€ EnvironmentVariable.java
โ”‚   โ”‚   โ””โ”€โ”€ RequestHistory.java
โ”‚   โ””โ”€โ”€ dtos/                       # Data Transfer Objects
โ”‚       โ”œโ”€โ”€ request/                # Request DTOs
โ”‚       โ””โ”€โ”€ response/               # Response DTOs
โ”œโ”€โ”€ enums/                          # Enumerations
โ”‚   โ”œโ”€โ”€ HttpMethod.java             # HTTP methods
โ”‚   โ”œโ”€โ”€ BodyType.java               # Request body types
โ”‚   โ””โ”€โ”€ AuthType.java               # Authentication types
โ”œโ”€โ”€ exception/                      # Exception handling
โ”‚   โ”œโ”€โ”€ GlobalExceptionHandler.java # Centralized error handling
โ”‚   โ”œโ”€โ”€ ApiExecutionException.java
โ”‚   โ””โ”€โ”€ ResourceNotFoundException.java
โ”œโ”€โ”€ converter/                      # Type converters
โ”‚   โ”œโ”€โ”€ AuthConfigConverter.java    # JPA converters
โ”‚   โ””โ”€โ”€ EnvironmentVariablesConverter.java
โ””โ”€โ”€ utils/                          # Utility classes
    โ””โ”€โ”€ HashMapConverter.java
Enter fullscreen mode Exit fullscreen mode

๐ŸŽ Good First Issues

Perfect entry points for new contributors:

๐ŸŸข Beginner-Friendly

  1. Add request timeout configuration

    • Make HTTP request timeout configurable
    • Skills needed: Java, Spring Boot configuration
    • Files: ApiExecutorServiceImpl.java, application.yml
  2. Improve error messages

    • Return more descriptive error messages in API responses
    • Skills needed: Java, exception handling
    • Files: GlobalExceptionHandler.java
  3. Add request/response size limits

    • Implement size validation for large payloads
    • Skills needed: Java, Spring Boot validation
    • Files: ApiExecutorServiceImpl.java

๐ŸŸก Intermediate

  1. Implement request history pagination

    • Add pagination support for history endpoint
    • Skills needed: Spring Data JPA, pagination
    • Files: HistoryService.java, HistoryController.java
  2. Add request statistics

    • Track average response times, success rates
    • Skills needed: JPA queries, aggregation
    • Files: HistoryService.java, create StatisticsService.java
  3. Support multipart file uploads

    • Handle file uploads in request bodies
    • Skills needed: Spring multipart handling
    • Files: ApiExecutorServiceImpl.java
  4. WebSocket support

    • Add WebSocket testing capabilities
    • Skills needed: Spring WebSocket
    • Files: Create new WebSocket module

๐Ÿ”ด Advanced

  1. GraphQL support

    • Add GraphQL query execution
    • Skills needed: GraphQL, HTTP clients
    • Files: Create new GraphQL module
  2. Request chaining engine

    • Extract values from one response to use in next request
    • Skills needed: Complex logic, JSON parsing
    • Files: ApiExecutorService.java, create chaining logic
  3. Mock server

    • Built-in mock API server for testing
    • Skills needed: Advanced Spring, dynamic routing
    • Files: Create new mock server module

๐Ÿค Contribution Guidelines

We make contributing easy and rewarding!

How to Contribute

  1. Browse issues and find one that interests you
  2. Comment to claim the issue (we'll assign it to you)
  3. Fork the repository
  4. Create a branch
   git checkout -b feature/your-feature-name
Enter fullscreen mode Exit fullscreen mode
  1. Make your changes with clear commits
  2. Write tests for your changes
  3. Run tests to ensure nothing breaks
   ./mvnw test
Enter fullscreen mode Exit fullscreen mode
  1. Submit a PR with a detailed description

Code Style Guidelines

  • Follow Java naming conventions (camelCase, PascalCase)
  • Use meaningful variable/method names
  • Write Javadoc for public methods
  • Keep methods short and focused (< 30 lines ideally)
  • Follow SOLID principles
  • Use Spring best practices (constructor injection, etc.)
  • Write unit tests for services, integration tests for controllers

Testing Requirements

// Example service test
@Test
void shouldExecuteGetRequest() {
    // Given
    ExecuteRequestDTO request = createTestRequest();

    // When
    ApiResponseDTO response = apiExecutorService.execute(request);

    // Then
    assertThat(response.getStatusCode()).isEqualTo(200);
    assertThat(response.getBody()).isNotNull();
}
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“š API Endpoints Overview

Execute API Request

POST /api/v1/execute
Content-Type: application/json

{
  "method": "GET",
  "url": "https://api.example.com/users",
  "headers": [
    {"key": "Authorization", "value": "Bearer token", "enabled": true}
  ],
  "queryParams": [
    {"key": "page", "value": "1", "enabled": true}
  ],
  "body": null,
  "bodyType": "NONE",
  "authType": "BEARER_TOKEN",
  "authConfig": {
    "token": "your-token-here"
  }
}
Enter fullscreen mode Exit fullscreen mode

Collections Management

GET    /api/v1/collections          # List all collections
GET    /api/v1/collections/{id}     # Get collection by ID
POST   /api/v1/collections          # Create collection
PUT    /api/v1/collections/{id}     # Update collection
DELETE /api/v1/collections/{id}     # Delete collection
Enter fullscreen mode Exit fullscreen mode

Environment Management

GET    /api/v1/environments         # List all environments
POST   /api/v1/environments         # Create environment
PUT    /api/v1/environments/{id}    # Update environment
DELETE /api/v1/environments/{id}    # Delete environment
Enter fullscreen mode Exit fullscreen mode

Request History

GET    /api/v1/history              # Get request history
GET    /api/v1/history/{id}         # Get history item details
DELETE /api/v1/history/{id}         # Delete history item
GET    /api/v1/history/stats        # Get usage statistics
Enter fullscreen mode Exit fullscreen mode

๐ŸŒŸ Why Contribute to EmbedQA Backend?

For Your Career

  • Build production-grade Spring Boot applications
  • Learn clean architecture and best practices
  • Work with modern Java 21 features
  • Gain experience with real-world scenarios

For Learning

  • Master Spring Boot 3.x ecosystem
  • Practice RESTful API design
  • Learn database optimization with JPA
  • Understand HTTP protocol deeply
  • Write professional-grade tests

For the Community

  • Help developers worldwide test APIs efficiently
  • Build a free alternative to expensive tools
  • Contribute to open-source Java ecosystem
  • Mentor other developers

๐Ÿงช Development Workflow

Running Tests

# Run all tests
./mvnw test

# Run specific test class
./mvnw test -Dtest=ApiExecutorServiceTest

# Run with coverage
./mvnw test jacoco:report
Enter fullscreen mode Exit fullscreen mode

Database Migrations

We use Flyway for database migrations:

-- Example migration: V1__Create_collections_table.sql
CREATE TABLE collections (
    id BIGSERIAL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    description TEXT,
    created_at TIMESTAMP NOT NULL,
    updated_at TIMESTAMP
);
Enter fullscreen mode Exit fullscreen mode

Configuration Profiles

# application-dev.yml (Development)
spring:
  datasource:
    url: jdbc:postgresql://localhost:5432/embedqa
    username: embedqa_user
    password: embedqa_pass

# application-prod.yml (Production)
spring:
  datasource:
    url: ${DATABASE_URL}
    username: ${DATABASE_USERNAME}
    password: ${DATABASE_PASSWORD}
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“– Resources

Need to brush up on skills?

๐Ÿ’ฌ Join the Community

Questions or ideas? Let's talk!

๐ŸŽ‰ What We've Built So Far

  • โœ… HTTP request execution engine (all methods)
  • โœ… Authentication support (Bearer, Basic, API Key)
  • โœ… Collections CRUD operations
  • โœ… Environment management
  • โœ… Request history tracking
  • โœ… PostgreSQL database schema
  • โœ… Comprehensive error handling
  • โœ… Docker development environment

Coming Soon:

  • ๐Ÿ”œ Request chaining
  • ๐Ÿ”œ WebSocket support
  • ๐Ÿ”œ GraphQL support
  • ๐Ÿ”œ Mock server
  • ๐Ÿ”œ Advanced analytics

๐Ÿš€ Ready to Start?

  1. โญ Star the repository
  2. ๐Ÿด Fork it
  3. ๐Ÿ“– Read our Contributing Guide
  4. ๐Ÿ“‹ Check Good First Issues
  5. ๐Ÿ’ฌ Introduce yourself in Discussions

๐Ÿ‘จโ€๐Ÿ’ป About the Maintainer

Akash Bhuiyan - Creator and maintainer of EmbedQA


Let's build the future of API testing together! Whether you're a Java veteran or learning Spring Boot, there's a place for you on the EmbedQA team. We value every contribution, from documentation improvements to major features. ๐ŸŽ‰

Have questions? Drop a comment below or open a discussion on GitHub!


๐Ÿ”– Tags

#java #springboot #opensource #backend #postgresql #rest #api #hacktoberfest

java #springboot #opensource #api #webdev #programming #tutorial

Top comments (0)