Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

3.8 KiB

Squidex

Headless CMS. Angular frontend in frontend/, ASP.NET Core backend in backend/.

Frontend

  • Angular app in frontend/, source under src/app:
    • framework/ — generic, reusable UI components and utilities (no domain knowledge).
    • shared/ — Squidex-specific services, state stores and components.
    • features/ — the actual screens (apps, assets, content, rules, schemas, settings, teams, ...).
    • shell/ — app frame, navigation, layout.
  • State is handled with the state store pattern from framework/state.ts (immutable value objects + State<T> subclasses), not with a third-party store library.
  • Commands:
npm start
npm test
npm run lint

Best Practices

  • i18n texts live in backend/i18n, translations are generated into the frontend — do not edit generated translation files by hand.
  • Do not write JsDoc comments.
  • Define colors only in src/app/theme/_colors.scss: literal values, the light/dark palettes and computed colors (shade(), fade(), ...). Everywhere else use the $color-* variables. In TypeScript, read theme colors with ThemeService.getColor(). Exceptions are semantic data colors (avatar colors, rule icon colors, chart colors).
  • In tests, keep verify calls and expect calls next to each other, without blank lines between them.

Backend

  • .NET solution backend/Squidex.slnx. Projects under backend/src, tests under backend/tests, optional integrations under backend/extensions.
  • Layering: Squidex.Infrastructure (generic building blocks) → Squidex.Domain.Apps.* (core model, operations, events, entities) → Squidex.Web / Squidex (API host).
  • Event-sourced domain: aggregates emit events from Squidex.Domain.Apps.Events, state is projected into MongoDB or EF Core (Squidex.Data.MongoDb, Squidex.Data.EntityFramework).
  • Run tests with the filter below — some tests need external setup (real databases, Docker/Testcontainers) and will fail without it:

Tests

Some tests need test setup or test containers which are slow. Run the tests like this to skip these tests.

dotnet test --filter "Category!=Dependencies & Category!=TestContainer"
  • Use xUnit assertions (Assert.Equal, Assert.True, Assert.Single, Assert.Empty, ...) for simple properties and values.
  • Use FluentAssertions (Should().BeEquivalentTo(...)) only for deep, structural comparisons of objects and collections.
  • In Verify snapshot tests, verify one result per Verify/VerifyJson call. Do not combine several results into one snapshot.
  • Prefer scrubbing (ScrubInlineGuids, AddScrubber, ...) over ignoring members (IgnoreMember) for values that change between runs or environments. Only ignore members if they cannot be scrubbed.

Best Practices

  • Code style is enforced by StyleCop (backend/stylecop.json) and .editorconfig — follow the surrounding file's conventions.
  • Do not write XML comments.

Shared best practices

  • Do write precise short comments and only when needed.
  • Do not comment a class or a method, only put comments inside functions or above variables.
  • Do not comment properties in general (for example event properties). Only comment behavior inside classes.
  • Exception: properties of API models (DTOs) keep their XML comments, because they are used for the OpenAPI documentation.
  • Do not write conditions that span multiple lines. Split them into multiple if statements (e.g. early returns) instead.
  • Try to keep files under 300 lines. Split larger classes by responsibility. This does not apply to tests.
  • Do not put a blank line between a variable assignment and an if statement that checks this variable.
  • Use primary constructors whenever possible.

Maintaining this file

  • When the user states a new general coding guideline, confirm it with the user and then add it to this file automatically.