Skip to content

API Routes

Stelo CMS provides a comprehensive API layer built with tRPC for type-safe client-server communication, with REST fallbacks for external integrations.

export const appRouter = router({
// Entity routers
pages: pagesRouter,
collections: collectionsRouter,
globals: globalsRouter,
users: usersRouter,
media: mediaRouter,
// Utility routers
search: searchRouter,
analytics: analyticsRouter,
auth: authRouter
});
  • getAll - List all entities
  • getById - Get single entity by ID
  • getBySlug - Get entity by slug
  • getPublished - Get published content
  • create - Create new entity
  • update - Update existing entity
  • delete - Delete entity
  • publish/unpublish - Status changes

All API routes are protected with session-based authentication and role-based permissions.

Standard response format ensures consistency:

{
data: T | T[],
meta?: {
total: number,
page: number,
limit: number
},
error?: string
}

This section will be expanded with detailed implementation examples.