vapor

- ALWAYS use Swift Concurrency (async /await ) over EventLoopFuture .

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "vapor" with this command: npx skills add tryswift/try-swift-tokyo/tryswift-try-swift-tokyo-vapor

Vapor Best Practices

  1. Concurrency
  • ALWAYS use Swift Concurrency (async /await ) over EventLoopFuture .

  • Use req.application.asyncController patterns if using custom executors, but standard async route handlers are preferred.

  1. Controllers & Routing
  • Organize routes into RouteCollection conformances.

  • Do not put logic in routes.swift ; delegate immediately to a Controller.

  • Group routes by feature (e.g., UsersController , AuthController ).

  1. Fluent (Database)
  • Use @Parent and @Children property wrappers correctly.

  • Always use DTOs (Data Transfer Objects) implementation Content for API requests/responses. NEVER return a Fluent Model directly to the client.

  • Run migrations via app.migrations.add(...) .

  1. Environment
  • Use Environment.get("KEY") for configuration.

  • Support Production vs Development modes explicitly in configure.swift .

Example Route

func boot(routes: RoutesBuilder) throws { let users = routes.grouped("users") users.get(use: index) }

@Sendable func index(req: Request) async throws -> [UserDTO] { let users = try await User.query(on: req.db).all() return users.map { $0.toDTO() } }

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

tca

No summary provided by upstream source.

Repository SourceNeeds Review
General

swift-concurrency

No summary provided by upstream source.

Repository SourceNeeds Review
General

vapor

No summary provided by upstream source.

Repository SourceNeeds Review
General

image-gen

Generate AI images from text prompts. Triggers on: "生成图片", "画一张", "AI图", "generate image", "配图", "create picture", "draw", "visualize", "generate an image".

Archived SourceRecently Updated