Spincast Framework codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.
This codebase was created to demonstrate a fully fledged fullstack application built with Spincast Framework including CRUD operations, authentication, routing, pagination, and more. Spincast is a Java framework based on Guice.
We've gone to great lengths to adhere to the Spincast Framework community styleguides & best practices.
For more information on how to this works with other frontends/backends, head over to the RealWorld repo.
An embedded PostgreSQL instance is provided and is used as the data source. You do not need to install/configure
anything else than the application itself... Everything is included in the application .jar
.
If at some point you want to reset the data of the application, simply delete the "dbData
" directory which is going to be
created.
Important!: The application uses a self-signed certificate to accept HTTPS requests. In production, you would of course
use a real certificate (for example a Let's Encrypt one). Because of this, the clients you use to
make requests need to accept self-signed certificates! In Postman, you do this by turning OFF : Settings / SSL certificate verification
.
We preferred this little annoyance over serving plain HTTP.
- JDK8
- Maven
From the root of the project:
mvn clean package -DskipTests
Then:
java -jar target/spincast-realworld-1.0.0.jar
That's it!
You can now start sending requests to the API, for example using Postman.
The application starts on port 12345
, using SSL, and its root is: https://localhost:12345/api.
If you want to change the default configurations (which are provided in "src/main/resources/app-config.yaml
", you can create a new "target/app-config.yaml
"
file, next to "target/spincast-realworld-1.0.0.jar
", and restart the application.
You can run tests using:
mvn test
You can also run the Postman tests provided by the specs by executing:
varia/run-api-tests.sh
(Linux/Mac)varia/run-api-tests.bat
(Windows)
But, of course, the best way to run the tests is by opening the project in your favorite IDE and launch them manually... You can then see exactly how they were written:
/src/test/java/org/spincast/realworld/UsersTest.java
/src/test/java/org/spincast/realworld/ArticlesTest.java
- Import the project as a Maven project in your IDE.
- The
main
method is located in theorg.spincast.realworld.App
class. Add a breakpoint and start a debug configuration to understand how a Spincast application is bootstrapped. - Add breakpoints in the controllers (
org.spincast.realworld.controllers.*
) and start sending requests using Postman or your favorite tool.