| name | create-service |
| description | Create a new Encore service with API endpoints, database, and infrastructure. Use when the user wants to add a new service, create endpoints, or scaffold a new part of their backend. |
Create an Encore Service
When to use
- User wants to create a new service or microservice
- User wants to add API endpoints
- User wants to scaffold a new backend feature
Instructions
-
Create a new directory for the service at the project root.
-
Add encore.service.ts (TypeScript) or a Go package file:
TypeScript:
import { Service } from "encore.dev/service";
export default new Service("service-name");
-
Add API endpoints in a separate file. Use typed request/response interfaces.
-
If the service needs a database, declare it with SQLDatabase and create a migrations/ directory with numbered SQL migration files (e.g., 1_create_tables.up.sql).
-
If the service needs to communicate asynchronously, use Topic and Subscription from encore.dev/pubsub.
-
Use the MCP server to inspect existing services (get_services) before creating new ones to follow existing patterns.
-
After creating files, tell the user to run encore run to start the app with the new service.
Checklist