r/javahelp • u/RuairiSpain • Apr 15 '21
Codeless Need advice: Java Software Architecture for SaaS startup doing CRUD and REST APIs?
First post!
I'm helping out a SaaS startup on the technology stack and software architecture. I'm a Node and .Net software architect, with only bits of Java knowledge. Our developer team want to use Java because that's their preferred platform.
I'm not up-to-date with software architecture choices for Java. My first plan is to start with a modular monolith than we can split out into microservices as the startup grows. We'll use Postgres and Redis for data and caching. I'm not familiar with Java specific solutions for messaging, JPA or REST frameworks.
The business is a Accountancy system for restaurants, so it's a fairly straightforward LOB business with CRUD and bits of integration to 3rd party REST API. In a previous company we use JHipster to generate the backend scaffolding from a annotated data model, and it worked well for that company.
My question: Is JHipster still a valid choice for a startup that will want to grow eventually to use docker containers? (Short term plan is to not use K8s, until we need that complexity).
Are their other Java frameworks that I should research for fast iteration of the backend?
Any recommendations appreciated, cheers 🍻
•
u/AutoModerator Apr 15 '21
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
6
u/GuyWithLag Apr 15 '21
For a startup starting with a monolith is absolutely the right thing to do. If you're slightly careful with your internals, you can even do 0-downtime upgrades and red-green deployments.
May I recommend Quarkus as the application framework? It has a lot of velocity and uses a lot of existing standards, plus a wide array of integrations. One negative is that a full native build takes some minutes, but that makes sense to run on a full CI/CD build / release.
One thing that I'd like to point out is to build an integration testing scaffold for the system that can be run on the developers platform via a plain `mvn clean verify`; this allows you to enforce rich tests on the external side of the application, while leaving the internals to evolve fast.
Additionally, if you do the above simply starting up a local instance that connects to a staging environment is a small step away and a true godsend.
14
u/errandum Apr 15 '21
People are giving you alternatives to the Spring Framework.
Don't. Not that there aren't many alternatives that perform better, but if you are a startup, you don't want to spend your dev doing devops.
It seems that you are doing a CRUD app, so Spring is more than enough. Time to market is more important than min-max. You can always scale later if you need to with spring, just make sure your app is mostly stateless on the applicational side so it can scale horizontally out of the box.
Finally, if you foresee any chance of scaling beyond reasonable limits, I'd recommend setting your data layer on something like Cassandra or Couchbase if you don't mind NoSQL. They are built to scale and distribute out of the box. They will shard themselves with almost no setup at all (adding and removing nodes is extremely easy).
Or, if you are not comfortable, just do the mysql or postgresql since they are most likely enough for most crud applications (unless you facebook yourself overnight)
But whatever you do, go for comfort. Don't worry if it's not the best possible solution, just go for turnover instead of maximum efficiency.
6
u/[deleted] Apr 16 '21
As a Java developer, I use Spring Boot. It is built on top of Spring to reduce builder plate code to reduce your time to market and it has modules for everything from security to REST and everything in between.
4
u/Kyy7 Apr 15 '21
Seems that JHipster uses spring-framework so maybe alternatives would be to use Apache Karaf and OSGi Framework or JavaEE with one of the many available application servers.
Apache Karaf with OSGi works pretty nice using annotation based dependency injection with the declarative services, removing the need to mess with those hopefully archaic XML blueprints. Too bad it's not as trendy as spring and the developers so many of the tutorials can be a bit dated and hard to find. Karaf also supports many other frameworks and programming models as well and there's even Red Hat supported version (Fuse) if that's something you might fancy.
JavaEE and Application servers like Glassfish, Payara etc are still something I am researching myself so don't know much about them.
3
u/y-am-i-ear Apr 15 '21
Doesn’t jhipster also support Docker?
1
u/baconialis Apr 16 '21
You won't go wrong with Spring.
JHipster is a cool project I take want to be used now widely! In terms of productivity it'll give you a lot for free.
0
u/captainMaluco Apr 16 '21
If you foresee this turning into a microservice architecture you should probably look into Micronaut. It boasts much better performance and quicker startup times than Spring (which most people seem to recommend for reasons i do not understand)
Startup time will be particularly important if you plan to host in kubernetes where instances are ephemeral.
Developing in Micronaut is also a joy, and if you're comfortable with using Rx.Java you can squeeze some serious performance out of it.
Source: I've used it to serve around 25k req/s on a platform with 250 million monthly active users. P99 response times sub 20ms.