https://github.com/vincejv/fpi-framework
FPI Reactive API backend Framework, built on top of Quarkus
https://github.com/vincejv/fpi-framework
framework gcp gcp-cloud-build gcp-cloud-run java java-17 maven microservice mongodb quarkus
Last synced: 9 months ago
JSON representation
FPI Reactive API backend Framework, built on top of Quarkus
- Host: GitHub
- URL: https://github.com/vincejv/fpi-framework
- Owner: vincejv
- License: apache-2.0
- Created: 2022-09-08T15:02:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T22:34:05.000Z (almost 2 years ago)
- Last Synced: 2025-03-29T21:11:18.736Z (9 months ago)
- Topics: framework, gcp, gcp-cloud-build, gcp-cloud-run, java, java-17, maven, microservice, mongodb, quarkus
- Language: Java
- Homepage: https://florenz.abavilla.com
- Size: 549 KB
- Stars: 3
- Watchers: 0
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://search.maven.org/artifact/com.abavilla/fpi-framework-core)
[](https://github.com/vincejv/fpi-framework/actions?query=workflow%3A%22Maven+Central+deployment%22)
[](https://github.com/vincejv/fpi-framework/blob/main/LICENSE)
[](https://github.com/vincejv/fpi-framework/pulse)
[](https://sonarcloud.io/dashboard?id=vincejv_fpi-framework)
[](https://sonarcloud.io/dashboard?id=vincejv_fpi-framework)
[](https://sonarcloud.io/dashboard?id=vincejv_fpi-framework)
[](https://sonarcloud.io/component_measures/metric/reliability_rating/list?id=vincejv_fpi-framework)
[](https://sonarcloud.io/component_measures/metric/security_rating/list?id=vincejv_fpi-framework)
[](https://sonarcloud.io/dashboard?id=vincejv_fpi-framework)
[](https://sonarcloud.io/dashboard?id=vincejv_fpi-framework)
### Importing the POM (choose 1 option)
#### As Parent POM
```xml
com.abavilla
fpi-framework-pom
1.1.1
```
#### As BOM
```xml
com.abavilla
fpi-framework-bom
1.1.1
pom
import
com.abavilla
fpi-framework-core
```
### Sample Usage
#### Entity
```java
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@BsonDiscriminator
@MongoEntity(collection="students")
public class Student extends AbsMongoItem {
/** Student name */
private String name;
/** Student home address */
private String address;
/** Student gender */
private String gender;
// Getters and setters are generated by lombok
// during compile time, no need to specify them
}
```
#### DTO (Data Transfer Object)
```java
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class StudentDto extends AbsDto {
/** Student name */
private String name;
/** Student gender */
private String gender;
// Getters and setters are generated by lombok
// during compile time, no need to specify them
}
```
#### Repository
```java
@ApplicationScoped
public class StudentRepo
extends AbsMongoRepo {
// No need to specify a body as AbsMongoRepo
// extends from Panache repository, and already
// implements the basic CRUD methods
}
```
#### DTO to Entity Mapstruct Mapper
```java
@Mapper(componentModel = MappingConstants.ComponentModel.CDI,
injectionStrategy = InjectionStrategy.CONSTRUCTOR)
public interface StudentMapper
extends IDtoToEntityMapper {
// Mapstruct will generate the mappings during compile time,
// and mo need to specify a body as IDtoToEntityMapper specifies
// the commonly used mapping methods
}
```
#### Service Layer
```java
@ApplicationScoped
public class StudentSvc
// Alternatively, may extend with AbsRepoSvc if
// you need a customized repository
extends AbsSvc {
/** Mapstruct Mapper */
@Inject
StudentMapper mapper;
// Built in asynchronous (Mutiny) CRUD methods, all you
// have to specify are the mapping methods to convert
// a DTO to entity and vice versa
@Override
public StudentDto mapToDto(Student entity) {
return mapper.mapToDto(entity);
}
@Override
public Student mapToEntity(StudentDto dto) {
return mapper.mapToEntity(dto);
}
}
```
#### REST Controller
```java
@Path("/fpi/cx")
public class StudentResource
// Alternatively, may extend from AbsBaseResource,
// or AbsReadOnlyResource for specific use case scenarios
extends AbsResource {
// ...
// Built in asynchronous (Mutiny) CRUD methods for GET, POST,
// PATCH, DELETE are implemented by default, you may customize
// or add your own methods for specific requirements
// ...
}
```