Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize services implementation across packages #52

Closed
4 tasks
cairin opened this issue Jul 20, 2021 · 5 comments · Fixed by #59
Closed
4 tasks

Standardize services implementation across packages #52

cairin opened this issue Jul 20, 2021 · 5 comments · Fixed by #59
Labels
discussions: general Convert to a general discussion type: architecture Structural considerations

Comments

@cairin
Copy link
Collaborator

cairin commented Jul 20, 2021

There is currently quite a large difference in implementations of the services in the backend and connector packages.

The accounts package is not mentioned here because #53 , but would need to conform to this too.

We need to:

  • Highlight and discuss the differences in implementations.
  • Decide on a single structure all packages should conform to.
  • Migrate packages that don't conform.
  • Document the structure for future collaborators.
@cairin cairin added type: architecture Structural considerations discussions: general Convert to a general discussion labels Jul 20, 2021
@cairin
Copy link
Collaborator Author

cairin commented Jul 20, 2021

Backend

The backend package is setup such that each service is isolated from the others. The services are isolated based on their domain of functionality. New functionality should either fit into one of the existing domains, or form a new service.

Structure

  • Very flat directory structure makes it easy to find things, especially for new collaborators.
  • Splitting code by domain ensures that all tests and code are co-located.
src/
    service_name/
        model
        service
        tests
        anything else scoped to this service domain
    ...helper_services/
    graphql/
        resolvers
        tests
        schema

@cairin
Copy link
Collaborator Author

cairin commented Jul 20, 2021

Connector

The connector package is is divided by higher level grouping of functionality, namely core, ilp-routing, and admin-api. The services are based on the MVC pattern.

Structure

src/
    services/
        service_name/
            controllers
            errors
            factories
            lib
            middleware
            services/
                service_name/
            test/
                controllers
                lib
                middleware
            utils

@sharafian
Copy link
Collaborator

do each of the items in the backend structure (model, service, tests) represent files rather than directories? Otherwise I don't see much difference between the two, aside from the top-level 'services' directory present in the connector.

@sentientwaffle
Copy link
Contributor

sentientwaffle commented Jul 21, 2021

(Sorry, wrong button)..

do each of the items in the backend structure (model, service, tests) represent files rather than directories?

Yes, those are files.

The connector's file structure is an artifact of being imported from the previous Rafiki project.

@cairin
Copy link
Collaborator Author

cairin commented Jul 22, 2021

@sharafian

do each of the items in the backend structure (model, service, tests) represent files rather than directories?

They are files in this instance, but could be directories if the services became more complicated.

Otherwise I don't see much difference between the two, aside from the top-level 'services' directory present in the connector.

The major difference isn't actually conveyed very well with the above because they are fairly similar on face value. I will create a pr that starts work for #53 to try demonstrate the idea. I can then present it properly on the call on Monday. @matdehaast said he would write a blog post on this, so he better get on that so I don't have to type it out 😆

@sentientwaffle

The connector's file structure is an artifact of being imported from the previous Rafiki project.

That's understandable 👍 It is tested so we should be able to migrate it fairly safely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussions: general Convert to a general discussion type: architecture Structural considerations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants