Skip to content

Create Post

FieldValue
Featureposts
StatusActive
Risk LevelMedium
Last updated2026-06-01

Summary

Authenticated authors create draft posts with a title and body. The post appears in the author’s draft list immediately after creation.


Command or Query

TypeNameInputOutputIdempotency
CommandCreatePostCommandTitle, Content, AuthorId (from auth)CreatePostResult with PostIdNo

Structural validation

  • Title: required, 1–200 characters.
  • Content: required, 1–50_000 characters.
  • AuthorId: MUST come from authenticated user context, not the request body.

Domain Behavior

Invokes Post.Create(title, content, authorId, clock.UtcNow) on the Post aggregate. Post starts in Draft state. Raises PostCreated domain event.


Exceptions

ExceptionWhenHTTP status
AuthorNotFoundExceptionAuthor aggregate missing404
CommandValidationExceptionStructural validation failure400

HTTP Endpoint

MethodPathAuthRate limitIdempotency-Key
POST/api/v1/postsRequireAuthenticatedUserauthenticated-apiNo

Persistence

ChangeMigration strategy
Insert into posts tableExpand

UI

See docs/ui/web/pages/create-post.md.

Server Action createPostAction submits the form. Empty title shows inline field error from RFC 7807 invalidParams.


Out of Scope

  • Publishing the post (see publish-post.md).
  • Rich text or attachment upload.

Test Specification

See create-post.tests.md.