celeris / api
Celeris API base application scaffold for building service-oriented and REST APIs.
Requires
- php: >=8.4
- celeris/framework: ^1.0
Suggests
- celeris/notification-dispatch-worker: Enable outbox dispatch worker services via NotificationDispatchWorkerServiceProvider.
- celeris/notification-in-app: Enable durable in-app user notifications via InAppNotificationServiceProvider.
- celeris/notification-outbox: Enable transactional outbox services via OutboxServiceProvider.
- celeris/notification-realtime-gateway-websocket: Enable realtime websocket gateway client via RealtimeGatewayServiceProvider.
- celeris/notification-smtp: Enable the SMTP notification channel provider for outbound email delivery.
This package is auto-updated.
Last update: 2026-04-29 08:47:50 UTC
README
celeris/api is a base application scaffold for building REST APIs and service-oriented backends on top of celeris/framework.
It gives you a practical starting point instead of an empty shell: a bootstrapped HTTP entrypoint, API controllers, DTOs, services, repositories, config files, migrations, seeded example data, and optional notification worker hooks.
What It Is For
Use this package when you want to start a new API quickly without rebuilding the same foundation each time.
It is a good fit for:
- internal business APIs
- service-oriented backends
- CRUD-heavy applications
- authenticated JSON APIs
- projects that may later grow into event-driven or notification-enabled services
Included Features
- API-first bootstrap with a JSON root endpoint and
/healthstyle service readiness flow - Example auth endpoints under
/api/authfor login and identity inspection - Example resource endpoints under
/api/contacts - Attribute-based routing through Celeris controllers
- DTO-driven request input mapping for create and update flows
- Service and repository layers already separated for easier maintenance
- Database configuration, migrations, and seed data out of the box
- Environment-based security toggles for JWT, opaque tokens, cookie sessions, API tokens, and mTLS
- Built-in rate-limit configuration
- Optional notification integrations for SMTP, in-app notifications, transactional outbox, realtime delivery, and dispatch workers
- CLI wrappers for migrations and worker scripts
Advantages
- Faster project setup: you can begin with working application structure immediately
- Clear boundaries: controllers, services, repositories, DTOs, config, and bootstrap are already organized
- Safer customization: generated base classes and extension points make it easier to evolve scaffolded code cleanly
- Production-friendly direction: auth, rate limiting, migrations, and notification workflows are already anticipated
- Monorepo-friendly local development: the stub can run against the local framework package during development
Default API Surface
The scaffold currently exposes these starter endpoints:
GET /returns basic API and framework metadataPOST /api/auth/loginauthenticates the demo user and returns a token payloadGET /api/auth/mereturns the authenticated identityGET /api/contactslists contactsGET /api/contacts/{id}fetches one contactPOST /api/contactscreates a contactPUT /api/contacts/{id}updates a contactDELETE /api/contacts/{id}deletes a contact
Treat these as a starting point. They are intentionally simple so you can replace, extend, or remove them as your real domain takes shape.
Quick Start
Create a project from the package:
composer create-project celeris/api my-api
cd my-api
cp .env.example .env
composer install
php celeris app-key
php bin/migrate.php up
php -S 127.0.0.1:8000 -t public
If you are working inside the Celeris monorepo, the scaffold can also fall back to the local framework bootstrap and CLI binary during development.
Project Structure
public/index.phpboots the HTTP kernel and registers API controllersapp/Http/Controllers/Apicontains your API controllersapp/Http/DTOscontains request DTOsapp/Servicesholds application use casesapp/Repositoriescontains persistence-facing codedatabase/migrationscontains schema changesdatabase/seedscontains sample seed dataconfigcentralizes environment-driven app behaviorbincontains migration and notification worker helpers
Notifications and Background Work
The stub is ready for optional notification packages, but keeps them disabled by default. That means you can start lean and only enable the pieces you actually need.
When those packages are installed, the scaffold already includes entrypoints such as:
php bin/notifications-dispatch-worker.phpphp bin/notifications-replay-dead-letter.php
This makes the package a nice fit for APIs that may grow from simple synchronous CRUD into more resilient event-driven workflows.
Recommendations
- Replace the sample
Contactdomain early with your real bounded context - Copy
.env.exampleto.envand explicitly review all security flags before deploying - Set
APP_KEYandJWT_SECRETbefore enabling JWT authentication - Keep auth strategies opt-in; only enable the ones your service truly needs
- Treat the demo credentials as development-only scaffolding
- Add your domain-specific tests as soon as you start replacing the example endpoints
- If you adopt the outbox flow, run the dispatch worker separately from the HTTP process
Tip
The best way to use this stub is not to preserve every sample file, but to preserve the structure. Replace the demo domain quickly, keep the layering, and let the scaffold accelerate your first real feature instead of becoming long-lived placeholder code.