Skip to main content

Welcome to Sproogy

Sproogy is a lightweight, Spring-inspired framework for Java that brings the power of Inversion of Control (IoC) and Dependency Injection (DI) to the world of secure socket programming.

What is Sproogy?​

Sproogy combines two powerful concepts:

  1. Dependency Injection Container - Inspired by Spring Framework, Sproogy provides a robust IoC container that manages your application components and their dependencies.

  2. SSL Socket Abstraction - Unlike traditional web frameworks, Sproogy specializes in secure socket communication, providing a high-level API for building TCP/SSL server-client applications.

Why Choose Sproogy?​

For Spring Developers​

If you're familiar with Spring, you'll feel right at home with Sproogy:

  • Familiar annotations: @Component, @Service, @Autowired, @Value
  • Lifecycle management: Similar bootstrap process with hooks
  • Configuration system: YAML/JSON application files + environment variables
  • JPA integration: Repository pattern with @Query and @Transactional

For Socket Programmers​

Sproogy removes the boilerplate from socket programming:

  • No manual SSL configuration: Just implement a security loader interface
  • Automatic serialization: JSON request/response handling out of the box
  • Filter chain pattern: Interceptors for authentication, logging, encryption
  • Controller routing: Map methods to endpoints like REST APIs

Key Differentiators​

FeatureTraditional SocketsSproogy
Dependency InjectionManual instantiationAutomatic with @Autowired
SSL Setup50+ lines of boilerplateSingle interface implementation
Request RoutingManual string parsing@AppMapping("/endpoint")
Lifecycle ManagementManual thread handlingAutomatic with graceful shutdown
Data AccessManual JDBCJPA repositories with DI

Real-World Use Cases​

Sproogy excels in scenarios where you need:

  1. Custom Protocol Servers: Build proprietary communication protocols with SSL security
  2. Microservice Communication: Direct TCP/SSL communication between services (faster than HTTP)
  3. IoT Device Management: Manage thousands of persistent SSL connections
  4. Financial Systems: High-throughput, low-latency transaction processing
  5. Gaming Servers: Real-time multiplayer game state synchronization

Architecture Overview​

Quick Peek: Hello World​

Here's a complete Sproogy application in under 30 lines:

// Main.java
@SproogyApplication(basePackage = "com.example")
public class Main {
public static void main(String[] args) {
SproogyApp.run(Main.class, args);
}
}

// HelloController.java
@Controller
public class HelloController {

@AppMapping("/hello/{name}")
public ResponseEntity<String> hello(@PathVariable("name") String name) {
return ResponseEntity.ok("Hello, " + name + "!");
}
}

// SSLConfig.java
@Component
public class SSLConfig implements SSLFactoryLoader {

@Override
public SSLServerSocketFactory getSSLServerSocketFactory() throws Exception {
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(new FileInputStream("keystore.jks"), "password".toCharArray());

KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(keyStore, "password".toCharArray());

SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(kmf.getKeyManagers(), null, null);

return sslContext.getServerSocketFactory();
}
}

Configuration (.env):

SOCKET_PORT=8443

That's it! Run the application, and you have a secure SSL server listening on port 8443.

What You'll Learn​

This documentation will guide you through:

  1. Getting Started - Installing Sproogy and building your first application
  2. Core Concepts - Understanding IoC/DI, lifecycle, and annotations
  3. Socket Programming - Building robust SSL servers and clients
  4. Data Access - Using JPA repositories with dependency injection
  5. Advanced Topics - Custom transformers, performance tuning, modularity
  6. Troubleshooting - Common issues and best practices

Prerequisites​

Before diving in, you should have:

  • Java 11+ installed (Sproogy is built on modern Java)
  • Basic Java knowledge (classes, interfaces, annotations)
  • Understanding of sockets (helpful but not required)
  • Familiarity with Spring (optional, but makes learning easier)

Next Steps​

Ready to build your first Sproogy application? Head over to the Installation Guide to get started!

Need Help?

If you get stuck, check out the Troubleshooting section or the FAQ.