Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

[Maintenance]: apply separation of concerns to this repo #420

@tcrasset

Description

@tcrasset

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

I have read through the code to see how one could export an OpenApi schema as asked by #419, but what I've found is that there is a deeper issue going on in this repo.

That is, separating concerns in the app, having code whose purpose is handling the incoming HTTP route, code whose purpose it generating a response, and code whose purpose is accessing the database.

Currently, most of the endpoints have all this in a single function. Example:

app.post('/sync', async (req, res) => {

There seem to be some files that are going in a positive direction, e.g.

https://github.com/actualbudget/actual-server/blob/master/src/services/secrets-service.js

but it does not seem to be a majority, as far as I could tell.

I'm not criticizing the work that has already been done, obviously there is a lot of work behind all of it, and it works!

However, going forward to be able to scale we would need to have some separation to make addition of routes, testing, adding an OpenAPI spec, much easier.

I would be glad to give a hand, I have dabbled a bit in JS, but my day job consist of being a backend developer in Python, so I know my way around a clean architecture, I'll just need to apply it to JS, similar to the secrets-service.js shown above.

What error did you receive?

No response

Where are you hosting Actual?

None

What browsers are you seeing the problem on?

No response

Operating System

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions