Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,13 @@ pre,
[data-tone="bench"] { --tone: #f5e4d8; }
[data-tone="integrations"] { --tone: #f2e9da; }
[data-tone="hanko"] { --tone: #f6e6dc; }
[data-tone="learn"] { --tone: #ede2cf; }
/* dark: the clips play in the darkest room, the numbers glow a little red */
.dark[data-tone="contract"] { --tone: #1e1815; }
.dark[data-tone="playground"] { --tone: #161210; }
.dark[data-tone="clips"] { --tone: #100c0b; }
.dark[data-tone="bench"] { --tone: #24150f; }
.dark[data-tone="integrations"] { --tone: #1b1715; }
.dark[data-tone="hanko"] { --tone: #21130f; }
.dark[data-tone="learn"] { --tone: #14100e; }

/* Lenis scrolls the page itself; the browser's own smoothing would fight it */
html.lenis {
Expand Down Expand Up @@ -169,3 +167,7 @@ html.lenis {
}
}


/* A grid item may shrink below its content (a code window, a long package name), so no page
scrolls sideways on a phone; what is too wide scrolls inside its own box. */
.grid > * { min-width: 0; }
4 changes: 2 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Hero } from "@/components/landing/hero";
import { Contract } from "@/components/landing/contract";
import { Playground } from "@/components/landing/playground";
import { Clips } from "@/components/landing/clips";
import { Bench, Integrations, Learn } from "@/components/landing/sections";
import { Bench, Integrations, Start } from "@/components/landing/sections";
import { Hanko } from "@/components/landing/hanko";
import { pageMeta } from "@/lib/site";
import { app } from "@/server/app";
Expand Down Expand Up @@ -53,7 +53,7 @@ export default function Home() {
<Bench />
<Integrations />
<Hanko />
<Learn />
<Start />
</main>
<Footer />
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/hanko/catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function Card({ h, still }: { h: Hanko; still: boolean | null }) {
className="group relative flex flex-col rounded-2xl border border-line bg-card/70 p-5 transition-colors hover:border-hot"
>
<div className="flex items-start justify-between gap-3">
<h3 className="min-w-0 break-words font-mono text-[15px] font-bold leading-snug">
<h3 className="min-w-0 break-all font-mono text-[15px] font-bold leading-snug">
{/* the whole card is the link; the copy button and the source sit above it */}
{internal ? (
<Link href={h.href} className="outline-none after:absolute after:inset-0 after:rounded-2xl focus-visible:after:ring-2 focus-visible:after:ring-hot">
Expand Down
4 changes: 2 additions & 2 deletions components/landing/chrome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export function Footer() {
</p>
</div>
{[
{ title: "Learn", links: [["Docs", "/docs"], ["Installation", "/docs/installation"], ["Routes", "/docs/routes"], ["Compared", "/docs/compare"], ["From Express", "/docs/migrate/express"], ["From Fastify", "/docs/migrate/fastify"], ["inkan learn", "/#learn"]] },
{ title: "Packages", links: [["@vxnsin/inkan", "https://www.npmjs.com/package/@vxnsin/inkan"], ["@inkanjs/vite", "/docs/integrations/vite"], ["@inkanjs/next", "/docs/integrations/next"], ["@inkanjs/query", "/docs/integrations/query"]] },
{ title: "Learn", links: [["Docs", "/docs"], ["Installation", "/docs/installation"], ["Routes", "/docs/routes"], ["Compared", "/docs/compare"], ["From Express", "/docs/migrate/express"], ["From Fastify", "/docs/migrate/fastify"], ["npm create inkan", "/docs/installation#start-a-project"]] },
{ title: "Packages", links: [["@vxnsin/inkan", "https://www.npmjs.com/package/@vxnsin/inkan"], ["@inkanjs/vite", "/docs/integrations/vite"], ["@inkanjs/next", "/docs/integrations/next"], ["@inkanjs/query", "/docs/integrations/query"], ["@inkanjs/uws", "/docs/integrations/uws"], ["@inkanjs/bun", "/docs/integrations/bun"], ["check-action", "https://github.com/inkanjs/check-action"]] },
{ title: "Project", links: [["Hanko", "/hanko"], ["Benchmarks", "/benchmarks"], ["Community", "/community"], ["Blog", "/blog"], ["GitHub", "https://github.com/inkanjs/inkan"], ["Integrations", "https://github.com/inkanjs/integrations"], ["Changelog", "https://github.com/inkanjs/inkan/blob/main/CHANGELOG.md"], ["This API's docs", "/api/docs"]] },
].map((col) => (
<div key={col.title}>
Expand Down
2 changes: 1 addition & 1 deletion components/landing/hanko.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function Hanko() {
const still = useReducedMotion();
const on = seen || still;
return (
<section id="hanko" data-tone="hanko" className="mx-auto w-full max-w-6xl px-5 py-24 sm:px-8">
<section id="hanko" data-tone="hanko" className="mx-auto w-full max-w-6xl overflow-x-clip px-5 py-24 sm:px-8">
<div ref={ref} className="grid items-center gap-12 lg:grid-cols-[0.9fr_1.1fr]">
<div>
<p className="font-mono text-sm text-hot">印 hanko</p>
Expand Down
8 changes: 5 additions & 3 deletions components/landing/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function Hero() {

return (
<section data-tone="hero" className="relative mx-auto grid w-full max-w-6xl items-center gap-12 px-5 pb-20 pt-16 sm:px-8 lg:grid-cols-[1.05fr_1fr] lg:pt-24">
<div>
<div className="min-w-0">
<div className="relative mb-8 h-24 w-24">
{/* the ink that spreads where the seal lands */}
<AnimatePresence>
Expand Down Expand Up @@ -165,15 +165,16 @@ export function Hero() {
transition={{ delay: 1.4, duration: 0.6, ease }}
className="mt-8 flex flex-wrap items-center gap-3"
>
<Copy text="npm i @vxnsin/inkan" />
<Copy text="npm create inkan@latest" />
<Link
href="/docs"
className="rounded-xl bg-seal px-5 py-3 font-mono text-sm font-bold text-[#fbf1e6] shadow-[0_8px_24px_rgba(196,56,31,.35)] transition hover:-translate-y-0.5 hover:shadow-[0_12px_30px_rgba(196,56,31,.45)]"
>
Read the docs
</Link>
<p className="basis-full font-mono text-xs text-muted">
or start from a working project: <span className="text-soft">npx @vxnsin/inkan examples</span>
a project with a store, auth and tests · into one you have:{" "}
<span className="text-soft">npm i @vxnsin/inkan</span>
</p>
</motion.div>
</div>
Expand All @@ -182,6 +183,7 @@ export function Hero() {
initial={still ? false : { opacity: 0, x: 40, rotate: 1.5 }}
animate={{ opacity: 1, x: 0, rotate: 0 }}
transition={{ delay: 0.55, duration: 0.9, ease }}
className="min-w-0"
>
<Session />
</motion.div>
Expand Down
91 changes: 39 additions & 52 deletions components/landing/sections.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";
// The rest of the landing page: how fast, where it fits, and how to learn it.
// The rest of the landing page: how fast and where it fits.
import { AnimatePresence, motion, useInView, useReducedMotion } from "motion/react";
import Link from "next/link";
import { useRef, useState } from "react";
import { Code, Window } from "@/components/code";
import { Code } from "@/components/code";
import { servers } from "@/data/bench";

/* ---------- how fast ---------- */
Expand All @@ -21,7 +21,7 @@ export function Bench() {
return (
<section id="bench" data-tone="bench" className="mx-auto w-full max-w-6xl px-5 py-24 sm:px-8">
<p className="font-mono text-sm text-hot">印 how fast</p>
<h2 className="mt-3 font-mono text-3xl font-extrabold sm:text-4xl">All of that, level with Fastify or a little ahead.</h2>
<h2 className="mt-3 font-mono text-3xl font-extrabold sm:text-4xl">All of that, and a little ahead of Fastify.</h2>
<p className="mt-4 max-w-2xl text-soft">
Requests per second, with plain <code className="font-mono text-ink">node:http</code> as 100. Every server runs at once
and the measurements take turns, so a slow moment of the machine hits everyone alike.
Expand Down Expand Up @@ -110,6 +110,16 @@ const add = useMutation(q.post("/teas"));`,
const server = await serve(app, { port: 3000 });
// HTTPS, a gentle close, SIGTERM: all there`,
},
{
key: "bun",
name: "@inkanjs/bun",
line: "On Bun.serve, WebSocket routes included, through app.upgrade.",
file: "server.ts",
code: `import { serve } from "@inkanjs/bun";

const server = await serve(app, { port: 3000 });
// bun run server.ts: HTTP and app.ws routes on Bun's own sockets`,
},
];

export function Integrations() {
Expand Down Expand Up @@ -159,57 +169,34 @@ export function Integrations() {
);
}

/* ---------- learn ---------- */

const QUEST = [
{ text: " 印 inkan learn · quest 3 of 12 · rules for a body", cls: "font-bold text-term-ink" },
{ text: "", cls: "" },
{ text: " A body schema is checked before your handler", cls: "text-[#8a7d72]" },
{ text: " runs. A body that breaks it never reaches you.", cls: "text-[#8a7d72]" },
{ text: "", cls: "" },
{ text: " Add POST /teas: name at least 1 character,", cls: "text-term-ink" },
{ text: " grams a whole number of at least 1.", cls: "text-term-ink" },
{ text: "", cls: "" },
{ text: " ✗ POST /teas with { grams: -5 } answered 201:", cls: "text-hot" },
{ text: " it got in. Give grams a .min(1)", cls: "text-term-ink" },
{ text: " ✓ quest 3 done! rules for a body", cls: "font-bold text-ok" },
];
/* ---------- start ---------- */

export function Learn() {
const ref = useRef<HTMLDivElement>(null);
const seen = useInView(ref, { once: true, margin: "-20% 0px" });
const still = useReducedMotion();
const on = seen || still;
export function Start() {
return (
<section id="learn" data-tone="learn" className="mx-auto w-full max-w-6xl px-5 py-24 sm:px-8">
<div ref={ref} className="grid items-center gap-10 lg:grid-cols-2">
<div>
<p className="font-mono text-sm text-hot">印 inkan learn</p>
<h2 className="mt-3 font-mono text-3xl font-extrabold sm:text-4xl">Twelve quests, in your terminal.</h2>
<p className="mt-4 text-soft">
A tutorial that watches your file as you save it. Each quest says what to build, checks it against a real app and
tells you what is missing. Offline, no account.
</p>
<code className="mt-6 inline-block rounded-xl border border-line bg-card px-4 py-3 font-mono text-sm">
<span className="text-hot">$</span> npx @vxnsin/inkan learn
</code>
</div>
<Window title="PowerShell — inkan learn">
<pre className="p-5 font-mono text-[12.5px] leading-[1.7] sm:text-[13.5px]">
{QUEST.map((l, i) => (
<motion.div
key={i}
className={l.cls}
initial={still ? false : { opacity: 0, x: -8 }}
animate={on ? { opacity: 1, x: 0 } : {}}
transition={{ delay: 0.2 + i * (i >= 8 ? 0.45 : 0.08), duration: 0.35 }}
>
{l.text}
{"​"}
</motion.div>
))}
</pre>
</Window>
<section id="start" className="mx-auto w-full max-w-6xl px-5 pb-28 pt-8 sm:px-8">
<div className="rounded-3xl border border-hot/40 bg-seal/8 px-6 py-12 text-center sm:px-12">
<p className="font-mono text-sm text-hot">印 start</p>
<h2 className="mt-3 font-mono text-3xl font-extrabold sm:text-4xl">One command to a checked API.</h2>
<p className="mx-auto mt-4 max-w-xl text-soft">
Pick a store, logins and a frontend. You get a project that passes <code className="font-mono text-ink">inkan check</code>{" "}
and its own tests, with CI, before you write a line.
</p>
<code className="mt-8 inline-block rounded-xl border border-line bg-card px-5 py-3 font-mono text-sm">
<span className="text-hot">$</span> npm create inkan@latest my-api
</code>
<p className="mt-6 font-mono text-sm">
<Link href="/docs/installation#start-a-project" className="text-hot underline underline-offset-4">
what it asks
</Link>
<span className="text-muted"> · </span>
<Link href="/docs/compare" className="text-hot underline underline-offset-4">
when to pick something else
</Link>
<span className="text-muted"> · </span>
<a href="https://github.com/inkanjs/inkan" className="text-hot underline underline-offset-4">
the code
</a>
</p>
</div>
</section>
);
Expand Down
3 changes: 1 addition & 2 deletions content/docs/cli.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "CLI"
description: "inkan check, diff, openapi, create, examples, seal and learn."
description: "inkan check, diff, openapi, create, examples and seal."
---

```sh
Expand All @@ -12,7 +12,6 @@ npx inkan seal src/app.ts [-o src/inkan.seal.js]
npx inkan create app [folder] [--store <s>] [--auth] [--frontend <f>] [--yes]
npx inkan create plugin <name> [folder]
npx inkan examples [name] [folder] [--list] [--force]
npx inkan learn [folder] [--port <n>] [--force]
```

The entry is the file that builds the app and exports it, as `export default app` or
Expand Down
1 change: 0 additions & 1 deletion content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ server to what its docs say.
| Contracts as compiled code | – | at runtime, with `new Function` | – | ✓ ahead of time, `inkan seal`, no eval |
| Hooks, plugins, decorators | middleware | ✓ | middleware | ✓ |
| Bun, Deno, serverless | – | – | ✓ | ✓ `app.fetch` |
| **A tutorial in the terminal** | – | – | – | ✓ `inkan learn` |
| Runtime dependencies | several | several | none | **none** |

That table is about features. Where each of the others is the better choice, and the
Expand Down
12 changes: 0 additions & 12 deletions content/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,6 @@ statuses the auth plugin promises that no single example can show.
The generated files may change in any release.
</Callout>

**New here? Start with the tutorial.** It runs in your terminal, offline:

```sh
npx @vxnsin/inkan learn
```

It sets up a small tea shop and gives you twelve quests, one idea each: a first
route, typed params, rules for a body, examples as tests, problems, groups,
security, hooks, the docs page, changes that break clients, the seal and plugins.
inkan checks your work every time you save, says what is still missing, and
gives a hint (then a clearer one) when you press `h`. It keeps your progress, so
`npx @vxnsin/inkan learn` again goes on where you stopped.


## Try the example
Expand Down
9 changes: 9 additions & 0 deletions data/hanko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,15 @@ export const hanko: Hanko[] = [
repo: INTEGRATIONS,
tags: ["uwebsockets", "performance", "server", "runtime"],
},
{
name: "@inkanjs/bun",
description: "An inkan app on Bun.serve, WebSocket routes on Bun's own sockets through app.upgrade.",
kind: "integration",
href: "/docs/integrations/bun",
npm: "@inkanjs/bun",
repo: INTEGRATIONS,
tags: ["bun", "websockets", "server", "runtime"],
},

/* ---------- recipes: no package, a page of the docs ---------- */
{
Expand Down
Loading