Getting Started
This page outlines how you can start using ApiHug to start a new API develop in 15 minutes.
This page outlines how you can use ApiHug to create quick demos in 15 minutes.
ApiHug
ApiHug - API design Copilot provides a highly friendly and intuitive project template to kickstart your API development. It guides you through step-by-step creation of API projects that adhere to best practices.
This is a standard Start Spring configuration:
Spring Web
Eventually click Create -> Open Project to open the project:
The SDK version may update while our project goes on;please check:
For an exist project, then you can upgrade them manually:
apihug = "0.9.2-RELEASE"
update to latest versionFollow the IDEA’s instruction:
Gradle
, if not please manually reload(check Notification)demo-app-proto
& demo-app
should be recognizedThe simplest project layout will be like (simplest-demo):
+---gradle
| | libs.versions.toml (1)
+---demo-app (2)
| | build.gradle
| \---src
| \---main
| +---java
| | \---com
| | \---apihug
| | \---demo
| | | DemoAppApplication.java
| | +---domain
| | \---service
| \---resources
| | hope-stub.json (3)
|
+---demo-app-proto (4)
| | build.gradle
| \---src
| \---main
| +---proto
| | \---com
| | \---apihug
| | \---demo
| | \---proto
| | +---api
| | \---infra
| \---resources
| hope-wire.json (5)
File | Comment |
---|---|
(1) libs.versions.toml | Version toml configuration |
(2) demo-app | Application module |
(3) hope-stub.json | Application module configuration |
(4) demo-app-proto | Protocol module |
(5) hope-wire.json | Protocol module configuration |
# libraries
apihug = "0.9.9-RELEASE"
# plugins
springBoot = "3.2.5"
springDependency = "1.1.4"
#Apihug Common
apihugBom = { group = "com.apihug", name = "it-bom", version.ref = "apihug" }
#Spring plugin
springBoot = { id = "org.springframework.boot", version.ref = "springBoot" }
springDependency = { id = "io.spring.dependency-management", version.ref = "springDependency" }
Wire task of the proto module response for verify and compile the protocol buffers files.
README.md
> 0. Build All
;Terminal
, Example: gradlew clean build -x test -x wireTest -x stubTest
;Enter
to execute;demo-app-proto
path main > wire
for updates;Stub task of the application module response for generate the stub code from the protocol definition.
README.md
> 2. Build Stub (Individual)
;Terminal
, Example: gradlew.bat demo-app:clean stub build -x test -x stubTest
;Enter
to execute;demo-app
path main > stub
for updates;README.md
> 3. Run Application
;Terminal
, Example: gradlew demo-app:bootRun
;Enter
to execute;demo-app
;----------------------------------------------------------
Application 'demo-app' is running! Access URLs:
Local http://localhost:18089/
External http://192.168.0.115:18089/
OAS http://192.168.0.115:18089/v3/api-docs
Actuator http://192.168.0.115:18089/management
Api-Errors http://192.168.0.115:18089/hope/meta/errors
Api-Dictionaries http://192.168.0.115:18089/hope/meta/dictionaries
Api-Authorities http://192.168.0.115:18089/hope/meta/authorities
Profile(s) dev
/v3/api-docs
) from the console;ApiHug Tool Window should dock on the right side of the IDE, if not you can also bring it up from the top menu bar: ApiHug > ApiHug Designer
:
Congratulations! You have successfully finished a perfect API development joinery!
During the last 15-minute demo, we went through the typical steps involved in API design and development. These steps often include various trivial tasks that distract us from focusing on the core business logic design. However, with ApiHug, you can leave behind all the tedious and troublesome steps.
ApiHug automates these tasks and generates high-quality designs with a user-friendly and easily understandable structure and code details. In the upcoming lessons, we will delve deeper into exploring the capabilities of ApiHug.
In fact, the techniques used by ApiHug are not entirely new inventions. Platforms like Jhipster, Spring Starter, Grails, and Ruby on Rails have paved the way for similar approaches.
ApiHug builds upon the best practices and lessons learned from these predecessors, making them more practical and straightforward for everyday use. We acknowledge and appreciate the contributions of these platforms in shaping the foundation of ApiHug.