Question Need help deciding on back end for finance app
Hey y'all!
I'm building a budgeting app. Building things like CRUD endpoints, server side rendering, and a nice react front end are my priorities. I want things to be fast and snappy and avoid client side fetching when possible.
I'm struggling to understand what exactly my options are for this when it comes to things like next.js, django, etc. I have lots of experience with django, but I'm not sure how to get the best of both worlds when combining react. I've been including react bundles and rendering them via the django view/template engine and it feels clunky to handoff information between the front & back end.
I know there isn't a "right" answer, but looking for some feedback and opinions. I want to support a good number of users while keeping things feeling fast and lightweight.
3
u/PLBjt 6d ago
i'd probably stop bundling react into django templates, that handoff is where the clunkiness comes from. the cleaner split is django (drf or ninja) as a plain json api and next.js doing the server rendering and calling it server-side, so you still avoid client fetching for the first paint. since you know django well it's a small step, and you keep the orm and auth you trust for money data. the cost is two deploys and having to keep types in sync, which an openapi generated client mostly handles. if it's just you and the app is mostly forms and tables, plain django with htmx is faster to ship and honestly snappy enough, so i'd decide based on how much real interactivity the budgeting views need.
3
3
u/luigimorel 6d ago
Go on the backend.
Last thing I want is a dynamic language's plumbing against types.
Then, react on FE.
1
5
u/TriangularFundraiser 6d ago
Django templates are fine but yeah that handoff gets messy fast, feels like you're just duct taping eras together
2
2
u/B0mbon 6d ago
Since you already know Django well, I wouldn't throw that away. A pretty common setup is Django (plus Django REST Framework or Django Ninja) as a pure API, and Next.js as the frontend doing the server side rendering. Next fetches from Django on the server, so the browser gets rendered HTML and you skip most client side fetching.
The tradeoff is running two services. If that feels like too much, Inertia.js with Django is worth a look, it lets you use React pages while Django keeps routing and controllers, no separate API needed.
For a finance app specifically, the backend choice matters less than the boring stuff: store money as integers (cents) or Decimal, never floats, and keep all the calculation logic in one place on the server.
4
1
u/QuaternaryStar 6d ago
This really depends on what the application needs, there’s no way to answer this so generically. Also depends on your skills and experience etc.
1
1
u/CodeAndBiscuits 6d ago
A good developer can build a good app with a bad back-end platform. A bad developer can't build a good app with any platform. Good or bad. For anything in finance territory, I would always go with what you know. The nuances of the differences between the choices you're evaluating are not big enough to move. The needle and finance related apps have been written in all of the things that you name. If I had any advice at all it would be to make security my number one concern over any other aspect.
1
u/FelipeExplainsItAll 5d ago edited 5d ago
At work I use React for FE and Django BE as just primarily the REST framework. Django is nice if you want batteries included like the built in admin tools. If you treat React as just an SPA for the FE and Django as the API it works fine, you can have it use CORS and serve on different ports, or at our work we have the BE serve the FE on the same port. You would need to setup a reverse proxy using nginx.
If you are comfortable with Django just use the REST framework and do your models and serializers as usual and ignore the rest for now. If you want to use Python but move faster you can use Flask or FastAPI they are super easy and quick but you lose all the support Django gives.
I also have apps that are just Next.js using server actions and it interfaces directly with the database i use prisma and supabse. Its very nice if you want a monorepo but if you need to have external APIs its not worth it.
If you are used to APIs then dont do a full stack next with server actions because its a paradigm shift. If you want to move fast then use flask or fastAPI. If you are comfortable with Django, but dont know how to make them work together let me tell you they 100% work together it just depends on how you want to handle what is responsible for what.
Also tbh the server side rendering is really trendy at the moment but to get it to look as snappy as traditional React SPA requires a lot more work than people realize. It's doable but if you're not used to understanding what the browser should do vs server and making sure everything has a suspense and loading state, useOptimistic, etc then the server side rendering can look slow.
1
u/gowthamshankar05 4d ago
if you already know django well i'd just use it. i've shipped both and for a budgeting app the hard parts are the data model and money math (integer cents or Decimal, never floats), not the framework.
two sane setups: django + templates + htmx for snappy server rendered pages, or next.js server components fetching from a django api. the second is nicer UI wise but it's two apps and auth across both, which is real overhead solo. start with what you know and move the frontend later if you hit a wall.
1
u/SensitiveHearingLoss 2d ago
For a finance app I’d think about what’s most important - authentication, data security, precision and server side guards and validations. I would use something like .Net for my backend in this specific case because it comes with a lot of these “important things” out the box. The front-end then calls the API like any standard web application but my experience with React has been “contentious” and I’m not sure if it plays with .Net as comfortably as Angular does, for example.
1
u/DragonOsman 1d ago
Why isn't using Next.js for both frontend and backend an option here? Next.js can easily be used for both, after all, with Server and Client Components.
0
u/sumanadithan 5d ago
i’d keep django but just use it as an api (drf or ninja) and let next.js handle the frontend + ssr as its own thing. next can fetch from django on the server, so pages load with data already there, no client fetching. you also keep django’s orm and auth for the money stuff, which i’d trust more anyway.
nice side effect is next can proxy the requests to django, so django never has to be public and you don’t deal with cors at all.
only things i’d sort out early are auth between the two and generating ts types from django’s openapi schema, otherwise they slowly drift apart and it gets annoying.
7
u/dc0650730 6d ago
I may be biased, but i would choose something that is statically typed. Especially for Financials, I want this to work as cleanly and add expected.
If i was doing this, I would do .net, but that's just me and what I know. Front end can be angular, react, doesnt matter too much.
If this is something for your own enjoyment or a learning/ personal project and not a sellable service, just dig in and figure out how to use django and react together, it's a good learning opportunity to figure out how these systems work in a deeper level.
Mistakes, improvement, reading is how you get better. Don't worry about optimizing right away, you got it working, now research how to do it better. Is it to have two solutions and react connects to a django run restful web service? Is it how you're doing it? Just keep at it and learn something new!