This is the monorepo that contains all the code and infrastructure for AnalogJS.
- Monorepo managed by Nx and pnpm
- Main framework: AnalogJS (meta-framework for Angular, powered by Vite)
- Contains multiple apps (Angular, Astro, blog, docs, trpc, etc.) and libraries (shared, card, top-bar, etc.)
- Key packages:
@analogjs/platform,@analogjs/vite-plugin-angular,@analogjs/vitest-angular,@analogjs/vite-plugin-nitro,@analogjs/router, etc. - Node engines:
^22.0.0 || ^24.0.0, pnpm^10.0.0
tsconfig.base.json- TypeScript path aliases for all packagesnx.json- Nx workspace configurationpnpm-workspace.yaml- pnpm workspace definitionrelease.config.cjs- semantic-release configuration.github/workflows/- CI/CD workflows.githooks/- git hooks (commit-msg, pre-commit)CONTRIBUTING.md- full contribution guidelines
- Install dependencies:
pnpm i - Build all projects:
pnpm build(uses Nx) - Build
nx build <project> - Serve main app:
pnpm devorpnpm start(runsnx serve) - Test all projects:
pnpm test(runs Vitest via Nx) - Format workspace:
nx format - Lint:
nx lint <project> - Check formatting:
nx format:check - Storybook:
nx storybook <project> - Docs site:
pnpm nx serve docs-app(Docusaurus) - E2E:
nx e2e <project>(Cypress/Playwright)
nx test <package-name>(unit tests via Vitest)nx build <package-name>to verify build- For E2E:
pnpm e2e - Run
nx format:checkto verify formatting
- Apps: in
apps/(e.g.,analog-app,astro-app,docs-app,blog-app, etc.) - Libraries: in
packages/(shared code, features, platform, plugins) - TypeScript path aliases: defined in
tsconfig.base.json - Vite config: each app has its own
vite.config.ts(seeapps/analog-app/vite.config.tsfor advanced AnalogJS/Vite usage) - Release: Automated with semantic-release through CI, see
release.config.cjsandtools/publish.sh
| Directory | npm Package | Commit Scope |
|---|---|---|
packages/platform |
@analogjs/platform |
platform |
packages/router |
@analogjs/router |
router |
packages/content |
@analogjs/content |
content |
packages/content-plugin |
@analogjs/content-plugin |
content-plugin |
packages/vite-plugin-angular |
@analogjs/vite-plugin-angular |
vite-plugin-angular |
packages/vite-plugin-nitro |
@analogjs/vite-plugin-nitro |
vite-plugin-nitro |
packages/vitest-angular |
@analogjs/vitest-angular |
vitest-angular |
packages/nx-plugin |
@analogjs/nx-plugin |
nx-plugin |
packages/create-analog |
create-analog |
create-analog |
packages/storybook-angular |
@analogjs/storybook-angular |
storybook-angular |
packages/trpc |
@analogjs/trpc |
trpc |
packages/astro-angular |
@analogjs/astro-angular |
astro-angular |
- Use
CONTRIBUTING.mdas the source of truth for base branch, PR requirements, title and commit conventions, supported types/scopes, breaking change notes, and submission expectations. - Use
.github/PULL_REQUEST_TEMPLATE.mdfor PR body structure, including affected scope, test plan, and maintainer-facing merge-strategy recommendations.
- Before reviewing branch history, run
git fetch --all. - Treat
https://github.com/analogjs/analog.gitas the upstream source of truth and compare the current branch against the relevantanalogjs/*remote branch. - If the branch mixes multiple packages or concerns, recommend
git reset --soft <base-commit>and re-commit the staged changes into smaller, policy-aligned groups. - Prefer regrouping by affected package or primary package scope using the directory mapping above.
- Before changing GitHub metadata, ask whether the user wants the PR title and description updated. If no PR exists for the branch, ask whether they want one created.
- Treat
Squash mergeas the highly preferred maintainer recommendation. - Recommend a non-squash merge only when the PR intentionally preserves important commit boundaries, and include a brief note about why those boundaries matter and why the PR should bypass focused changes per package.
- If history is rewritten, remind the user that they can run
git push --force, but do not do it on their behalf unless they explicitly ask.
- Nx is the orchestrator for builds, tests, linting, and generators.
- Use
nx run-many --target <target> --allfor bulk operations. - Project-specific config in
apps/*/project.jsonandlibs/*/project.json. - Nx plugins and generators are in
packages/nx-plugin.
- Always open an issue before a pull request for review by the maintainers. This ensures alignment on implementation of features.
- Keep changes minimal and targeted.
- Backward compatibility is critical for new features, allowing progressive adoption.
- Keep code concise with emphasis on readability, avoid clever solutions and abstractions.
- Always scan existing codebase for examples and patterns for implementation.
- Prefer using existing Angular APIs, with wrappers where needed.
- Strongly prefer AST parsing instead of regex for complex file manipulation and traversal.
- Always use modern Angular syntax including dependency injection with inject, control flow, signal APIs, and standalone components.
- Cross compatibility with Nx is strongly encouraged. Prefer schematics and builders for Analog first-party solutions.
- Avoid custom code that replicates Angular framework functionality.
- Don't be overly verbose with comments.
- Keep tests lightweight and targeted to critical functionality testing.
- Add concise documentation with descriptive sections to the appropriate guides in the
docs-appapp. - Maintain compatibility with Vite versions 6-8, with progressive fallbacks.
- Use other projects as inspiration, but do not directly copy their APIs.
- See
CONTRIBUTING.mdfile for more contribution guidelines.
- Add Angular SFC references to features or docs
- Create new abstractions for one-time operations
- Add verbose comments, docstrings, or type annotations to code you didn't change
- Add error handling or validation for scenarios that can't happen
- Design for hypothetical future requirements
- Inline code from npm packages, preserving OSS dependencies
- Always run
pnpm ibefore building ifpnpm-lock.yamlhas changed - The
astro-appis excluded from the main build (--exclude=astro-app) - Git hooks are in
.githooks/(not.husky/), configured viagit config core.hookspath .githooks - The
preparescript sets up git hooks — runs automatically afterpnpm i
- Vite: All apps use Vite for build/dev, with custom plugins for Angular and Nitro
- Nitro: Used for SSR, SSG, and API routes (see
vite.config.tsandserver.mjs) - Docusaurus: Docs site in
apps/docs-app - Storybook: For Angular components, see
@analogjs/storybook-angular - CI/CD: Release and publish via semantic-release and custom scripts
- Add a new Angular app:
nx g @nx/angular:application <name> - Run tests for a lib:
nx test <lib-name> - Build docs site:
pnpm nx build docs-app