### CLI Application Setup and Commands Source: https://context7.com/effect-ts/examples/llms.txt Commands to create an Effect CLI application, install dependencies, build, and run the compiled CLI. ```bash pnpm create effect-app my-cli --template cli --eslint cd my-cli pnpm install pnpm build node ./dist/bin.cjs ``` -------------------------------- ### Basic Package Setup and Commands Source: https://context7.com/effect-ts/examples/llms.txt Commands to create a basic Effect package, install dependencies, build, test, and execute TypeScript files directly. ```bash pnpm create effect-app my-package --template basic --eslint --workflows cd my-package pnpm install pnpm build pnpm test pnpm tsx ./src/index.ts ``` -------------------------------- ### Example Project Creation: HTTP Server Source: https://context7.com/effect-ts/examples/llms.txt Clone an official Effect example project, such as the HTTP server, to learn from real-world implementations. ```bash create-effect-app my-server --example http-server ``` -------------------------------- ### Monorepo Setup and Commands Source: https://context7.com/effect-ts/examples/llms.txt Commands to create an Effect monorepo, install dependencies, build all packages, and run tests across the monorepo. ```bash pnpm create effect-app my-monorepo --template monorepo --changesets --workflows cd my-monorepo pnpm install # Build all packages pnpm build # Test all packages pnpm test ``` -------------------------------- ### Running HTTP Server Example with Curl Source: https://context7.com/effect-ts/examples/llms.txt Provides bash commands to set up and run an HTTP server example, and interact with it using curl for creating users and retrieving authenticated user data. ```bash # Clone the example pnpm create effect-app my-server --example http-server cd my-server cp .env.example .env pnpm install # Start the development server pnpm dev # Server listening on http://localhost:3000 # Create a user curl -X POST http://localhost:3000/users \ -H "Content-Type: application/json" \ -d '{"email": "user@example.com"}' \ -c cookies.txt # Get current user (authenticated) curl http://localhost:3000/users/me \ -b cookies.txt # Access Swagger documentation open http://localhost:3000/docs ``` -------------------------------- ### List All TODOs API Endpoint Source: https://github.com/effect-ts/examples/blob/main/templates/monorepo/packages/server/README.md Retrieve a list of all TODO items using this GET request. ```sh curl -X GET http://localhost:3000/todos ``` -------------------------------- ### Export Example Values in Effect-TS Source: https://github.com/effect-ts/examples/blob/main/scripts/examples.template.txt Exports internal example values, aliased as 'examples', from 'EXAMPLE_VALUES'. This is intended for internal use and assumes 'EXAMPLE_VALUES' is a constant. ```typescript /** @internal */ export const examples = EXAMPLE_VALUES as const ``` -------------------------------- ### Non-Interactive Create Effect App Usage Source: https://github.com/effect-ts/examples/blob/main/packages/create-effect-app/README.md Invoke the create-effect-app CLI non-interactively to specify project name, template, example, and various initialization options. ```sh create-effect-app [(-t, --template basic | cli | monorepo) [--changesets] [--flake] [--eslint] [--workflows]] [] ``` ```sh create-effect-app [(-e, --example http-server)] [] ``` -------------------------------- ### Effect CLI Basic Structure Source: https://context7.com/effect-ts/examples/llms.txt Defines a basic command-line interface structure using Effect CLI. This example shows how to create a simple command named 'hello'. ```typescript // src/Cli.ts - Basic CLI structure import * as Command from "@effect/cli/Command" const command = Command.make("hello") export const run = Command.run(command, { name: "Hello World", version: "0.0.0" }) ``` -------------------------------- ### Define Example Type in Effect-TS Source: https://github.com/effect-ts/examples/blob/main/scripts/examples.template.txt Defines an internal type alias 'Example' for 'EXAMPLE_TYPE'. Use this for internal type definitions within Effect-TS projects. ```typescript /** @internal */ export type Example = EXAMPLE_TYPE ``` -------------------------------- ### Run TypeScript File with tsx Source: https://github.com/effect-ts/examples/blob/main/templates/cli/README.md Use this command to execute TypeScript files directly in a Node.js environment without prior compilation. Ensure tsx is installed. ```sh pnpm tsx ./path/to/the/file.ts ``` -------------------------------- ### Get Specific TODO by ID API Endpoint Source: https://github.com/effect-ts/examples/blob/main/templates/monorepo/packages/server/README.md Fetch a single TODO item by its unique identifier. Replace '0' with the desired TODO ID. ```sh curl -X GET http://localhost:3000/todos/0 ``` -------------------------------- ### Effect HTTP API Composition Source: https://context7.com/effect-ts/examples/llms.txt Defines a type-safe HTTP API by composing multiple API groups using Effect's declarative API builder. This example composes Accounts, Groups, and People APIs. ```typescript // src/Api.ts - Composing API groups import { HttpApi, OpenApi } from "@effect/platform" import { AccountsApi } from "./Accounts/Api.js" import { GroupsApi } from "./Groups/Api.js" import { PeopleApi } from "./People/Api.js" export class Api extends HttpApi.make("api") .add(AccountsApi) .add(GroupsApi) .add(PeopleApi) .annotate(OpenApi.Title, "Groups API") {} ``` -------------------------------- ### Interactive Project Creation with npm, pnpm, yarn, and bun Source: https://context7.com/effect-ts/examples/llms.txt Use these commands to interactively create a new Effect project with create-effect-app. Choose your preferred package manager. ```bash npx create-effect-app my-project ``` ```bash pnpm create effect-app my-project ``` ```bash yarn create effect-app my-project ``` ```bash bunx create-effect-app my-project ``` -------------------------------- ### Launch Effect-TS Application Source: https://context7.com/effect-ts/examples/llms.txt The main entry point for the application, setting up the Effect-TS runtime and launching the HTTP server with tracing enabled. ```typescript // src/main.ts - Application entry point import { NodeRuntime } from "@effect/platform-node" import { Layer } from "effect" import { HttpLive } from "./Http.js" import { TracingLive } from "./Tracing.js" HttpLive.pipe(Layer.provide(TracingLive), Layer.launch, NodeRuntime.runMain) ``` -------------------------------- ### Non-Interactive Basic Package Creation Source: https://context7.com/effect-ts/examples/llms.txt Create a basic Effect package template with all features enabled using command-line flags. This includes Changesets, Nix flake, ESLint, and GitHub Actions workflows. ```bash create-effect-app my-package \ --template basic \ --changesets \ --flake \ --eslint \ --workflows ``` -------------------------------- ### Create Effect App with bun Source: https://github.com/effect-ts/examples/blob/main/packages/create-effect-app/README.md Use bun to interactively create a new Effect application. You will be prompted to select a project type and customize options. ```sh bunx create-effect-app [project-name] ``` -------------------------------- ### Type-Safe API Client Usage Source: https://context7.com/effect-ts/examples/llms.txt Demonstrates how to create and use a type-safe API client generated from an API definition. Includes setting up a cookie jar for session management and making authenticated requests. ```typescript // src/client.ts - Type-safe API client usage import { Cookies, HttpApiClient, HttpClient } from "@effect/platform" import { NodeHttpClient, NodeRuntime } from "@effect/platform-node" import { Effect, Ref } from "effect" import { Api } from "./Api.js" import { Email } from "./Domain/Email.js" Effect.gen(function*() { // Cookie jar for session management const cookies = yield* Ref.make(Cookies.empty) // Create type-safe API client const client = yield* HttpApiClient.make(Api, { baseUrl: "http://localhost:3000", transformClient: HttpClient.withCookiesRef(cookies) }) // Create a new user (sets authentication cookie) const user = yield* client.accounts.createUser({ payload: { email: Email.make("joe.bloggs@example.com") } }) console.log("Created user:", user) // Get current authenticated user const me = yield* client.accounts.getUserMe() console.log("Current user:", me) }).pipe(Effect.provide(NodeHttpClient.layerUndici), NodeRuntime.runMain) ``` -------------------------------- ### Create Effect App with npm Source: https://github.com/effect-ts/examples/blob/main/packages/create-effect-app/README.md Use npm to interactively create a new Effect application. You will be prompted to select a project type and customize options. ```sh npx create-effect-app [project-name] ``` -------------------------------- ### Non-Interactive CLI Application Creation Source: https://context7.com/effect-ts/examples/llms.txt Create an Effect CLI application template with minimal features, including ESLint for code linting. ```bash create-effect-app my-cli \ --template cli \ --eslint ``` -------------------------------- ### Configure and Serve HTTP API Source: https://context7.com/effect-ts/examples/llms.txt Sets up the HTTP server with various middleware including logging, Swagger UI, OpenAPI specification, and CORS support. It defines the main API layer and provides the Node.js HTTP server implementation. ```typescript // src/Http.ts - Server configuration import { HttpApiBuilder, HttpApiSwagger, HttpMiddleware, HttpServer } from "@effect/platform" import { NodeHttpServer } from "@effect/platform-node" import { Layer } from "effect" import { createServer } from "http" import { HttpAccountsLive } from "./Accounts/Http.js" import { Api } from "./Api.js" import { HttpGroupsLive } from "./Groups/Http.js" import { HttpPeopleLive } from "./People/Http.js" const ApiLive = Layer.provide(HttpApiBuilder.api(Api), [ HttpAccountsLive, HttpGroupsLive, HttpPeopleLive ]) export const HttpLive = HttpApiBuilder.serve(HttpMiddleware.logger).pipe( Layer.provide(HttpApiSwagger.layer()), // Swagger UI at /docs Layer.provide(HttpApiBuilder.middlewareOpenApi()), // OpenAPI spec Layer.provide(HttpApiBuilder.middlewareCors()), // CORS support Layer.provide(ApiLive), HttpServer.withLogAddress, Layer.provide(NodeHttpServer.layer(createServer, { port: 3000 })) ) ``` -------------------------------- ### Build Effect CLI Package Source: https://github.com/effect-ts/examples/blob/main/templates/cli/README.md Execute this command to compile and package your Effect CLI application. This is typically used before deployment or distribution. ```sh pnpm build ``` -------------------------------- ### Test Effect CLI Package Source: https://github.com/effect-ts/examples/blob/main/templates/cli/README.md Run this command to execute the test suite for your Effect CLI application. Ensure your tests are configured correctly. ```sh pnpm test ``` -------------------------------- ### Non-Interactive Monorepo Creation Source: https://context7.com/effect-ts/examples/llms.txt Create an Effect monorepo template with Changesets, ESLint, and GitHub Actions workflows, but without Nix flake support. ```bash create-effect-app my-monorepo \ --template monorepo \ --changesets \ --eslint \ --workflows ``` -------------------------------- ### Implement HTTP Authentication Layer Source: https://context7.com/effect-ts/examples/llms.txt Provides an implementation for the Authentication service using dependency injection. It finds a user by access token and handles unauthorized access. ```typescript // src/Accounts/Http.ts - HTTP handler implementation import { HttpApiBuilder } from "@effect/platform" import { Effect, Layer, Option, pipe } from "effect" import { Accounts } from "../Accounts.js" import { Api } from "../Api.js" import { accessTokenFromRedacted } from "../Domain/AccessToken.js" import { policyUse, Unauthorized, withSystemActor } from "../Domain/Policy.js" import { CurrentUser, UserId, UserNotFound } from "../Domain/User.js" import { Authentication } from "./Api.js" import { AccountsPolicy } from "./Policy.js" import { UsersRepo } from "./UsersRepo.js" // Authentication layer implementation export const AuthenticationLive = Layer.effect( Authentication, Effect.gen(function*() { const userRepo = yield* UsersRepo return Authentication.of({ cookie: (token) => userRepo.findByAccessToken(accessTokenFromRedacted(token)).pipe( Effect.flatMap( Option.match({ onNone: () => new Unauthorized({ actorId: UserId.make(-1), entity: "User", action: "read" }), onSome: Effect.succeed }) ), Effect.withSpan("Authentication.cookie") ) }) }) ).pipe(Layer.provide(UsersRepo.Default)) ``` -------------------------------- ### Create Effect App with pnpm Source: https://github.com/effect-ts/examples/blob/main/packages/create-effect-app/README.md Use pnpm to interactively create a new Effect application. You will be prompted to select a project type and customize options. ```sh pnpm create effect-app [project-name] ``` -------------------------------- ### Create TODO API Endpoint Source: https://github.com/effect-ts/examples/blob/main/templates/monorepo/packages/server/README.md Use this endpoint to create a new TODO item. Requires a JSON payload with the 'text' field. ```sh curl -X POST http://localhost:3000/todos \ -H "Content-Type: application/json" \ -d '{"text": "my first effect todo"}' ``` -------------------------------- ### Create Effect App with yarn Source: https://github.com/effect-ts/examples/blob/main/packages/create-effect-app/README.md Use yarn to interactively create a new Effect application. You will be prompted to select a project type and customize options. ```sh yarn create effect-app [project-name] ``` -------------------------------- ### TODO API Endpoints Source: https://github.com/effect-ts/examples/blob/main/templates/monorepo/packages/server/README.md The server provides several endpoints for managing TODO items. ```APIDOC ## POST /todos ### Description Creates a new TODO item. ### Method POST ### Endpoint http://localhost:3000/todos ### Parameters #### Request Body - **text** (string) - Required - The text content of the TODO item. ### Request Example { "text": "my first effect todo" } ### Response #### Success Response (200) - **id** (number) - The unique identifier for the created TODO. - **text** (string) - The text content of the TODO item. - **completed** (boolean) - Indicates if the TODO item is completed. #### Response Example { "id": 0, "text": "my first effect todo", "completed": false } ``` ```APIDOC ## GET /todos ### Description Retrieves a list of all TODO items. ### Method GET ### Endpoint http://localhost:3000/todos ### Response #### Success Response (200) - **todos** (array) - An array of TODO objects. - Each object contains: - **id** (number) - The unique identifier for the TODO. - **text** (string) - The text content of the TODO item. - **completed** (boolean) - Indicates if the TODO item is completed. #### Response Example [ { "id": 0, "text": "my first effect todo", "completed": false } ] ``` ```APIDOC ## GET /todos/{id} ### Description Retrieves a specific TODO item by its ID. ### Method GET ### Endpoint http://localhost:3000/todos/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The unique identifier of the TODO item to retrieve. ### Response #### Success Response (200) - **id** (number) - The unique identifier for the TODO. - **text** (string) - The text content of the TODO item. - **completed** (boolean) - Indicates if the TODO item is completed. #### Response Example { "id": 0, "text": "my first effect todo", "completed": false } ``` ```APIDOC ## PATCH /todos/{id} ### Description Marks a specific TODO item as completed by its ID. ### Method PATCH ### Endpoint http://localhost:3000/todos/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The unique identifier of the TODO item to mark as completed. ### Response #### Success Response (200) - **id** (number) - The unique identifier for the TODO. - **text** (string) - The text content of the TODO item. - **completed** (boolean) - Indicates if the TODO item is completed. #### Response Example { "id": 0, "text": "my first effect todo", "completed": true } ``` ```APIDOC ## DELETE /todos/{id} ### Description Deletes a specific TODO item by its ID. ### Method DELETE ### Endpoint http://localhost:3000/todos/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The unique identifier of the TODO item to delete. ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the TODO was deleted. #### Response Example { "message": "TODO with id 0 deleted successfully." } ``` -------------------------------- ### Implement HTTP Handlers with Authorization Source: https://context7.com/effect-ts/examples/llms.txt Defines HTTP handlers for account-related operations, integrating dependency injection and Effect composition for authorization policies. It handles user updates, retrieval, creation, and setting security cookies. ```typescript // HTTP handlers with authorization policies export const HttpAccountsLive = HttpApiBuilder.group( Api, "accounts", (handlers) => Effect.gen(function*() { const accounts = yield* Accounts const policy = yield* AccountsPolicy return handlers .handle("updateUser", ({ path, payload }) => pipe( accounts.updateUser(path.id, payload), policyUse(policy.canUpdate(path.id)) )) .handle("getUserMe", () => CurrentUser.pipe( Effect.flatMap(accounts.embellishUser), withSystemActor )) .handle("getUser", ({ path }) => pipe( accounts.findUserById(path.id), Effect.flatMap( Option.match({ onNone: () => new UserNotFound({ id: path.id }), onSome: Effect.succeed }) ), policyUse(policy.canRead(path.id)) )) .handle("createUser", ({ payload }) => accounts.createUser(payload).pipe( withSystemActor, Effect.tap((user) => HttpApiBuilder.securitySetCookie( Authentication.security.cookie, user.accessToken ) ) )) }) ).pipe( Layer.provide([Accounts.Default, AccountsPolicy.Default, AuthenticationLive]) ) ``` -------------------------------- ### Define User Account API Endpoints Source: https://context7.com/effect-ts/examples/llms.txt Create type-safe API endpoints for user account management, including authentication middleware and schema validation for requests and responses. Requires importing necessary Effect-TS platform modules. ```typescript // src/Accounts/Api.ts - User account endpoints import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSecurity, OpenApi } from "@effect/platform" import { Schema } from "effect" import { Unauthorized } from "../Domain/Policy.js" import { CurrentUser, User, UserIdFromString, UserNotFound, UserWithSensitive } from "../Domain/User.js" // Authentication middleware using cookie-based API key export class Authentication extends HttpApiMiddleware.Tag()( "Accounts/Api/Authentication", { provides: CurrentUser, failure: Unauthorized, security: { cookie: HttpApiSecurity.apiKey({ in: "cookie", key: "token" }) } } ) {} // Account management API group export class AccountsApi extends HttpApiGroup.make("accounts") .add( HttpApiEndpoint.patch("updateUser", "/users/:id") .setPath(Schema.Struct({ id: UserIdFromString })) .addSuccess(User.json) .addError(UserNotFound) .setPayload(Schema.partialWith(User.jsonUpdate, { exact: true })) ) .add( HttpApiEndpoint.get("getUserMe", "/users/me") .addSuccess(UserWithSensitive.json) ) .add( HttpApiEndpoint.get("getUser", "/users/:id") .setPath(Schema.Struct({ id: UserIdFromString })) .addSuccess(User.json) .addError(UserNotFound) ) .middlewareEndpoints(Authentication) .add( HttpApiEndpoint.post("createUser", "/users") .addSuccess(UserWithSensitive.json) .setPayload(User.jsonCreate) ) .annotate(OpenApi.Title, "Accounts") .annotate(OpenApi.Description, "Manage user accounts") {} ``` -------------------------------- ### Mark TODO as Completed API Endpoint Source: https://github.com/effect-ts/examples/blob/main/templates/monorepo/packages/server/README.md Mark a specific TODO item as completed by its ID. Replace '0' with the desired TODO ID. ```sh curl -X PATCH http://localhost:3000/todos/0 ``` -------------------------------- ### Effect-TS Project Name Validation Rules Source: https://context7.com/effect-ts/examples/llms.txt Lists the validation rules enforced by create-effect-app for project names to ensure compatibility with npm package naming conventions. ```typescript // Validation rules enforced by create-effect-app: // - Must be non-empty and less than 214 characters // - Must be lowercase // - Cannot start with . or _ // - Cannot contain special characters ~'!()* // - Cannot be a Node.js builtin module name // - Must contain only URL-friendly characters // Valid project names: // - my-project // - @myorg/my-package // - effect-app-2024 // Invalid project names: // - MyProject (contains capitals) // - .hidden (starts with .) // - _private (starts with _) // - fs (Node.js builtin) // - my project (contains space) ``` -------------------------------- ### User Account Management API Source: https://context7.com/effect-ts/examples/llms.txt API endpoints for managing user accounts, including creating, retrieving, and updating users. Authentication is handled via cookie-based API key. ```APIDOC ## POST /users ### Description Creates a new user. ### Method POST ### Endpoint /users ### Parameters #### Request Body - **id** (UserId) - Required - User ID - **accountId** (AccountId) - Required - Account ID - **email** (Email) - Required - User email - **accessToken** (AccessToken) - Required - User access token - **createdAt** (DateTimeInsert) - Required - Creation timestamp - **updatedAt** (DateTimeUpdate) - Required - Update timestamp ### Request Example ```json { "id": 1, "accountId": 101, "email": "user@example.com", "accessToken": "some_token", "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z" } ``` ### Response #### Success Response (200) - **id** (UserId) - User ID - **accountId** (AccountId) - Account ID - **email** (Email) - User email - **accessToken** (AccessToken) - User access token - **createdAt** (DateTimeInsert) - Creation timestamp - **updatedAt** (DateTimeUpdate) - Update timestamp - **account** (Account) - Associated account details #### Response Example ```json { "id": 1, "accountId": 101, "email": "user@example.com", "accessToken": "some_token", "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z", "account": { "id": 101, "name": "Example Account" } } ``` ## GET /users/me ### Description Retrieves the currently authenticated user's details, including sensitive information. ### Method GET ### Endpoint /users/me ### Response #### Success Response (200) - **id** (UserId) - User ID - **accountId** (AccountId) - Account ID - **email** (Email) - User email - **accessToken** (AccessToken) - User access token - **createdAt** (DateTimeInsert) - Creation timestamp - **updatedAt** (DateTimeUpdate) - Update timestamp - **account** (Account) - Associated account details #### Response Example ```json { "id": 1, "accountId": 101, "email": "user@example.com", "accessToken": "some_token", "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z", "account": { "id": 101, "name": "Example Account" } } ``` ## GET /users/:id ### Description Retrieves a specific user by their ID. ### Method GET ### Endpoint /users/:id ### Parameters #### Path Parameters - **id** (UserId) - Required - The ID of the user to retrieve. ### Response #### Success Response (200) - **id** (UserId) - User ID - **accountId** (AccountId) - Account ID - **email** (Email) - User email - **createdAt** (DateTimeInsert) - Creation timestamp - **updatedAt** (DateTimeUpdate) - Update timestamp #### Response Example ```json { "id": 1, "accountId": 101, "email": "user@example.com", "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z" } ``` #### Error Response (404) - **id** (UserId) - The ID of the user that was not found. #### Error Response Example ```json { "id": 999, "error": "UserNotFound" } ``` ## PATCH /users/:id ### Description Updates an existing user by their ID. ### Method PATCH ### Endpoint /users/:id ### Parameters #### Path Parameters - **id** (UserId) - Required - The ID of the user to update. #### Request Body - **accountId** (AccountId) - Optional - Account ID - **email** (Email) - Optional - User email - **accessToken** (AccessToken) - Optional - User access token - **createdAt** (DateTimeInsert) - Optional - Creation timestamp - **updatedAt** (DateTimeUpdate) - Optional - Update timestamp ### Response #### Success Response (200) - **id** (UserId) - User ID - **accountId** (AccountId) - Account ID - **email** (Email) - User email - **createdAt** (DateTimeInsert) - Creation timestamp - **updatedAt** (DateTimeUpdate) - Update timestamp #### Response Example ```json { "id": 1, "accountId": 101, "email": "updated_user@example.com", "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:05:00Z" } ``` #### Error Response (404) - **id** (UserId) - The ID of the user that was not found. #### Error Response Example ```json { "id": 999, "error": "UserNotFound" } ``` ``` -------------------------------- ### Define User Domain Model Source: https://context7.com/effect-ts/examples/llms.txt Define a User domain model using Effect's Model class, including generated fields, sensitive data handling, and branded types for type safety. This model supports automatic JSON serialization and integration with Effect-TS platform features. ```typescript // src/Domain/User.ts - User domain model import { HttpApiSchema } from "@effect/platform" import { Model } from "@effect/sql" import { Context, Schema } from "effect" import { AccessToken } from "./AccessToken.js" import { Account, AccountId } from "./Account.js" import { Email } from "./Email.js" // Branded type for type-safe user IDs export const UserId = Schema.Number.pipe(Schema.brand("UserId")) export type UserId = typeof UserId.Type export const UserIdFromString = Schema.NumberFromString.pipe( Schema.compose(UserId) ) // User model with generated fields and sensitive data handling export class User extends Model.Class("User")({ id: Model.Generated(UserId), accountId: Model.GeneratedByApp(AccountId), email: Email, accessToken: Model.Sensitive(AccessToken), createdAt: Model.DateTimeInsert, updatedAt: Model.DateTimeUpdate }) {} // User with sensitive fields exposed (for authenticated responses) export class UserWithSensitive extends Model.Class( "UserWithSensitive" ) ({ ...Model.fields(User), accessToken: AccessToken, account: Account }) {} // Context tag for current authenticated user export class CurrentUser extends Context.Tag("Domain/User/CurrentUser")< CurrentUser, User >() {} // Typed error for user not found export class UserNotFound extends Schema.TaggedError()( "UserNotFound", { id: UserId }, HttpApiSchema.annotations({ status: 404 }) ) {} ``` -------------------------------- ### Delete Specific TODO by ID API Endpoint Source: https://github.com/effect-ts/examples/blob/main/templates/monorepo/packages/server/README.md Remove a TODO item from the list using its unique identifier. Replace '0' with the desired TODO ID. ```sh curl -X DELETE http://localhost:3000/todos/0 ``` -------------------------------- ### Internal Constant for Template Values Source: https://github.com/effect-ts/examples/blob/main/scripts/templates.template.txt Exports an internal constant array of template values. The 'as const' assertion provides type safety for the values. ```typescript /** @internal */ export const templates = TEMPLATE_VALUES as const ``` -------------------------------- ### Internal Type Definition for Template Source: https://github.com/effect-ts/examples/blob/main/scripts/templates.template.txt Defines an internal type for templates. This is typically not meant for direct external use. ```typescript /** @internal */ export type Template = TEMPLATE_TYPE ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.