Loading...
Loading...
Get started with Encore.ts - create and run your first app.
npx skill4agent add encoredev/skills encore-getting-started# macOS
brew install encoredev/tap/encore
# Linux/WSL
curl -L https://encore.dev/install.sh | bash
# Windows (PowerShell)
iwr https://encore.dev/install.ps1 | iex# Interactive - choose from templates
encore app create my-app
# Or start with a blank app
encore app create my-app --example=ts/hello-worldmy-app/
├── encore.app # App configuration
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
├── encore.service.ts # Service definition
└── api.ts # API endpoints// encore.app
{
"id": "my-app"
}idencore.service.ts// encore.service.ts
import { Service } from "encore.dev/service";
export default new Service("my-service");// api.ts
import { api } from "encore.dev/api";
interface HelloResponse {
message: string;
}
export const hello = api(
{ method: "GET", path: "/hello", expose: true },
async (): Promise<HelloResponse> => {
return { message: "Hello, World!" };
}
);# Start the development server
encore run
# Your API is now available at http://localhost:4000# Opens the local development dashboard
encore run
# Then visit http://localhost:9400| Command | Description |
|---|---|
| Start the local development server |
| Run tests |
| Open a psql shell to a database |
| Generate API client code |
| Link to an existing Encore Cloud app |
// db.ts
import { SQLDatabase } from "encore.dev/storage/sqldb";
const db = new SQLDatabase("mydb", {
migrations: "./migrations",
});-- migrations/1_create_table.up.sql
CREATE TABLE items (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL
);encore-apiencore-authencore-infrastructureencore app linkgit push encore