Why I wanted one Mohojo Werks account

In Part 1, I wrote about building a backend that could support Accumoo and future Mohojo Werks applications. One of the decisions behind this approach is one account across multiple applications.

If someone already has a Mohojo Werks account through Accumoo, I want them to be able to use this account when they try another application. Another app shouldn’t automatically mean another signup and another account to manage.

For me, it means maintaining one shared account system instead of rebuilding the same functionality for every app. Account management is necessary work, but repeating it doesn’t make the next application more useful. I’d rather spend this time on what makes each app worth using.

Sharing an account doesn’t mean sharing access to everything. I still need to distinguish who the user is (authentication) from what they’re allowed to access (authorization).

Authentication and authorization have different jobs

A successful sign-in is not blanket permission. It establishes the user’s identity, but the backend still needs to decide whether the requested operation is allowed.

For example, being signed in to Accumoo shouldn’t allow someone to read or change another user’s records. Permissions granted in Accumoo shouldn’t automatically carry over to another Mohojo Werks application. Authentication can succeed while authorization denies the operation. These are different decisions, and they need to be treated separately.

This separation matters as Mohojo Werks grows. I want to reuse authentication across applications without requiring every application to have identical authorization rules. The account can be shared while authorization remains application-specific. Each application still needs rules governing what its users can do.

Conceptual diagram: shared authentication identifies the user, while Accumoo and a hypothetical future application each enforce authorization for their own records.

Open full-size diagram: shared account and application boundaries

The two decisions can be illustrated with guard clauses. These names are invented for the example; they are not production interfaces or authorization rules.

function check_example_access(identity, application_policy):
    if not identity_is_authenticated(identity):
        return DENIED

    if not application_policy.allows_example_operation(identity):
        return DENIED

    return ALLOWED

Shared identity, application-specific data

With a shared identity established, I still need to keep each application’s data associated with the right application and user. In Accumoo, this includes the user’s Events (tracked activities), goals , and progress.

Suppose I add another Mohojo Werks application. Someone who already uses Accumoo could reuse their account, but the new app would manage its own records and business rules. Accumoo’s goals don’t become part of the new app just because the account is the same.

Application boundaries and user ownership both matter. Within each application, the backend also needs to enforce which records the user can access. This separation has to hold regardless of whether the request comes from a phone, a watch, or another supported client.

Shared code, application-specific responsibilities

This separation also shapes how I organize the code. I use application-agnostic code for responsibilities shared across Mohojo Werks applications, such as account management and authentication.

Application-specific code handles behavior that belongs to an individual app. Accumoo’s rules for goals and progress belong with Accumoo, rather than becoming conditions scattered throughout the shared account code.

This is DRY (Don’t Repeat Yourself) for common functionality and separation of concerns for application-specific behavior. I want each application’s rules to have a clear home. Grouping related behavior encourages high cohesion, while keeping shared code independent of individual apps reduces coupling. These boundaries also help me apply the single-responsibility principle by keeping account management and an application’s business rules from becoming responsibilities of the same module.

Conceptual code dependency diagram: the Accumoo module and a hypothetical future application module each use shared account functionality, while their application-specific behavior and policies stay together.

Open full-size diagram: shared and application-specific code

The convenience comes with responsibility

A change to shared code can affect every application that depends on it. Before changing account behavior, I need to consider existing clients and test the applications that use it, including applications unrelated to the change I’m making.

Regression testing needs to cover allowed operations and rejected ones. Checking that a user can access their own records matters; checking that access is denied outside the permitted application and user boundaries matters just as much.

Here are two illustrative test scenarios for the fictional access check. The policy fixtures stand in for decisions; they do not expose the real rules.

scenario "The application authorizes the operation":
    identity = example_authenticated_identity()
    decision = check_example_access(identity, allowing_policy())
    expect decision == ALLOWED

scenario "Authentication succeeds but authorization denies access":
    identity = example_authenticated_identity()
    decision = check_example_access(identity, denying_policy())
    expect decision == DENIED

Shared authentication, application-specific authorization, and data isolation give me the structure. For users, the payoff should be simpler: reuse their account and get on with using the app.

In Part 3, I’ll follow an operation through commands, policies, models, and response formatters, building on my earlier command-dispatch article. I want to show how these components divide the work while keeping their responsibilities clear.