Skip to content

refactor: The Plan#2275

Draft
charlesvien wants to merge 1 commit into
mainfrom
05-20-refactor_docs
Draft

refactor: The Plan#2275
charlesvien wants to merge 1 commit into
mainfrom
05-20-refactor_docs

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented May 21, 2026

Problem

This is the w.i.p. architectural plan for PostHog Code. It defines what the next version of the codebase looks like, where each kind of code lives, how the pieces talk and the rules every PR (human or agent) follows.

We are doing this because the codebase has drifted into "business logic everywhere", time to move mountains!

Changes

How did you test this?

Publish to changelog?

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien changed the title refactor docs refactor: The Master Plan May 21, 2026
@charlesvien charlesvien changed the title refactor: The Master Plan refactor: The Plan May 21, 2026
Comment thread AGENTS.md
- **R8** No `container.get(...)` inside service methods. Constructor injection only. A circular dep means the boundary is wrong; split or invert via events.
- **R9** Subscriptions are wired once per feature in `apps/code/src/renderer/features/<feature>/subscriptions.ts`, started at app boot. Components do not start subscriptions ad hoc.
- **R10** tRPC routers are one-liners. No inline business logic. No reaching past the service to a repository. No router without a backing service.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add in templates use Posthog/quill for everything on the rendering layer that's available

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore, should we consider a router? If this becomes the basis of the future, then we need a strong router... I'd suggest tanstack router (or even base the whole thing on tanstack start)... the devtools for the ecosystem is just incredible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants