@email-kit/core 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +108 -11
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,16 +1,62 @@
1
- # @email-kit/core
1
+ # email-kit
2
2
 
3
- What templates are written with in [email-kit](https://github.com/email-kit/email-kit):
4
- `defineEmail`, the JSX runtime, `If`/`Each`/`Unless`, field markers (`url`, `secret`,
5
- `formatted`), `defineConfig` and `defineCheck`.
3
+ Type-safe email templates for TypeScript backends. Write the emails your app sends in TSX with
4
+ themed, email-safe components. `email-kit compile` turns them into a small typed module your server
5
+ imports, and `email-kit check` checks every one for email clients, dark mode, accessibility and
6
+ copy.
6
7
 
7
- > **1.0.** Stable for transactional email. Not yet: marketing email
8
- > (unsubscribe links, multi-column layouts), testing in real email clients (classic Outlook
9
- > especially), and the preview studio. See [what 1.0
10
- > covers](https://github.com/email-kit/email-kit#status).
8
+ **[Documentation](https://email-kit.dev)** · [Getting started](https://email-kit.dev/guide/getting-started/) · [GitHub](https://github.com/email-kit/email-kit)
9
+
10
+ ## Get started
11
+
12
+ In the project that sends email (in a monorepo, the app's folder), run:
13
+
14
+ ```sh
15
+ npm create email-kit
16
+ ```
17
+
18
+ It detects your package manager, TypeScript setup and framework, installs the packages below, adds
19
+ a config and a welcome template, and compiles once. It asks before changing any file you already
20
+ have; `npm create email-kit -- --yes` accepts every default, as in CI. `npx @email-kit/cli init`
21
+ does the same.
22
+
23
+ Then render the welcome email from your server, with the import `init` prints for your project:
24
+
25
+ ```ts
26
+ import { emails } from "./email-kit"
27
+
28
+ const { subject, html, text } = emails.welcome.render({
29
+ name: "Ada",
30
+ plan: "pro",
31
+ startUrl: "https://example.com/start",
32
+ })
33
+ ```
34
+
35
+ email-kit doesn't send email: hand `subject`, `html` and `text` to any provider's API.
36
+
37
+ While you work:
38
+
39
+ ```sh
40
+ npx email-kit compile # after changing a template or message; --watch keeps it running
41
+ npx email-kit check # the checks; exits 1 on errors, for CI
42
+ npx email-kit new <id> # another template, with messages in every locale
43
+ ```
44
+
45
+ The [getting started guide](https://email-kit.dev/guide/getting-started/) goes through it step by
46
+ step, and [your first email](https://email-kit.dev/guide/first-email/) builds one from scratch.
47
+
48
+ ### With an AI coding agent
49
+
50
+ `init` also asks which AI coding agents you use (Claude Code, Codex, Cursor, GitHub Copilot, Gemini
51
+ CLI, Antigravity, Windsurf and others) and writes a skill that teaches them email-kit, for the
52
+ version you have. Run `npx email-kit agents` to add one later or update it after an upgrade. See
53
+ [AI coding agents](https://email-kit.dev/guide/ai-agents/).
54
+
55
+ ## A template
56
+
57
+ Each template is a folder with `template.tsx` and a `messages.<locale>.json` per language:
11
58
 
12
59
  ```tsx
13
- /** @jsxImportSource @email-kit/core */
14
60
  import { Button, Heading, Text } from "@email-kit/components"
15
61
  import { defineEmail, url } from "@email-kit/core"
16
62
  import { z } from "zod"
@@ -31,5 +77,56 @@ export default defineEmail({
31
77
  })
32
78
  ```
33
79
 
34
- Templates run at compile time only: your server imports the module `email-kit compile` writes, which
35
- needs only [`@email-kit/runtime`](../runtime/README.md) when it runs. MIT licensed.
80
+ Templates run when you compile, not when you send: your server imports the generated module, which
81
+ needs only `@email-kit/runtime`.
82
+
83
+ ## The packages
84
+
85
+ They work together and are released together: install the same version of each.
86
+ `npm create email-kit` installs them for you.
87
+
88
+ | Package | What it is | Install as |
89
+ |---|---|---|
90
+ | [`create-email-kit`](https://www.npmjs.com/package/create-email-kit) | `npm create email-kit`: runs `email-kit init` in the folder you're in | not installed |
91
+ | [`@email-kit/cli`](https://www.npmjs.com/package/@email-kit/cli) | The `email-kit` command: `init`, `new`, `compile`, `check`, `tokens` and `agents` | devDependency |
92
+ | [`@email-kit/core`](https://www.npmjs.com/package/@email-kit/core) | What templates are written with: `defineEmail`, the JSX runtime, `If`/`Each`/`Unless`, field markers (`url`, `secret`, `formatted`), `defineConfig` and `defineCheck` | devDependency |
93
+ | [`@email-kit/components`](https://www.npmjs.com/package/@email-kit/components) | Email-safe components themed from your shadcn CSS or design tokens: `Text`, `Heading`, `Link`, `Button`, `Image`, `Divider`, `Spacer`, `Section`, `List`, `KeyValue`, `Callout`, `OtpCode`, `DataTable`, `LineItems` and `Footer` | devDependency |
94
+ | [`@email-kit/runtime`](https://www.npmjs.com/package/@email-kit/runtime) | Renders the compiled emails. The only one your app needs when it runs | **dependency** |
95
+
96
+ ### The runtime
97
+
98
+ `@email-kit/runtime` has no dependencies and uses only web-standard APIs, so it runs in Node 22+,
99
+ Bun, Deno, Cloudflare Workers, AWS Lambda and Next.js server code. You don't import it yourself:
100
+ the generated module does, and only the entry points your templates use, from about 1.4 KB to 3 KB
101
+ min+gzip:
102
+
103
+ | Entry point | Imported when |
104
+ |---|---|
105
+ | `@email-kit/runtime` | always |
106
+ | `@email-kit/runtime/validate` | `validate` is on (the default) |
107
+ | `@email-kit/runtime/plural` | a message has a plural or a select |
108
+ | `@email-kit/runtime/locale` | the project compiles more than one locale |
109
+ | `@email-kit/runtime/context` | the config has sender values passed at send time |
110
+
111
+ Rendering problems throw an `EmailRenderError` with a `code`; see the
112
+ [error reference](https://email-kit.dev/reference/errors/). A module compiled by another version of
113
+ the CLI fails with `incompatible-module` rather than rendering wrong.
114
+
115
+ ## Status
116
+
117
+ **1.0.** Stable for transactional email; breaking changes come only in a major release. Not yet:
118
+ marketing email (unsubscribe links, multi-column layouts), testing in real email clients (classic
119
+ Outlook especially), and the preview studio.
120
+
121
+ ## More
122
+
123
+ - [Guide](https://email-kit.dev/guide/): templates, components, messages and locales, theme and dark
124
+ mode, checks and CI, rendering and sending, and AI coding agents.
125
+ - Reference: [CLI](https://email-kit.dev/reference/cli/),
126
+ [configuration](https://email-kit.dev/reference/configuration/),
127
+ [checks](https://email-kit.dev/reference/checks/), [errors](https://email-kit.dev/reference/errors/).
128
+ - [Issues](https://github.com/email-kit/email-kit/issues) and
129
+ [changelog](https://github.com/email-kit/email-kit/blob/main/packages/cli/CHANGELOG.md).
130
+
131
+ The CLI requires Node.js 22.12 or later. MIT licensed; the CLI's third-party notices are in its
132
+ `THIRD_PARTY_NOTICES.md`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@email-kit/core",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "email-kit core: defineEmail, the JSX runtime and types for type-safe email templates.",
5
5
  "keywords": [
6
6
  "email",
@@ -9,7 +9,7 @@
9
9
  "typescript",
10
10
  "compiler"
11
11
  ],
12
- "homepage": "https://github.com/email-kit/email-kit#readme",
12
+ "homepage": "https://email-kit.dev",
13
13
  "bugs": "https://github.com/email-kit/email-kit/issues",
14
14
  "repository": {
15
15
  "type": "git",