encore-getting-started by encoredev/skills
npx skills add https://github.com/encoredev/skills --skill 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
# 交互式 - 从模板中选择
encore app create my-app
# 或从空白应用开始
encore app create my-app --example=ts/hello-world
一个最小的 Encore.ts 应用:
my-app/
├── encore.app # 应用配置
├── package.json # 依赖项
├── tsconfig.json # TypeScript 配置
├── encore.service.ts # 服务定义
└── api.ts # API 端点
// encore.app
{
"id": "my-app"
}
此文件标记了 Encore 应用的根目录。id 是应用的唯一标识符。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
创建 encore.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!" };
}
);
# 启动开发服务器
encore run
# 您的 API 现在可通过 http://localhost:4000 访问
# 打开本地开发仪表板
encore run
# 然后访问 http://localhost:9400
仪表板显示:
| 命令 | 描述 |
|---|---|
encore run | 启动本地开发服务器 |
encore test | 运行测试 |
encore db shell <db> | 打开数据库的 psql shell |
encore gen client | 生成 API 客户端代码 |
encore app link | 链接到现有的 Encore Cloud 应用 |
// 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-api 技能)encore-auth 技能)encore-infrastructure 技能)encore app link 然后 git push encore每周安装量
137
代码仓库
GitHub 星标数
20
首次出现
2026年1月21日
安全审计
安装于
codex108
opencode107
gemini-cli105
claude-code98
github-copilot88
cursor82
# 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-world
A minimal Encore.ts app:
my-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"
}
This file marks the root of your Encore app. The id is your app's unique identifier.
Create encore.service.ts to define a service:
// 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
The dashboard shows:
| Command | Description |
|---|---|
encore run | Start the local development server |
encore test | Run tests |
encore db shell <db> | Open a psql shell to a database |
encore gen client | Generate API client code |
encore app link | Link to an existing Encore Cloud app |
// db.ts
import { SQLDatabase } from "encore.dev/storage/sqldb";
const db = new SQLDatabase("mydb", {
migrations: "./migrations",
});
Create a migration:
-- migrations/1_create_table.up.sql
CREATE TABLE items (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL
);
encore-api skill)encore-auth skill)encore-infrastructure skill)encore app link then git push encoreWeekly Installs
137
Repository
GitHub Stars
20
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
codex108
opencode107
gemini-cli105
claude-code98
github-copilot88
cursor82
Supabase Postgres 最佳实践指南 - 8大类别性能优化规则与SQL示例
68,400 周安装