rest-api
π―Skillfrom bitsoex/bitso-java
Standardizes REST API development in Java Spring by providing authentication, OpenAPI documentation, and RFC-37 service guidelines.
Installation
npx skills add https://github.com/bitsoex/bitso-java --skill rest-apiSkill Details
>
Overview
# REST API
REST API standards for Java Spring services.
When to use this skill
- Creating REST endpoints in Spring services
- Integrating Bitso authentication
- Documenting APIs with OpenAPI
- Setting up service documentation (RFC-37)
- Testing authenticated endpoints
Skill Contents
Sections
- [When to use this skill](#when-to-use-this-skill) (L24-L31)
- [Quick Start](#quick-start) (L52-L91)
- [Authentication](#authentication) (L92-L123)
- [Documentation](#documentation) (L124-L144)
- [References](#references) (L145-L151)
- [Related Rules](#related-rules) (L152-L156)
- [Related Skills](#related-skills) (L157-L162)
Available Resources
π references/ - Detailed documentation
- [documentation](references/documentation.md)
- [guidelines](references/guidelines.md)
---
Quick Start
1. Add Authentication Dependency
```groovy
implementation libs.bitso.api.base.spring.webapi
```
2. Configure gRPC Client
```yaml
grpc:
client:
user-security:
address: dns:/${USER_SECURITY_HOST:localhost}:${GRPC_PORT:8201}
negotiation-type: PLAINTEXT
```
3. Create Controller
```java
@RestController
@RequestMapping("/")
public class MyController {
@Autowired
SpringHttpResponseFactory responseFactory;
@Autowired
WebAuthenticationContext authenticationContext;
@GetMapping("/private")
@WebAPI(WebAPIType.PRIVATE)
public ResponseEntity> privateEndpoint() {
Long userId = authenticationContext.getPrincipalId();
return responseFactory.ok(userId);
}
}
```
Authentication
Configuration Bean
```java
@Configuration
public class UserSecurityContextConfiguration {
@Bean
@Primary
public AuthenticationService authenticationService(
@GrpcClient("user-security") AuthorizationServiceV1BlockingStub stub,
@Qualifier("userSecurityResilienceConfig") ResilienceConfiguration config
) {
return new ProtoShimAuthenticationService(config, stub);
}
}
```
Component Scan
Ensure your main application scans Bitso components:
```java
@SpringBootApplication
@ComponentScan("com.bitso.*")
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
```
Documentation
OpenAPI Specification
All endpoints should be documented under ./docs/api/rest/openapi.yaml
RFC-37 Documentation Structure
```text
docs/
βββ api/
β βββ async/
β βββ grpc/
β βββ rest/
βββ decisions/
βββ
βββ runbooks/
βββ how-tos/
βββ local-execution.md
```
References
| Reference | Description |
|-----------|-------------|
| [references/guidelines.md](references/guidelines.md) | API guidelines, authentication, testing |
| [references/documentation.md](references/documentation.md) | RFC-37 documentation standards |
Related Rules
.cursor/rules/java-rest-api-guidelines.mdc- Full API guidelines.cursor/rules/java-service-documentation.mdc- RFC-37 documentation
Related Skills
| Skill | Purpose |
|-------|---------|
| [grpc-standards](../grpc-standards/SKILL.md) | gRPC service standards |
| [java-testing](../java-testing/SKILL.md) | Testing REST endpoints |
More from this repository10
Configures and manages MCP (Model Context Protocol) server settings across multiple IDEs for seamless integration and development workflow.
Streamlines PostgreSQL database integration in Java projects by configuring jOOQ code generation, Flyway migrations, and version compatibility.
doc-sync skill from bitsoex/bitso-java
Manages and standardizes Git hooks across repositories, ensuring consistent code quality checks and team-wide hook compliance automatically.
Integrates SonarQube with MCP to enable natural language querying of Java code quality issues, analysis, and quality gate checks.
Centralizes and standardizes Gradle build configurations for Java projects, managing dependencies, version catalogs, and multi-module setups efficiently.
Implements RFC-34 structured logging standards for Java services, enabling JSON-formatted logs with required fields and contextual metadata.
Configures and generates JaCoCo code coverage reports for Java/Gradle projects, enabling comprehensive testing analysis and quality metrics.
Upgrades Gradle projects from version 8.x to 9.x, ensuring plugin compatibility and supporting Java 25 migration.
Upgrades Java Spring Boot projects to version 3.5.9, ensuring comprehensive dependency updates and compatibility with latest Spring ecosystem standards.