From ca1e49a4e2824c1242f714beca7be36e96f883d2 Mon Sep 17 00:00:00 2001 From: Nikhil Adiga Date: Mon, 23 Nov 2026 17:21:13 +0530 Subject: [PATCH 01/16] Search an existing Typesense server read-only, and drive the UI from one config --- src/cli.ts | 78 +++- src/config.ts | 23 +- src/index.ts | 153 +++++-- src/prompts.ts | 422 ++++++++++++++--- src/steps/collection.ts | 17 +- src/steps/compose.ts | 24 +- src/steps/dataset.ts | 4 +- src/steps/env.ts | 28 ++ src/steps/existingServer.ts | 297 ++++++++++++ src/steps/overlay.ts | 5 +- src/steps/provision.ts | 99 ++-- src/steps/scaffold.ts | 4 +- src/steps/searchConfig.ts | 115 +++++ src/steps/searchSetup.ts | 60 ++- src/steps/server.ts | 13 +- src/summary.ts | 24 +- src/templates.ts | 36 +- src/util/clipboard.ts | 42 ++ src/util/docker.ts | 27 +- src/util/port.ts | 32 ++ src/util/pullProgress.ts | 7 +- src/util/typesense.ts | 46 +- .../files/app/collections/[name]/page.tsx | 22 + templates/nextjs/files/app/icon.png | Bin 0 -> 34884 bytes templates/nextjs/files/app/page.tsx | 85 +--- templates/nextjs/files/app/search.module.css | 339 ++++++++++---- templates/nextjs/files/app/search.tsx | 285 ++++++++++++ templates/nextjs/files/lib/typesense.ts | 58 ++- .../nextjs/files/public/typesense-logo.svg | 144 ++++++ templates/nextjs/files/scripts/schema.ts | 42 -- templates/nextjs/files/scripts/seed.ts | 29 +- templates/nextjs/template.config.js | 11 + test/api-key.test.ts | 34 -- test/cli.test.ts | 178 -------- test/compose.test.ts | 117 ----- test/dataset-fetch.test.ts | 196 -------- test/dataset.test.ts | 89 ---- test/docker-pull.integration.test.ts | 101 ----- test/env-keys.test.ts | 54 --- test/env.test.ts | 212 --------- test/errors.test.ts | 48 -- test/health.test.ts | 89 ---- test/keys.test.ts | 48 -- test/provision.test.ts | 119 ----- test/pull-progress.test.ts | 149 ------ test/scaffold.test.ts | 428 ------------------ test/search.integration.test.ts | 242 ---------- test/seed.test.ts | 60 --- test/server-lifecycle.integration.test.ts | 167 ------- test/summary.test.ts | 101 ----- test/templates.test.ts | 267 ----------- 51 files changed, 2092 insertions(+), 3178 deletions(-) create mode 100644 src/steps/existingServer.ts create mode 100644 src/steps/searchConfig.ts create mode 100644 src/util/clipboard.ts create mode 100644 src/util/port.ts create mode 100644 templates/nextjs/files/app/collections/[name]/page.tsx create mode 100644 templates/nextjs/files/app/icon.png create mode 100644 templates/nextjs/files/app/search.tsx create mode 100644 templates/nextjs/files/public/typesense-logo.svg delete mode 100644 templates/nextjs/files/scripts/schema.ts delete mode 100644 test/api-key.test.ts delete mode 100644 test/cli.test.ts delete mode 100644 test/compose.test.ts delete mode 100644 test/dataset-fetch.test.ts delete mode 100644 test/dataset.test.ts delete mode 100644 test/docker-pull.integration.test.ts delete mode 100644 test/env-keys.test.ts delete mode 100644 test/env.test.ts delete mode 100644 test/errors.test.ts delete mode 100644 test/health.test.ts delete mode 100644 test/keys.test.ts delete mode 100644 test/provision.test.ts delete mode 100644 test/pull-progress.test.ts delete mode 100644 test/scaffold.test.ts delete mode 100644 test/search.integration.test.ts delete mode 100644 test/seed.test.ts delete mode 100644 test/server-lifecycle.integration.test.ts delete mode 100644 test/summary.test.ts delete mode 100644 test/templates.test.ts diff --git a/src/cli.ts b/src/cli.ts index 231d727..3c6b497 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -25,24 +25,49 @@ ${pc.bold('Usage')} npx create-typesense-app@latest [directory] [options] ${pc.bold('Options')} - -t, --template ${TEMPLATE_IDS.join(' | ')} (only one is bundled) - --dataset books (default) | empty — skips the sample data download - --port host port for the local Docker server (default ${DEFAULT_PORT}) - -y, --yes accept defaults: ${TEMPLATE_IDS[0]}, local Docker, books dataset - -h, --help show this - -v, --version print the version + -t, --template ${TEMPLATE_IDS.join(' | ')} + --port host port for the local Docker server (default ${DEFAULT_PORT}) + --server-url search an existing server instead, read-only + --collections collections or aliases to search there (default: all) + --api-key-stdin read its key from stdin (otherwise $TYPESENSE_API_KEY, or a prompt) + -y, --yes accept defaults: ${TEMPLATE_IDS[0]}, local Docker, books sample data + -h, --help show this + -v, --version print the version ${pc.bold('Examples')} npx create-typesense-app@latest npx create-typesense-app@latest my-search-app --yes - npx create-typesense-app@latest my-search-app --dataset empty + TYPESENSE_API_KEY=… npx create-typesense-app@latest my-search-app --yes \\ + --server-url https://xyz.a1.typesense.net --collections products `.trimStart() +export function validateServerUrl(value: string): string | undefined { + const raw = value.trim() + if (raw === '') return 'A server URL is required.' + let parsed: URL + try { + parsed = new URL(raw) + } catch { + return 'Enter a full URL, e.g. http://localhost:8108' + } + if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') { + return 'URL must start with http:// or https://' + } + // The generated app connects with host, port and protocol only, so a path such + // as https://example.com/typesense would work for the CLI but not the browser. + if (parsed.pathname !== '/' || parsed.search !== '' || parsed.hash !== '') { + return 'Use the server address without a path, e.g. https://xyz.a1.typesense.net' + } + return undefined +} + export interface CliArgs { projectName?: string templateId?: string - dataset?: 'books' | 'empty' port: number + serverUrl?: string + collections?: string[] + apiKeyStdin: boolean yes: boolean help: boolean version: boolean @@ -52,6 +77,14 @@ export interface CliArgs { * Pure so it can be tested without booting the prompt flow. Throws on bad input; * the caller turns that into usage output and a non-zero exit. */ +/** A comma-separated list of names, trimmed, with empty entries dropped. */ +export function splitNames(value: string): string[] { + return value + .split(',') + .map((name) => name.trim()) + .filter((name) => name !== '') +} + export function parseCliArgs(argv: string[]): CliArgs { const { values, positionals } = parseArgs({ args: argv, @@ -59,6 +92,9 @@ export function parseCliArgs(argv: string[]): CliArgs { template: { type: 'string', short: 't' }, dataset: { type: 'string' }, port: { type: 'string' }, + 'server-url': { type: 'string' }, + collections: { type: 'string' }, + 'api-key-stdin': { type: 'boolean', default: false }, yes: { type: 'boolean', short: 'y', default: false }, help: { type: 'boolean', short: 'h', default: false }, version: { type: 'boolean', short: 'v', default: false }, @@ -73,13 +109,29 @@ export function parseCliArgs(argv: string[]): CliArgs { } if (values.template !== undefined && !TEMPLATE_IDS.includes(values.template as never)) { + throw new Error(`Unknown template "${values.template}". Available: ${TEMPLATE_IDS.join(', ')}`) + } + + // Still parsed so old scripts passing `--dataset books` keep working; books is now the only option. + if (values.dataset === 'empty') { throw new Error( - `Unknown template "${values.template}". Available: ${TEMPLATE_IDS.join(', ')}`, + 'The empty dataset was removed: a local server always loads the books sample data.\n' + + 'To search your own data, drop --yes and choose "I already have one running".', ) } + if (values.dataset !== undefined && values.dataset !== 'books') { + throw new Error(`Unknown dataset "${values.dataset}". A local server always loads books.`) + } + + const serverUrl = values['server-url'] + if (serverUrl !== undefined) { + const error = validateServerUrl(serverUrl) + if (error) throw new Error(`--server-url: ${error}`) + } - if (values.dataset !== undefined && !['books', 'empty'].includes(values.dataset)) { - throw new Error(`Unknown dataset "${values.dataset}". Available: books, empty`) + const collections = values.collections === undefined ? undefined : splitNames(values.collections) + if (collections !== undefined && serverUrl === undefined) { + throw new Error('--collections needs --server-url: it names collections on an existing server.') } let port = DEFAULT_PORT @@ -93,8 +145,10 @@ export function parseCliArgs(argv: string[]): CliArgs { return { projectName: positionals[0], templateId: values.template, - dataset: values.dataset as 'books' | 'empty' | undefined, port, + serverUrl: serverUrl?.trim().replace(/\/+$/, ''), + collections, + apiKeyStdin: values['api-key-stdin'], yes: values.yes, help: values.help, version: values.version, diff --git a/src/config.ts b/src/config.ts index 3de9636..ecb885b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -3,15 +3,20 @@ import type { TemplateManifest } from './templates.js' /** * Where the Typesense server comes from. * - * `byo` covers both "I already have one running" and "Typesense Cloud". They are - * one code path on purpose: PLAN.md §2 rules out Cloud *provisioning*, so the - * only difference between the two is the prompt copy and the default URL. + * `byo` is an existing server: "I already have one running" or "Typesense Cloud". + * The CLI only reads from it, so `apiKey` is a key that can read + * schemas and search, never an admin key, and it is the key the browser gets. */ export type ServerConfig = | { kind: 'docker'; port: number } - | { kind: 'byo'; flavour: 'existing' | 'cloud'; url: string; adminKey: string } - -export type Dataset = 'books' | 'empty' + | { + kind: 'byo' + flavour: 'existing' | 'cloud' + url: string + apiKey: string + /** Collections or aliases to search. Empty means every one the key can see. */ + collections: string[] + } export interface ProjectConfig { /** Directory name, also used as the npm package name. */ @@ -20,5 +25,9 @@ export interface ProjectConfig { targetDir: string template: TemplateManifest server: ServerConfig - dataset: Dataset +} + +/** A project on a local server, which the CLI starts and seeds. */ +export type LocalProjectConfig = ProjectConfig & { + server: Extract } diff --git a/src/index.ts b/src/index.ts index 8575f67..deecd0b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,24 +3,39 @@ import path from 'node:path' import { intro, log, note, outro, spinner } from '@clack/prompts' import pc from 'picocolors' import { USAGE, isInteractive, parseCliArgs, type CliArgs } from './cli.js' -import { DEMO_QUERY_BY } from './constants.js' +import { ADMIN_KEY_VAR } from './constants.js' import type { ProjectConfig } from './config.js' import { readPackageVersion, templatesDir } from './paths.js' -import { resolveDefaults, runPrompts } from './prompts.js' +import { resolveDefaults, reviewSearchConfig, runPrompts, settleLocalServer } from './prompts.js' +import { readFileSync } from 'node:fs' +import { rmdir } from 'node:fs/promises' import { addPackageScripts, installDependencies, projectScripts } from './steps/deps.js' import { applyOverlay, removeSuperseded } from './steps/overlay.js' -import { provisionServer } from './steps/provision.js' +import { + type ExistingServerResult, + type InspectedCollection, + inspectExistingServer, + readOnlyNotice, + setUpExistingServer, +} from './steps/existingServer.js' +import { type ProvisionedServer, provisionServer } from './steps/provision.js' import { ensureScaffold } from './steps/scaffold.js' -import { setUpSearch } from './steps/searchSetup.js' +import { type SearchSetupResult, setUpSearch } from './steps/searchSetup.js' import { assertAdminKeyNeverPublic, nextStepsLines, summaryLines } from './summary.js' import { loadTemplates } from './templates.js' +import { CommandError, showCommand } from './util/clipboard.js' import { checkDocker } from './util/docker.js' -import { clearRunState, markRunStarted } from './util/state.js' +import { clearRunState, hasRunState, markRunStarted } from './util/state.js' function messageOf(error: unknown): string { return error instanceof Error ? error.message : String(error) } +async function logError(error: unknown): Promise { + log.error(messageOf(error)) + if (error instanceof CommandError) await showCommand(error.command) +} + async function main(): Promise { let cli: CliArgs try { @@ -59,15 +74,27 @@ async function main(): Promise { cwd: process.cwd(), projectName: cli.projectName, templateId: cli.templateId, - dataset: cli.dataset, port: cli.port, + serverUrl: cli.serverUrl, + collections: cli.collections, + // Never a flag value: that would land in shell history and CI logs. + apiKey: cli.apiKeyStdin + ? readFileSync(0, 'utf8').trim() + : process.env[ADMIN_KEY_VAR]?.trim() || undefined, } let config: ProjectConfig try { config = cli.yes ? resolveDefaults(options) : await runPrompts(options) + // Skipped on a resumed run: this project's own container may hold the port. + if (config.server.kind === 'docker' && !hasRunState(config.targetDir)) { + config = { + ...config, + server: await settleLocalServer(config.server.port, !cli.yes, config.template, options), + } + } } catch (error) { - log.error(messageOf(error)) + await logError(error) return 1 } @@ -76,6 +103,38 @@ async function main(): Promise { note(summaryLines(config).join('\n'), 'Plan') + // Before the scaffold, so a refused key or a missing collection writes nothing. + let inspected: InspectedCollection[] | undefined + if (config.server.kind === 'byo') { + log.info(readOnlyNotice(config.server.url)) + const check = spinner() + check.start(`Checking ${config.server.url}`) + try { + inspected = await inspectExistingServer(config.server) + } catch (error) { + check.error('Could not use the existing server') + await logError(error) + return 1 + } + const names = inspected.map((collection) => `"${collection.name}"`).join(', ') + check.stop( + `The key can read ${names}, and cannot write documents or create or change collections`, + ) + for (const collection of inspected) { + // The interactive picker already warned about these. + if (cli.yes && collection.documents === 0) { + log.warn(`"${collection.name}" has no documents, so its section will be empty.`) + } + if (!cli.yes) { + collection.search = await reviewSearchConfig( + collection.name, + collection.fields, + collection.search, + ) + } + } + } + // Scaffolding has to come first: create-next-app refuses to run in a directory // that already holds files, so writing anything before it is a hard error. const build = spinner() @@ -93,34 +152,76 @@ async function main(): Promise { ) build.message(`Wrote ${written.length} template files`) - const removed = await removeSuperseded(config.targetDir, config.template.remove) + // An existing server is never seeded, so its project gets no seed script. + const seedScript = config.template.seedCommand.split(' ').at(-1) ?? '' + const removed = await removeSuperseded(config.targetDir, [ + ...config.template.remove, + ...(config.server.kind === 'byo' ? [seedScript] : []), + ]) if (removed.length > 0) { build.message(`Removed ${removed.length} superseded scaffold files`) } + if (config.server.kind === 'byo') { + // Only succeeds when the seed script was alone in its directory. + await rmdir(path.join(config.targetDir, path.dirname(seedScript))).catch(() => undefined) + } await installDependencies(config.targetDir, config.template.deps, config.template.devDeps, { onStep: (step) => build.message(step), }) - await addPackageScripts(config.targetDir, projectScripts(config.template)) - build.message('Added the seed and typesense scripts') + if (config.server.kind === 'docker') { + await addPackageScripts(config.targetDir, projectScripts(config.template)) + build.message('Added the seed and typesense scripts') + } } catch (error) { build.error('Could not set up the project') - log.error(messageOf(error)) + await logError(error) return 1 } build.stop(`Scaffolded ${config.template.name}`) + if (config.server.kind === 'byo') { + const server = config.server + if (inspected === undefined) throw new Error('The existing server was not inspected.') + const connect = spinner() + connect.start(`Reading ${server.url}`) + let existing: ExistingServerResult[] + try { + existing = await setUpExistingServer({ ...config, server }, inspected, { + onStep: (step) => connect.message(step), + }) + } catch (error) { + connect.error('Could not use the existing server') + await logError(error) + return 1 + } + connect.stop( + `Wired ${existing.length} collection${existing.length === 1 ? '' : 's'} to the search UI`, + ) + for (const { collection, found } of existing) { + if (found > 0) log.success(`The search key finds ${found} documents in "${collection}".`) + } + log.info(readOnlyNotice(server.url)) + await clearRunState(config.targetDir) + note(nextStepsLines(config).join('\n'), 'Next') + outro(`Done in ${config.projectName}.`) + return 0 + } + const progress = spinner() progress.start('Starting Typesense') - let provisioned + let provisioned: ProvisionedServer try { - provisioned = await provisionServer(config, { - onStep: (step) => progress.message(step), - }) + provisioned = await provisionServer( + { ...config, server: config.server }, + { + onStep: (step) => progress.message(step), + }, + ) } catch (error) { progress.error('Could not start Typesense') - log.error(messageOf(error)) + await logError(error) return 1 } progress.stop(`Typesense is healthy at ${provisioned.baseUrl}`) @@ -131,28 +232,22 @@ async function main(): Promise { const setup = spinner() setup.start('Setting up search') - let search + let search: SearchSetupResult try { search = await setUpSearch(config, provisioned, { onStep: (step) => setup.message(step), }) } catch (error) { setup.error('Could not set up the collection') - log.error(messageOf(error)) + await logError(error) return 1 } - setup.stop( - search.documentsImported > 0 - ? `Indexed ${search.documentsImported} documents into "${search.collection}"` - : `Created empty collection "${search.collection}"`, - ) + setup.stop(`Indexed ${search.documentsImported} documents into "${search.collection}"`) - if (search.verification.found > 0) { - log.success( - `Typo tolerance works: ${pc.bold(`"${search.verification.query}"`)} → ` + - `${pc.bold(search.verification.topHit)} (${search.verification.found} hits)`, - ) - } + log.success( + `Typo tolerance works: ${pc.bold(`"${search.verification.query}"`)} → ` + + `${pc.bold(search.verification.topHit)} (${search.verification.found} hits)`, + ) // The run completed, so the resume marker goes away: a finished project should // be refused next time, not silently scaffolded over. diff --git a/src/prompts.ts b/src/prompts.ts index 2cabf87..ed68ca1 100644 --- a/src/prompts.ts +++ b/src/prompts.ts @@ -1,18 +1,41 @@ import { existsSync, readdirSync, statSync } from 'node:fs' import path from 'node:path' -import { cancel, isCancel, log, password, select, text } from '@clack/prompts' +import { + cancel, + confirm, + isCancel, + log, + multiselect, + note, + password, + select, + text, +} from '@clack/prompts' import pc from 'picocolors' import { - DATASET_APPROX_COUNT, + ADMIN_KEY_VAR, DEFAULT_PORT, + SEARCH_KEY_VAR, DEFAULT_PROJECT_NAME, STATE_FILE, } from './constants.js' +import { splitNames, validateServerUrl } from './cli.js' import { COMPOSE_FILE } from './steps/compose.js' +import { + keyNeeds, + listRefusedMessage, + listSearchable, + searchKeyCommand, +} from './steps/existingServer.js' +import { showCommand } from './util/clipboard.js' +import type { SearchConfig, SearchField } from './steps/searchConfig.js' +import { waitForHealth } from './steps/server.js' import { hasRunState } from './util/state.js' -import type { Dataset, ProjectConfig, ServerConfig } from './config.js' +import type { ProjectConfig, ServerConfig } from './config.js' import { resolveTemplateWithoutPrompting, type TemplateManifest } from './templates.js' import type { DockerStatus } from './util/docker.js' +import { isPortInUse, nextFreePort } from './util/port.js' +import { createTypesenseClient, type StoredAlias, type StoredCollection } from './util/typesense.js' export interface PromptOptions { templates: TemplateManifest[] @@ -22,9 +45,13 @@ export interface PromptOptions { projectName?: string /** Pre-filled from `--template`, skips the framework prompt. */ templateId?: string - /** Pre-filled from `--dataset`, skips the sample-data prompt. */ - dataset?: Dataset port: number + /** From `--server-url`: an existing server, so no Docker. */ + serverUrl?: string + /** From `--collections`. */ + collections?: string[] + /** From `--api-key-stdin` or the environment; never from a flag value. */ + apiKey?: string } /** Clack returns a symbol when the user hits Ctrl-C. Exit the way a shell expects. */ @@ -80,21 +107,6 @@ export function validateTargetDir(dir: string): string | undefined { return undefined } -function validateServerUrl(value: string): string | undefined { - const raw = value.trim() - if (raw === '') return 'A server URL is required.' - let parsed: URL - try { - parsed = new URL(raw) - } catch { - return 'Enter a full URL, e.g. http://localhost:8108' - } - if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') { - return 'URL must start with http:// or https://' - } - return undefined -} - async function askProjectName(options: PromptOptions): Promise { if (options.projectName !== undefined) { const nameError = validateProjectName(options.projectName) @@ -151,15 +163,19 @@ async function askServer(options: PromptOptions): Promise { label: 'Spin one up locally with Docker', hint: dockerHint, }, - { value: 'existing', label: 'I already have one running', hint: 'bring your own URL' }, - { value: 'cloud', label: 'Typesense Cloud', hint: 'paste your cluster URL and admin key' }, + { + value: 'existing', + label: 'I already have one running', + hint: 'read-only, bring your own URL', + }, + { value: 'cloud', label: 'Typesense Cloud', hint: 'read-only, paste your cluster URL' }, ], }), ) if (kind === 'docker') { if (!options.docker.available) { - // Don't hard-fail; the two BYO paths are still open (PLAN.md §7). + // Don't hard-fail; the existing server paths are still open (PLAN.md §7). log.warn( `Docker is unavailable: ${options.docker.reason}\n` + 'Pick "I already have one running" or "Typesense Cloud" instead.', @@ -169,51 +185,300 @@ async function askServer(options: PromptOptions): Promise { return { kind: 'docker', port: options.port } } + return askExistingServer(kind, options) +} + +/** + * The URL, key and collection of a server the developer already runs. + * + * `hint` is printed above the key prompt, for the case where the CLI found the + * server itself and can say where its key most likely is. + */ +async function askExistingServer( + kind: 'existing' | 'cloud', + options: Pick, + defaultUrl = `http://localhost:${DEFAULT_PORT}`, + hint?: string, +): Promise { + const fallback = kind === 'cloud' ? '' : defaultUrl const url = unwrap( await text({ message: kind === 'cloud' ? 'Cluster URL' : 'Server URL', - placeholder: - kind === 'cloud' - ? 'https://xxx.a1.typesense.net' - : `http://localhost:${DEFAULT_PORT}`, - defaultValue: kind === 'cloud' ? '' : `http://localhost:${DEFAULT_PORT}`, - validate: (value) => - validateServerUrl(value || (kind === 'cloud' ? '' : `http://localhost:${DEFAULT_PORT}`)), + placeholder: kind === 'cloud' ? 'https://xxx.a1.typesense.net' : defaultUrl, + defaultValue: fallback, + validate: (value) => validateServerUrl(value || fallback), }), ) + const serverUrl = (url || fallback).trim().replace(/\/+$/, '') + + let apiKey = options.apiKey + if (apiKey === undefined) { + if (hint) log.info(hint) + else { + log.info(keyNeeds()) + await showCommand(searchKeyCommand(serverUrl, ['*'])) + } + apiKey = await askSearchKey() + } + + const collections = options.collections ?? (await askCollections(serverUrl, apiKey)) + return { kind: 'byo', flavour: kind, url: serverUrl, apiKey, collections } +} - const adminKey = unwrap( +/** The key prompt's check. The key is the one the browser gets. */ +export function validateSearchKey(value: string | undefined): string | undefined { + return (value ?? '').trim() === '' + ? 'Required. An admin key is refused, because the browser gets this key.' + : undefined +} + +async function askSearchKey(): Promise { + return unwrap( await password({ - message: 'Admin API key', - validate: (value) => - (value ?? '').trim() === '' - ? 'Required — it creates the collection and the search-only key. It is never exposed to the browser.' - : undefined, + message: 'Search key (documents:search, collections:get, collections:list)', + validate: validateSearchKey, }), + ).trim() +} + +/** The picker's options: each collection and alias, with its document count. */ +export function collectionChoices( + collections: Pick[], + aliases: StoredAlias[], +): { value: string; label: string; hint: string }[] { + const count = new Map( + collections.map((collection) => [collection.name, collection.num_documents]), + ) + const documents = (name: string) => `${(count.get(name) ?? 0).toLocaleString()} documents` + return [ + ...collections.map((collection) => ({ + value: collection.name, + label: collection.name, + hint: documents(collection.name), + })), + ...aliases.map((alias) => ({ + value: alias.name, + label: alias.name, + hint: `alias → ${alias.collection_name}, ${documents(alias.collection_name)}`, + })), + ] +} + +/** The chosen names whose collection holds no documents. An alias counts its target. */ +export function emptySelections( + chosen: string[], + collections: Pick[], + aliases: StoredAlias[], +): string[] { + const count = new Map( + collections.map((collection) => [collection.name, collection.num_documents]), ) + const target = new Map(aliases.map((alias) => [alias.name, alias.collection_name])) + return chosen.filter((name) => (count.get(target.get(name) ?? name) ?? 0) === 0) +} - return { - kind: 'byo', - flavour: kind, - url: (url || `http://localhost:${DEFAULT_PORT}`).trim().replace(/\/+$/, ''), - adminKey: adminKey.trim(), +/** + * Lists the collections and aliases the key can see, with document counts; falls + * back to typing names if it cannot list them. + */ +async function askCollections(url: string, apiKey: string): Promise { + const { collections, aliases, listRefused } = await listSearchable( + createTypesenseClient(url, apiKey), + ) + if (!listRefused && collections.length === 0 && aliases.length === 0) { + throw new Error(`${url} has no collections that the key can see.`) + } + if (listRefused) { + log.warn(listRefusedMessage()) + await showCommand(searchKeyCommand(url, ['*'])) + const typed = unwrap( + await text({ + message: 'Collections to search (comma-separated)', + validate: (value) => + splitNames(value ?? '').length === 0 ? 'Name at least one collection.' : undefined, + }), + ) + return splitNames(typed) } + + const chosen = unwrap( + await multiselect({ + message: 'Collections to search?', + options: collectionChoices(collections, aliases), + required: true, + }), + ) + for (const name of emptySelections(chosen, collections, aliases)) { + log.warn(`"${name}" has no documents, so its section will be empty.`) + } + return chosen } -async function askDataset(): Promise { - return unwrap( - await select({ - message: 'Sample data?', - options: [ - { - value: 'books', - label: 'Books', - hint: `${DATASET_APPROX_COUNT} real titles, downloaded — best for seeing typo tolerance`, - }, - { value: 'empty', label: 'Empty', hint: "I'll bring my own JSON" }, - ], +/** + * Shows the inferred search config and, if the developer wants, lets them change + * each part. Only offers what Typesense can do: searched and facet fields must be + * indexed text, and the title must be a searched field so it can be highlighted. + */ +export async function reviewSearchConfig( + name: string, + fields: SearchField[], + search: SearchConfig, +): Promise { + note( + [ + `Searches ${search.queryBy.join(', ')}`, + `Facets ${search.facets.join(', ') || 'none'}`, + `Title ${search.title}`, + `Image ${search.image ?? 'none'}`, + ].join('\n'), + `Search config for "${name}"`, + ) + if (unwrap(await confirm({ message: 'Use this search config?' }))) return search + + const choices = searchConfigChoices(fields) + const option = (name: string) => ({ value: name, label: name }) + + const queryBy = unwrap( + await multiselect({ + message: 'Fields to search', + options: choices.searchable.map(option), + initialValues: search.queryBy, + required: true, }), ) + const facets = + choices.facetable.length === 0 + ? [] + : unwrap( + await multiselect({ + message: 'Facets', + options: choices.facetable.map(option), + initialValues: search.facets, + required: false, + }), + ) + const title = unwrap( + await select({ + message: 'Hit title', + options: queryBy.map(option), + initialValue: queryBy.includes(search.title) ? search.title : queryBy[0], + }), + ) + const imageChoice = unwrap( + await select({ + message: 'Image field', + options: [{ value: '', label: 'none' }, ...choices.images.map(option)], + initialValue: search.image ?? '', + }), + ) + + return buildSearchConfig(fields, { + queryBy, + facets, + title, + image: imageChoice === '' ? null : imageChoice, + }) +} + +/** + * The fields the review may offer for each part. Only what Typesense can do: + * searched and facet fields must be indexed text, and the image must be a string. + */ +export function searchConfigChoices(fields: SearchField[]): { + searchable: string[] + facetable: string[] + images: string[] +} { + const named = fields.filter((field) => field.name !== '.*') + const text = named.filter( + (field) => (field.type === 'string' || field.type === 'string[]') && field.index !== false, + ) + return { + searchable: text.map((field) => field.name), + facetable: text.filter((field) => field.facet === true).map((field) => field.name), + images: named.filter((field) => field.type === 'string').map((field) => field.name), + } +} + +/** The search config from the review's answers. Every other field is shown in the hit. */ +export function buildSearchConfig( + fields: SearchField[], + answers: Omit, +): SearchConfig { + return { + ...answers, + display: fields + .map((field) => field.name) + .filter((name) => name !== '.*' && name !== answers.title && name !== answers.image), + } +} + +export type PortAction = 'keep' | 'next' | 'ask-reuse' | 'ask-next' + +/** What to do about the local server's port. Pure, so every branch is testable. */ +export function portAction(inUse: boolean, typesense: boolean, interactive: boolean): PortAction { + if (!inUse) return 'keep' + if (!interactive) return 'next' + return typesense ? 'ask-reuse' : 'ask-next' +} + +/** + * Settles the local server's port before anything is pulled or written. + * + * A Typesense already on the port can be reused, read-only, as an existing + * server; anything else means moving to the next free port. `--yes` moves + * without asking. The template only names the env file in the key hint. + */ +export async function settleLocalServer( + port: number, + interactive: boolean, + template: TemplateManifest, + options: Pick = {}, +): Promise { + const inUse = await isPortInUse(port) + const typesense = + inUse && + (await waitForHealth(`http://127.0.0.1:${port}`, { timeoutMs: 1_500 }).then( + () => true, + () => false, + )) + + const action = portAction(inUse, typesense, interactive) + if (action === 'keep') return { kind: 'docker', port } + + const next = await nextFreePort(port) + if (action === 'next') { + log.info(`Port ${port} is in use, so the local server will use port ${next}.`) + } else if (action === 'ask-reuse') { + const choice = unwrap( + await select({ + message: `Typesense already runs at localhost:${port}.`, + options: [ + { value: 'reuse', label: 'Use it', hint: 'read-only, asks for a search key' }, + { value: 'new', label: `Start a new local server on port ${next}` }, + ], + }), + ) + if (choice === 'reuse') { + return askExistingServer( + 'existing', + options, + `http://localhost:${port}`, + `If an earlier create-typesense-app run started it, its ${template.env.publicPrefix}${SEARCH_KEY_VAR} is in that project's ${template.env.file}.`, + ) + } + } else { + const move = unwrap( + await confirm({ + message: `Port ${port} is used by another program. Start Typesense on port ${next}?`, + }), + ) + if (!move) { + cancel(`Cancelled. Free port ${port}, or pass another one with --port.`) + process.exit(130) + } + } + return { kind: 'docker', port: next } } export async function runPrompts(options: PromptOptions): Promise { @@ -224,15 +489,48 @@ export async function runPrompts(options: PromptOptions): Promise const projectName = await askProjectName(options) const template = await askTemplate(options) - const server = await askServer(options) - const dataset = options.dataset ?? (await askDataset()) + let server: ServerConfig + if (options.serverUrl === undefined) { + server = await askServer(options) + } else { + const apiKey = await askKeyIfMissing(options) + const collections = options.collections ?? (await askCollections(options.serverUrl, apiKey)) + server = existingServerFromFlags({ ...options, collections }, apiKey) + } return { projectName, targetDir: path.resolve(options.cwd, projectName), template, server, - dataset, + } +} + +async function askKeyIfMissing(options: PromptOptions): Promise { + if (options.apiKey !== undefined) return options.apiKey + log.info(keyNeeds()) + await showCommand(searchKeyCommand(options.serverUrl ?? '', ['*'])) + return askSearchKey() +} + +/** A Typesense Cloud cluster is any host under typesense.net. */ +export function serverFlavour(url: string): 'cloud' | 'existing' { + return /\.typesense\.net$/.test(new URL(url).hostname) ? 'cloud' : 'existing' +} + +/** `--server-url` settles the server; the key comes from the environment, stdin or a prompt. */ +function existingServerFromFlags(options: PromptOptions, apiKey: string | undefined): ServerConfig { + if (apiKey === undefined || apiKey === '') { + throw new Error( + `--server-url needs a key: set ${ADMIN_KEY_VAR} to a search key, or pipe one in with --api-key-stdin.`, + ) + } + return { + kind: 'byo', + flavour: serverFlavour(options.serverUrl ?? ''), + url: options.serverUrl ?? '', + apiKey, + collections: options.collections ?? [], } } @@ -253,10 +551,19 @@ export function resolveDefaults(options: PromptOptions): ProjectConfig { throw new Error('No templates are bundled with this package.') } + if (options.serverUrl !== undefined) { + return { + projectName, + targetDir, + template, + server: existingServerFromFlags(options, options.apiKey), + } + } + if (!options.docker.available) { throw new Error( `--yes defaults to a local Docker server, but ${options.docker.reason}\n` + - 'Start Docker, or drop --yes and choose "I already have one running".', + 'Start Docker, or pass --server-url to search an existing server.', ) } @@ -265,6 +572,5 @@ export function resolveDefaults(options: PromptOptions): ProjectConfig { targetDir, template, server: { kind: 'docker', port: options.port }, - dataset: options.dataset ?? 'books', } } diff --git a/src/steps/collection.ts b/src/steps/collection.ts index b6a1697..d0e1348 100644 --- a/src/steps/collection.ts +++ b/src/steps/collection.ts @@ -1,4 +1,4 @@ -import { mkdir, copyFile, readFile } from 'node:fs/promises' +import { readFile } from 'node:fs/promises' import path from 'node:path' import { COLLECTION_NAME } from '../constants.js' import { dataDir } from '../paths.js' @@ -9,7 +9,7 @@ export const DATASET_FILE = 'books.jsonl' export interface CollectionSchema { name: string - fields: { name: string; type: string; facet?: boolean; optional?: boolean }[] + fields: { name: string; type: string; facet?: boolean; optional?: boolean; index?: boolean }[] default_sorting_field?: string } @@ -17,8 +17,8 @@ export interface CollectionSchema { * Reads the bundled schema, forcing the collection name to the CLI's constant so * the file and the code cannot drift apart. * - * The schema stays bundled even though the data is fetched: it is ours, it is - * tiny, and PLAN.md §6 wants it sitting in the project inviting edits. + * The schema stays bundled even though the data is fetched: it is ours, and it + * is tiny. It reaches the project inside the search config file. */ export async function loadBooksSchema(): Promise { const raw = await readFile(path.join(dataDir, SCHEMA_FILE), 'utf8') @@ -31,15 +31,6 @@ export async function loadBooksSchema(): Promise { return { ...parsed, name: COLLECTION_NAME } } -/** Puts the schema in the user's project — the file PLAN.md §6 wants them to edit first. */ -export async function copySchemaInto(targetDir: string): Promise { - const destinationDir = path.join(targetDir, 'data') - await mkdir(destinationDir, { recursive: true }) - const destination = path.join(destinationDir, SCHEMA_FILE) - await copyFile(path.join(dataDir, SCHEMA_FILE), destination) - return destination -} - export interface RecreateOutcome { /** True when a collection was already there and had to be dropped first. */ replaced: boolean diff --git a/src/steps/compose.ts b/src/steps/compose.ts index 81bd340..82d3487 100644 --- a/src/steps/compose.ts +++ b/src/steps/compose.ts @@ -1,9 +1,12 @@ +import { createHash } from 'node:crypto' import { mkdir, writeFile } from 'node:fs/promises' import path from 'node:path' import { ADMIN_KEY_VAR, TYPESENSE_IMAGE } from '../constants.js' export interface ComposeOptions { projectName: string + /** The project directory. Its absolute path makes the compose name unique. */ + targetDir: string port: number /** The template's env file, relative to the project dir. Supplies the API key. */ envFile: string @@ -11,6 +14,16 @@ export interface ComposeOptions { export const COMPOSE_FILE = 'docker-compose.yml' +/** + * Project name plus a short hash of the absolute path, so two projects with the + * same directory name in different parents get their own container and volume. + */ +export function composeProjectName(projectName: string, targetDir: string): string { + const hash = createHash('sha256').update(path.resolve(targetDir)).digest('hex').slice(0, 6) + // Compose names allow only lowercase letters, digits, dashes and underscores. + return `${projectName.toLowerCase().replace(/[^a-z0-9_-]/g, '-')}-${hash}` +} + /** * The compose file is generated rather than shelling out to `docker run`, so * teardown is obvious and the user can read exactly what was started. @@ -20,15 +33,22 @@ export const COMPOSE_FILE = 'docker-compose.yml' * file broke `docker compose down` for any template whose env file is named * something else. This way every bare compose command works. */ -export function composeFileContents({ projectName, port, envFile }: ComposeOptions): string { +export function composeFileContents({ + projectName, + targetDir, + port, + envFile, +}: ComposeOptions): string { + const name = composeProjectName(projectName, targetDir) return `# Generated by create-typesense-app. Safe to commit, and safe to edit. # # --enable-cors is the reason this file exists. Without it the browser cannot # talk to Typesense directly and every search fails at the CORS preflight. +name: ${name} services: typesense: image: ${TYPESENSE_IMAGE} - container_name: ${projectName}-typesense + container_name: ${name}-typesense restart: unless-stopped ports: - "${port}:8108" diff --git a/src/steps/dataset.ts b/src/steps/dataset.ts index 49ea66b..6018fec 100644 --- a/src/steps/dataset.ts +++ b/src/steps/dataset.ts @@ -102,7 +102,7 @@ export async function ensureDataset( throw new Error( `Could not download the sample dataset from ${url}\n` + ` ${error instanceof Error ? error.message : String(error)}\n` + - 'Re-run with --dataset empty to skip it, or download it manually into ' + + 'Check the network and re-run, or download it manually into ' + `data/${DATASET_FILE}.`, ) } @@ -110,7 +110,7 @@ export async function ensureDataset( if (!response.ok) { throw new Error( `Could not download the sample dataset: ${url} replied ${response.status}.\n` + - 'Re-run with --dataset empty to skip it.', + 'Check the network and re-run.', ) } diff --git a/src/steps/env.ts b/src/steps/env.ts index 749be54..42f8237 100644 --- a/src/steps/env.ts +++ b/src/steps/env.ts @@ -128,4 +128,32 @@ export async function writeEnvFile( await mkdir(path.dirname(filePath), { recursive: true }) const existing = await readFile(filePath, 'utf8').catch(() => '') await writeFile(filePath, upsertEnvContents(existing, values, publicPrefix), 'utf8') + await ensureGitIgnored(filePath) +} + +/** + * The env file holds the keys, so git must never pick it up. Vite's starters + * ignore only `*.local` and Angular's ignores no env file at all, while their + * frameworks read `.env`. An overlay cannot ship the fix: npm drops `.gitignore` + * files from published packages. + */ +export async function ensureGitIgnored(filePath: string): Promise { + const gitignore = path.join(path.dirname(filePath), '.gitignore') + const name = path.basename(filePath) + const contents = await readFile(gitignore, 'utf8').catch(() => '') + const covered = contents + .split('\n') + .map((line) => line.trim()) + .some( + (line) => + line === name || line === `/${name}` || (line === '.env*' && name.startsWith('.env')), + ) + if (covered) return + + const separator = contents === '' || contents.endsWith('\n') ? '' : '\n' + await writeFile( + gitignore, + `${contents}${separator}\n# Typesense keys, written by create-typesense-app. Never commit them.\n/${name}\n`, + 'utf8', + ) } diff --git a/src/steps/existingServer.ts b/src/steps/existingServer.ts new file mode 100644 index 0000000..c8a4d80 --- /dev/null +++ b/src/steps/existingServer.ts @@ -0,0 +1,297 @@ +import path from 'node:path' +import type { ProjectConfig, ServerConfig } from '../config.js' +import { CommandError } from '../util/clipboard.js' +import { + createTypesenseClient, + TypesenseError, + type StoredAlias, + type StoredCollection, + type TypesenseClient, +} from '../util/typesense.js' +import { connectionEnvValues, writeEnvFile } from './env.js' +import { + ensureSearchConfigFile, + fieldsFromDocuments, + inferSearchConfig, + mergeFields, + type SearchConfig, + type SearchField, +} from './searchConfig.js' +import { waitForHealth } from './server.js' + +type ExistingServer = Extract + +export function readOnlyNotice(url: string): string { + return `Read-only: this CLI reads schemas and documents from ${url} and does not create, change or delete anything on it.` +} + +/** + * One shell word in single quotes. A `'` inside closes the quotes, adds an + * escaped quote, and opens them again, so nothing in the value runs as shell. + */ +function shellQuote(value: string): string { + return `'${value.replaceAll("'", `'\\''`)}'` +} + +/** + * The command a developer runs, with their own admin key, to make a key this CLI + * accepts. It reads `$TYPESENSE_ADMIN_API_KEY`, so no key value is ever printed. + * + * Collection names can come from the server's own list, and Typesense accepts a + * `'` in a name, so every value is quoted for the shell. + */ +export function searchKeyCommand(url: string, collections: string[]): string { + const spec = { + description: 'create-typesense-app search key', + actions: ['documents:search', 'collections:get', 'collections:list', 'aliases:list'], + collections, + } + return [ + `curl -X POST ${shellQuote(`${url}/keys`)} \\`, + ` -H "X-TYPESENSE-API-KEY: $TYPESENSE_ADMIN_API_KEY" \\`, + ` -H 'Content-Type: application/json' \\`, + ` -d ${shellQuote(JSON.stringify(spec))}`, + ].join('\n') +} + +function refused(error: unknown): boolean { + return error instanceof TypesenseError && (error.status === 401 || error.status === 403) +} + +export interface Listing { + collections: StoredCollection[] + aliases: StoredAlias[] + /** True when the key may not run `collections:list`, so the list is not the whole server. */ + listRefused: boolean +} + +/** + * The collections and aliases the key can see. A refused list is reported, not + * hidden: a search-only key from the Typesense Cloud dashboard has only + * `documents:search`. Any other failure, such as a wrong URL, is thrown. + */ +export async function listSearchable(client: TypesenseClient): Promise { + let listRefused = false + const collections = await client.listCollections().catch((error: unknown) => { + if (!refused(error)) throw error + listRefused = true + return [] + }) + // `aliases:list` is optional: without it, the picker shows collections only. + const aliases = await client.listAliases().catch((error: unknown) => { + if (!refused(error)) throw error + return [] + }) + return { collections, aliases, listRefused } +} + +/** + * Shown before the key prompt. The dashboard's "search-only" key looks right but + * has only `documents:search`, so say up front what the key needs. + */ +export function keyNeeds(): string { + return ( + 'The browser gets this key, so it must only read and search. It needs these actions:\n' + + '`documents:search`, `collections:get`, `collections:list` and `aliases:list`. The\n' + + 'search-only key in the Typesense Cloud dashboard has only `documents:search`, so it\n' + + 'does not work here. To make the right key with your admin key, run:' + ) +} + +/** Why the CLI cannot show the collections; `searchKeyCommand` makes the key that fixes it. */ +export function listRefusedMessage(): string { + return ( + 'The key may not list collections: it lacks the `collections:list` action. The CLI also\n' + + 'needs `collections:get` to read each schema. A key made with this command has both:' + ) +} + +/** Listing keys needs `keys:*`, which a key for the browser must never have. */ +async function canManageKeys(client: TypesenseClient): Promise { + try { + await client.listKeys() + return true + } catch (error) { + if (error instanceof TypesenseError && (error.status === 401 || error.status === 403)) { + return false + } + throw error + } +} + +/** + * Requests that Typesense refuses with 401 when the key lacks the action, and + * that change nothing when the key has it: an id that no document has, an empty + * import, and bodies that Typesense rejects as invalid. Measured on Typesense 30. + */ +function writeProbes(collection: string): [string, string, string | undefined, string][] { + const name = encodeURIComponent(collection) + const id = `create-typesense-app-probe-${Math.random().toString(36).slice(2)}` + return [ + ['DELETE', `/collections/${name}/documents/${id}`, undefined, 'delete documents'], + ['POST', `/collections/${name}/documents/import`, '', 'import documents'], + ['POST', `/collections/${name}/documents`, 'probe', 'create documents'], + ['PATCH', `/collections/${name}/documents/${id}`, 'probe', 'update documents'], + ['PATCH', `/collections/${name}`, '{"fields":"probe"}', 'change the collection'], + ] +} + +/** + * What the key can write, so a key that can is refused before the browser gets + * it. Not covered: `collections:delete` on a named collection, because the only + * request that shows it deletes the collection. + */ +export async function writeAccess( + client: TypesenseClient, + collections: string[], +): Promise { + const probes: [string, string, string | undefined, string][] = [ + ['POST', '/collections', 'probe', 'create collections'], + ...collections.flatMap(writeProbes), + ] + const allowed = await Promise.all( + probes.map(async ([method, path, body, action]) => { + const status = await client.status(method, path, body) + return status === 401 || status === 403 ? undefined : action + }), + ) + return [...new Set(allowed.filter((action) => action !== undefined))] +} + +export interface ExistingServerResult { + collection: string + /** Documents the empty query finds, with the key the browser will hold. */ + found: number +} + +export interface InspectedCollection { + /** The collection or alias name the UI searches. */ + name: string + documents: number + schema: StoredCollection + /** The schema's fields plus those read off sample documents. */ + fields: SearchField[] + search: SearchConfig +} + +/** + * Everything that can refuse the run, before the scaffold writes a file. + * + * The CLI never changes an existing server: every request is a GET, except the + * write probes, which change nothing. The key the developer gave is the one the + * browser gets, so a key that can manage keys or write is refused. No + * collections selected means every collection and alias the key can see. + */ +export async function inspectExistingServer( + server: ExistingServer, +): Promise { + await waitForHealth(server.url, { timeoutMs: 10_000 }) + const client = createTypesenseClient(server.url, server.apiKey) + + const listing = await listSearchable(client) + const { aliases } = listing + const names = + server.collections.length > 0 + ? server.collections + : [ + ...listing.collections.map((collection) => collection.name), + ...aliases.map((alias) => alias.name), + ] + // A key for an alias must also cover the collection it points to. + const target = new Map(aliases.map((alias) => [alias.name, alias.collection_name])) + const scope = [...new Set(names.flatMap((name) => [name, target.get(name) ?? name]))] + + if (await canManageKeys(client)) { + throw new CommandError( + 'That key can manage API keys, so it is an admin key or close to one, and the browser ' + + 'would hold it. Create a search key and re-run with it:', + searchKeyCommand(server.url, scope.length > 0 ? scope : ['*']), + ) + } + if (names.length === 0) { + if (listing.listRefused) { + throw new CommandError( + `Name the collections with --collections, or make a key that can list them.\n${listRefusedMessage()}`, + searchKeyCommand(server.url, ['*']), + ) + } + throw new Error(`${server.url} has no collections that the key can see.`) + } + + const writes = await writeAccess(client, scope) + if (writes.length > 0) { + throw new CommandError( + `That key can ${writes.join(', ')}, and the browser would hold it. ` + + 'Create a search key and re-run with it:', + searchKeyCommand(server.url, scope), + ) + } + + return Promise.all(names.map((name) => inspectCollection(client, server.url, name, scope))) +} + +async function inspectCollection( + client: TypesenseClient, + url: string, + name: string, + scope: string[], +): Promise { + const schema = await client.getCollection(name).catch((error: unknown) => { + if (error instanceof TypesenseError && error.status === 404) { + throw new Error(`${url} has no collection or alias named "${name}".`, { cause: error }) + } + if (refused(error)) { + throw new CommandError( + `The key may not read the schema of "${name}": it lacks the \`collections:get\` action.\n` + + 'A key made with this command has every action the CLI needs:', + searchKeyCommand(url, scope), + { cause: error }, + ) + } + throw error + }) + // Inferred here, so a collection with nothing to search is refused before the scaffold. + const { hits } = await client.search(name, { q: '*', per_page: '10' }) + const fields = mergeFields(schema.fields, fieldsFromDocuments(hits.map((hit) => hit.document))) + return { + name, + documents: schema.num_documents, + schema, + fields, + search: inferSearchConfig({ name, fields }), + } +} + +/** Wires the generated project to the inspected collections. Still only GETs. */ +export async function setUpExistingServer( + config: ProjectConfig & { server: ExistingServer }, + inspected: InspectedCollection[], + { onStep = () => {} }: { onStep?: (message: string) => void } = {}, +): Promise { + const { server, template, targetDir } = config + + await ensureSearchConfigFile(targetDir, { + collections: inspected.map(({ name, schema, search }) => ({ + name, + schema: { name, fields: schema.fields, default_sorting_field: schema.default_sorting_field }, + search, + })), + }) + onStep('Wrote typesense.config.json') + + // The collection variable names the first one; the UI reads them all from the config. + await writeEnvFile( + path.join(targetDir, template.env.file), + connectionEnvValues(server.url, inspected[0]?.name ?? '', server.apiKey), + template.env.publicPrefix, + ) + onStep(`Wrote ${template.env.file}`) + + const client = createTypesenseClient(server.url, server.apiKey) + return Promise.all( + inspected.map(async ({ name, search }) => { + const { found } = await client.search(name, { q: '*', query_by: search.queryBy.join(',') }) + return { collection: name, found } + }), + ) +} diff --git a/src/steps/overlay.ts b/src/steps/overlay.ts index 966bc2f..c05baee 100644 --- a/src/steps/overlay.ts +++ b/src/steps/overlay.ts @@ -43,10 +43,7 @@ export async function applyOverlay(filesDir: string, targetDir: string): Promise * CLI is free to stop shipping a file between releases, and that should not fail * a scaffold. */ -export async function removeSuperseded( - targetDir: string, - paths: string[], -): Promise { +export async function removeSuperseded(targetDir: string, paths: string[]): Promise { const root = path.resolve(targetDir) const removed: string[] = [] diff --git a/src/steps/provision.ts b/src/steps/provision.ts index 1dd4cbf..02e7da2 100644 --- a/src/steps/provision.ts +++ b/src/steps/provision.ts @@ -1,6 +1,6 @@ import path from 'node:path' import { ADMIN_KEY_VAR } from '../constants.js' -import type { ProjectConfig, ServerConfig } from '../config.js' +import type { LocalProjectConfig, ServerConfig } from '../config.js' import { writeComposeFile } from './compose.js' import { readEnvFile, writeEnvFile } from './env.js' import { @@ -12,6 +12,7 @@ import { import { generateAdminKey } from '../util/apiKey.js' import { composePull, missingImages } from '../util/docker.js' import { createPullTracker } from '../util/pullProgress.js' +import { createTypesenseClient, TypesenseError } from '../util/typesense.js' export interface ProvisionOptions { /** Progress callback, so the CLI can render a step per stage. */ @@ -24,8 +25,7 @@ export interface ProvisionedServer { adminKey: string baseUrl: string envFile: string - /** Absent when the user brought their own server — we write no compose file then. */ - composeFile?: string + composeFile: string /** True when an admin key from a previous run was reused. */ reusedAdminKey: boolean } @@ -40,7 +40,29 @@ export function serverBaseUrl(server: ServerConfig): string { } /** - * Brings a Typesense server up and does not return until it is healthy. + * /health answers without a key, so it passes for any Typesense on the port. + * Only a request with this project's admin key proves it is the right server. + */ +async function assertAcceptsAdminKey( + baseUrl: string, + adminKey: string, + port: number, +): Promise { + try { + await createTypesenseClient(baseUrl, adminKey).listKeys() + } catch (error) { + if (!(error instanceof TypesenseError) || error.status !== 401) throw error + throw new Error( + `A Typesense server answers on port ${port}, but it is not the one this project ` + + `started: it rejected this project's admin key. Stop it, or re-run with --port ${port + 1}.`, + { cause: error }, + ) + } +} + +/** + * Brings the local Typesense server up and does not return until it is healthy. + * An existing server never comes here: the CLI only reads from it. * * Idempotent by design (PLAN.md §7): an admin key from an earlier run is reused, * the compose file is rewritten identically, and `compose up` on an already @@ -48,7 +70,7 @@ export function serverBaseUrl(server: ServerConfig): string { * template input is the env file's name and prefix. */ export async function provisionServer( - config: ProjectConfig, + config: LocalProjectConfig, { onStep = () => {}, health }: ProvisionOptions = {}, ): Promise { const { server, template, targetDir } = config @@ -64,54 +86,51 @@ export async function provisionServer( adminKey = previousAdminKey reusedAdminKey = true onStep('Reused the admin API key from the previous run') - } else if (server.kind === 'docker') { + } else { adminKey = generateAdminKey() onStep('Generated an admin API key') - } else { - adminKey = server.adminKey } await writeEnvFile(envFile, { [ADMIN_KEY_VAR]: adminKey }, template.env.publicPrefix) onStep(`Wrote ${template.env.file}`) - let composeFile: string | undefined - if (server.kind === 'docker') { - // The env file must exist before this: compose declares it with `env_file:` - // and refuses to start if it is missing. - composeFile = await writeComposeFile(targetDir, { - projectName: config.projectName, - port: server.port, - envFile: template.env.file, - }) - onStep('Wrote docker-compose.yml (CORS enabled)') + // The env file must exist before this: compose declares it with `env_file:` + // and refuses to start if it is missing. + const composeFile = await writeComposeFile(targetDir, { + projectName: config.projectName, + targetDir, + port: server.port, + envFile: template.env.file, + }) + onStep('Wrote docker-compose.yml (CORS enabled)') - // Pull as its own reported step. `compose up` would pull silently, leaving the - // spinner on a stale message for however long the download takes — which on a - // cold cache looks exactly like a hang. - const missing = await missingImages(targetDir) - if (missing.length > 0) { - const tracker = createPullTracker() - // "(first run)" explains why this particular run is the slow one. - const label = `${missing.join(', ')} (first run)` - onStep(tracker.describe(label)) - await composePull(targetDir, (line) => { - if (tracker.ingest(line)) onStep(tracker.describe(label)) - }) - } + // Pull as its own reported step. `compose up` would pull silently, leaving the + // spinner on a stale message for however long the download takes — which on a + // cold cache looks exactly like a hang. + const missing = await missingImages(targetDir) + if (missing.length > 0) { + const tracker = createPullTracker() + // "(first run)" explains why this particular run is the slow one. + const label = `${missing.join(', ')} (first run)` + onStep(tracker.describe(label)) + await composePull(targetDir, (line) => { + if (tracker.ingest(line)) onStep(tracker.describe(label)) + }) + } - try { - await composeUp(targetDir) - } catch (error) { - throw new Error( - describeStartFailure(error instanceof Error ? error.message : String(error), server.port), - { cause: error }, - ) - } - onStep(`Started Typesense on :${server.port}`) + try { + await composeUp(targetDir) + } catch (error) { + throw new Error( + describeStartFailure(error instanceof Error ? error.message : String(error), server.port), + { cause: error }, + ) } + onStep(`Started Typesense on :${server.port}`) onStep('Waiting for /health') await waitForHealth(baseUrl, health) + await assertAcceptsAdminKey(baseUrl, adminKey, server.port) onStep('Server is healthy') return { adminKey, baseUrl, envFile, composeFile, reusedAdminKey } diff --git a/src/steps/scaffold.ts b/src/steps/scaffold.ts index 3764af9..718a2b7 100644 --- a/src/steps/scaffold.ts +++ b/src/steps/scaffold.ts @@ -119,9 +119,7 @@ export async function ensureScaffold( } if (!existsSync(path.join(config.targetDir, 'package.json'))) { - throw new Error( - `Scaffolding reported success but left no package.json in ${config.targetDir}.`, - ) + throw new Error(`Scaffolding reported success but left no package.json in ${config.targetDir}.`) } return { scaffolded: true } diff --git a/src/steps/searchConfig.ts b/src/steps/searchConfig.ts new file mode 100644 index 0000000..1c8a32a --- /dev/null +++ b/src/steps/searchConfig.ts @@ -0,0 +1,115 @@ +import { readFile, writeFile } from 'node:fs/promises' +import path from 'node:path' +import type { CollectionSchema } from './collection.js' + +/** The one file a generated project's UI and seed script read. Every template's UI is driven by it. */ +export const SEARCH_CONFIG_FILE = 'typesense.config.json' + +/** What the UI searches, facets and shows in a hit, for one collection. */ +export interface SearchConfig { + queryBy: string[] + facets: string[] + title: string + /** `null` rather than absent, so a JSON import keeps the same type for every collection. */ + image: string | null + display: string[] +} + +export interface SearchConfigFile { + collections: { name: string; schema: CollectionSchema; search: SearchConfig }[] +} + +const TEXT_TYPES = new Set(['string', 'string[]']) +const IMAGE_NAME = /image|thumbnail|photo/i +const TITLE_NAME = /title|name/i + +export type SearchField = CollectionSchema['fields'][number] + +function typeOf(value: unknown): string | undefined { + if (typeof value === 'string') return 'string' + if (typeof value === 'boolean') return 'bool' + if (typeof value === 'number') return Number.isInteger(value) ? 'int64' : 'float' + if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === 'string')) { + return 'string[]' + } + return undefined +} + +/** Field types read off sample documents. Nested objects and mixed arrays are skipped. */ +export function fieldsFromDocuments(documents: Record[]): SearchField[] { + const fields = new Map() + for (const document of documents) { + for (const [name, value] of Object.entries(document)) { + const type = typeOf(value) + if (name !== 'id' && !fields.has(name) && type !== undefined) fields.set(name, { name, type }) + } + } + return [...fields.values()] +} + +/** + * The schema's fields, plus sampled ones it does not name; the schema wins. + * + * A sampled field is searchable only if a `.*` field indexes it. Otherwise it is + * merely stored, which is still enough to show it or use it as the image. + * Typesense refuses `facet` on `.*`, so no sampled field is a facet. + */ +export function mergeFields(schema: SearchField[], sampled: SearchField[]): SearchField[] { + const named = new Set(schema.map((field) => field.name)) + const indexed = schema.some((field) => field.name === '.*' && field.index !== false) + return [ + ...schema, + ...sampled + .filter((field) => !named.has(field.name)) + .map((field) => ({ ...field, facet: false, ...(indexed ? {} : { index: false }) })), + ] +} + +/** + * Derives the search config from a schema's fields; the caller may have merged + * sampled ones in first. + * + * Only text fields become facets: a numeric facet needs a range widget, and as a + * plain list `ratings_count` would offer thousands of one-document values. + */ +export function inferSearchConfig(schema: CollectionSchema): SearchConfig { + const fields = schema.fields.filter((field) => field.name !== '.*') + const image = fields.find((field) => field.type === 'string' && IMAGE_NAME.test(field.name)) + const text = fields.filter( + (field) => TEXT_TYPES.has(field.type) && field.index !== false && field !== image, + ) + + const title = text.find((field) => TITLE_NAME.test(field.name)) ?? text[0] + if (title === undefined) { + throw new Error(`Collection "${schema.name}" has no text field to search.`) + } + + return { + queryBy: text.map((field) => field.name), + facets: text.filter((field) => field.facet === true).map((field) => field.name), + title: title.name, + image: image?.name ?? null, + display: fields + .filter((field) => field !== title && field !== image) + .map((field) => field.name), + } +} + +/** + * Writes the file only if the project does not have one yet, then reads it back. + * + * Reading back is what makes the project's copy the source of truth: a developer's + * edits survive a re-run, and the CLI indexes exactly what the seed script would. + */ +export async function ensureSearchConfigFile( + targetDir: string, + initial: SearchConfigFile, +): Promise { + const file = path.join(targetDir, SEARCH_CONFIG_FILE) + await writeFile(file, `${JSON.stringify(initial, null, 2)}\n`, { flag: 'wx' }).catch( + (error: NodeJS.ErrnoException) => { + if (error.code !== 'EEXIST') throw error + }, + ) + return JSON.parse(await readFile(file, 'utf8')) as SearchConfigFile +} diff --git a/src/steps/searchSetup.ts b/src/steps/searchSetup.ts index 1dcb714..de62921 100644 --- a/src/steps/searchSetup.ts +++ b/src/steps/searchSetup.ts @@ -1,9 +1,10 @@ import { readFile } from 'node:fs/promises' import path from 'node:path' -import { COLLECTION_NAME, DEMO_QUERY_BY, TYPO_DEMO_QUERY } from '../constants.js' +import { DEMO_QUERY_BY, TYPO_DEMO_QUERY } from '../constants.js' import type { ProjectConfig } from '../config.js' import { createTypesenseClient } from '../util/typesense.js' -import { copySchemaInto, loadBooksSchema, recreateCollection } from './collection.js' +import { loadBooksSchema, recreateCollection } from './collection.js' +import { ensureSearchConfigFile, inferSearchConfig, SEARCH_CONFIG_FILE } from './searchConfig.js' import { ensureDataset } from './dataset.js' import { connectionEnvValues, writeEnvFile } from './env.js' import { createSearchOnlyKey } from './keys.js' @@ -22,8 +23,6 @@ export interface SearchSetupResult { /** The browser-safe key. The admin key stays in ProvisionedServer. */ searchOnlyKey: string replacedCollection: boolean - /** Where the sample data was copied, if it was. */ - datasetDir?: string /** Proof the aha moment works, obtained with the search-only key. */ verification: TypoVerification } @@ -49,29 +48,28 @@ export async function setUpSearch( // Only the CLI ever holds the admin key. const admin = createTypesenseClient(server.baseUrl, server.adminKey) - const schema = await loadBooksSchema() + const books = await loadBooksSchema() + const searchFile = await ensureSearchConfigFile(targetDir, { + collections: [{ name: books.name, schema: books, search: inferSearchConfig(books) }], + }) + const schema = searchFile.collections[0]?.schema + if (schema === undefined) { + throw new Error(`${SEARCH_CONFIG_FILE} lists no collections.`) + } + const { replaced } = await recreateCollection(admin, schema) onStep(`${replaced ? 'Recreated' : 'Created'} collection "${schema.name}"`) - // The schema goes in even for an empty collection: it is the file to edit first. - await copySchemaInto(targetDir) - - let documentsImported = 0 - let datasetDir: string | undefined - if (config.dataset === 'books') { - // Fetched, not bundled. Lands directly in the project so the user's own seed - // script can re-run it offline. - const dataset = await ensureDataset(targetDir, { onProgress: onStep }) - datasetDir = path.dirname(dataset.path) - - const outcome = await seedCollection( - admin, - schema.name, - await readFile(dataset.path, 'utf8'), - ) - documentsImported = outcome.imported - onStep(`Indexed ${documentsImported} documents`) - } + // Fetched, not bundled. Lands directly in the project so the user's own seed + // script can re-run it offline. + const dataset = await ensureDataset(targetDir, { onProgress: onStep }) + + const { imported: documentsImported } = await seedCollection( + admin, + schema.name, + await readFile(dataset.path, 'utf8'), + ) + onStep(`Indexed ${documentsImported} documents`) const searchOnlyKey = await createSearchOnlyKey(admin, schema.name) onStep('Generated a search-only API key') @@ -86,19 +84,14 @@ export async function setUpSearch( ) onStep(`Wrote ${template.env.file}`) - const verification = await verifyTypoSearch(server.baseUrl, searchOnlyKey, schema.name, { - expectDocuments: config.dataset === 'books', - }) - if (config.dataset === 'books') { - onStep(`Verified: "${verification.query}" finds ${verification.topHit}`) - } + const verification = await verifyTypoSearch(server.baseUrl, searchOnlyKey, schema.name) + onStep(`Verified: "${verification.query}" finds ${verification.topHit}`) return { - collection: COLLECTION_NAME, + collection: schema.name, documentsImported, searchOnlyKey, replacedCollection: replaced, - datasetDir, verification, } } @@ -114,7 +107,6 @@ export async function verifyTypoSearch( baseUrl: string, searchOnlyKey: string, collection: string, - { expectDocuments = true }: { expectDocuments?: boolean } = {}, ): Promise { const browser = createTypesenseClient(baseUrl, searchOnlyKey) const result = await browser.search(collection, { @@ -124,7 +116,7 @@ export async function verifyTypoSearch( const topHit = String(result.hits[0]?.document['title'] ?? '') - if (expectDocuments && result.found === 0) { + if (result.found === 0) { throw new Error( `The collection was indexed but searching "${TYPO_DEMO_QUERY}" returned nothing. ` + `Expected typo-tolerant matches over ${DEMO_QUERY_BY}.`, diff --git a/src/steps/server.ts b/src/steps/server.ts index e8f4fd2..34a4388 100644 --- a/src/steps/server.ts +++ b/src/steps/server.ts @@ -36,7 +36,11 @@ export async function waitForHealth( const body = await response.text() try { const parsed: unknown = JSON.parse(body) - if (typeof parsed === 'object' && parsed !== null && (parsed as { ok?: unknown }).ok === true) { + if ( + typeof parsed === 'object' && + parsed !== null && + (parsed as { ok?: unknown }).ok === true + ) { return } lastAttempt = `HTTP ${response.status}, body ${body.slice(0, 120)}` @@ -69,15 +73,16 @@ export async function waitForHealth( * diagnosis. */ export function describeStartFailure(stderr: string, port: number): string { - const clash = - /port is already allocated|address already in use|ports are not available/i.test(stderr) + const clash = /port is already allocated|address already in use|ports are not available/i.test( + stderr, + ) if (!clash) return stderr return ( `Port ${port} is already in use, so Typesense could not start.\n` + ` Something is bound to it — most likely a Typesense you already have running.\n` + ` Either use another port: --port ${port + 1}\n` + - " or point at the existing server instead of starting one (drop --yes and pick\n" + + ' or point at the existing server instead of starting one (drop --yes and pick\n' + ' "I already have one running").\n\n' + `Docker said:\n${stderr}` ) diff --git a/src/summary.ts b/src/summary.ts index d23c6e5..2a6b642 100644 --- a/src/summary.ts +++ b/src/summary.ts @@ -38,7 +38,8 @@ function describeServer(config: ProjectConfig): string { * on it. */ export function summaryLines(config: ProjectConfig): string[] { - const { template } = config + const { template, server } = config + const local = server.kind === 'docker' return [ row('Directory', config.targetDir), @@ -46,9 +47,13 @@ export function summaryLines(config: ProjectConfig): string[] { row('Server', describeServer(config)), row( 'Collection', - config.dataset === 'books' + local ? `"${COLLECTION_NAME}" + ${DATASET_APPROX_COUNT} titles (downloaded)` - : 'none (empty — bring your own JSON)', + : `${ + server.collections.length > 0 + ? server.collections.map((name) => `"${name}"`).join(', ') + : 'every collection and alias the key can see' + } ${pc.dim('(read-only)')}`, ), row('Install', template.deps.join(', ')), '', @@ -57,11 +62,22 @@ export function summaryLines(config: ProjectConfig): string[] { ' browser', PUBLIC_ENV_VARS.map((name) => `${template.env.publicPrefix}${name}`).join('\n'), ), - row(' server', `${PRIVATE_ENV_VARS.join(', ')} ${pc.dim('(admin — never prefixed)')}`), + // An existing server's admin key never reaches the CLI, let alone the project. + ...(local + ? [row(' server', `${PRIVATE_ENV_VARS.join(', ')} ${pc.dim('(admin — never prefixed)')}`)] + : []), ] } export function nextStepsLines(config: ProjectConfig): string[] { + if (config.server.kind === 'byo') { + return [ + `cd ${config.projectName}`, + `${config.template.devCommand}${pc.dim(` # ${config.template.devUrl}`)}`, + '', + pc.dim('Change what the page searches and shows in typesense.config.json.'), + ] + } return [ `cd ${config.projectName}`, `${config.template.devCommand}${pc.dim(` # ${config.template.devUrl} — type "hary potr"`)}`, diff --git a/src/templates.ts b/src/templates.ts index b7ccbea..3e8bf1e 100644 --- a/src/templates.ts +++ b/src/templates.ts @@ -1,4 +1,4 @@ -import { existsSync, readdirSync, statSync } from 'node:fs' +import { type Dirent, existsSync, readdirSync, statSync } from 'node:fs' import path from 'node:path' import { pathToFileURL } from 'node:url' import { templatesDir } from './paths.js' @@ -7,17 +7,13 @@ import { templatesDir } from './paths.js' * The templates this CLI ships, read from the templates directory rather than * written down here. * - * Deliberate: no framework's name appears anywhere in src/, so adding or removing - * a template is a change to templates/ alone. Only one ships today — Next.js — on - * the grounds that a second framework doubles the surface to keep working against - * upstream churn, for a demo whose value is the search wiring rather than the - * framework. The manifest indirection stays because it keeps that surface - * declarative, which is what makes adding one back contained. + * Deliberate: the only framework name in src/ is DEFAULT_TEMPLATE_ID, so adding + * or removing any other template is a change to templates/ alone. * - * Sorted, so the default (the first) does not depend on filesystem order. + * Sorted, so the order does not depend on the filesystem, with the default first. */ function discoverTemplateIds(): string[] { - let entries + let entries: Dirent[] try { entries = readdirSync(templatesDir, { withFileTypes: true }) } catch (error) { @@ -31,6 +27,8 @@ function discoverTemplateIds(): string[] { .filter((entry) => entry.isDirectory()) .map((entry) => entry.name) .sort() + // The first id is the `--yes` default, so it must not change when a template sorts before it. + .sort((a, b) => Number(b === DEFAULT_TEMPLATE_ID) - Number(a === DEFAULT_TEMPLATE_ID)) if (ids.length === 0) { throw new Error(`No templates found in ${templatesDir}. The installation looks incomplete.`) @@ -38,6 +36,9 @@ function discoverTemplateIds(): string[] { return ids } +/** What `--yes` scaffolds, and the first choice in the framework prompt. */ +export const DEFAULT_TEMPLATE_ID = 'nextjs' + export const TEMPLATE_IDS: readonly string[] = discoverTemplateIds() export type TemplateId = string @@ -107,11 +108,7 @@ function isRecord(value: unknown): value is Record { return typeof value === 'object' && value !== null && !Array.isArray(value) } -function requireString( - record: Record, - key: string, - source: string, -): string { +function requireString(record: Record, key: string, source: string): string { const value = record[key] if (typeof value !== 'string' || value.trim() === '') { throw new TemplateManifestError(source, `"${key}" must be a non-empty string`) @@ -136,11 +133,7 @@ function rejectUnknownKeys( } /** Reject anything that would escape the project directory. */ -function requireRelativePath( - value: string, - key: string, - source: string, -): string { +function requireRelativePath(value: string, key: string, source: string): string { if (path.isAbsolute(value)) { throw new TemplateManifestError(source, `"${key}" must be relative, got "${value}"`) } @@ -275,10 +268,7 @@ export async function loadTemplate(id: string): Promise { } const loaded: unknown = await import(pathToFileURL(configPath).href) - const manifest = validateManifest( - isRecord(loaded) ? loaded['default'] : undefined, - source, - ) + const manifest = validateManifest(isRecord(loaded) ? loaded['default'] : undefined, source) if (manifest.id !== id) { throw new TemplateManifestError( diff --git a/src/util/clipboard.ts b/src/util/clipboard.ts new file mode 100644 index 0000000..05fde16 --- /dev/null +++ b/src/util/clipboard.ts @@ -0,0 +1,42 @@ +import { log } from '@clack/prompts' +import { execa } from 'execa' + +const TOOLS: [string, string[]][] = [ + ['pbcopy', []], + ['clip', []], + ['wl-copy', []], + ['xclip', ['-selection', 'clipboard']], +] + +/** Copies text with the first clipboard tool that works. Never throws. */ +export async function copyToClipboard(text: string): Promise { + for (const [command, args] of TOOLS) { + try { + await execa(command, args, { input: text, timeout: 2_000 }) + return true + } catch { + // Not installed or failed: try the next tool. + } + } + return false +} + +/** + * Prints a command with no clack `│` prefix, so a terminal selection pastes + * cleanly, and copies it to the clipboard. + */ +export async function showCommand(command: string): Promise { + process.stdout.write(`\n${command}\n\n`) + if (await copyToClipboard(command)) log.info('Copied to the clipboard.') +} + +/** An error whose fix is a command, kept apart from the message so it prints unprefixed. */ +export class CommandError extends Error { + constructor( + message: string, + readonly command: string, + options?: ErrorOptions, + ) { + super(message, options) + } +} diff --git a/src/util/docker.ts b/src/util/docker.ts index 8c04479..7af7d8a 100644 --- a/src/util/docker.ts +++ b/src/util/docker.ts @@ -57,21 +57,19 @@ export async function checkDocker(): Promise { */ export async function runCompose(projectDir: string, args: string[]): Promise { try { - const result = await execa( - 'docker', - ['compose', '--project-directory', projectDir, ...args], - { cwd: projectDir, timeout: 300_000 }, - ) + const result = await execa('docker', ['compose', '--project-directory', projectDir, ...args], { + cwd: projectDir, + timeout: 300_000, + }) return result.stdout } catch (error) { const stderr = typeof error === 'object' && error !== null && 'stderr' in error ? String((error as { stderr?: unknown }).stderr ?? '').trim() : '' - throw new Error( - `\`docker compose ${args.join(' ')}\` failed${stderr ? `:\n${stderr}` : '.'}`, - { cause: error }, - ) + throw new Error(`\`docker compose ${args.join(' ')}\` failed${stderr ? `:\n${stderr}` : '.'}`, { + cause: error, + }) } } @@ -112,11 +110,12 @@ export async function composePull( projectDir: string, onLine: (line: string) => void = () => {}, ): Promise { - const subprocess = execa( - 'docker', - ['compose', '--project-directory', projectDir, 'pull'], - { cwd: projectDir, timeout: 900_000, all: true, buffer: false }, - ) + const subprocess = execa('docker', ['compose', '--project-directory', projectDir, 'pull'], { + cwd: projectDir, + timeout: 900_000, + all: true, + buffer: false, + }) for await (const line of subprocess.iterable({ from: 'all' })) { onLine(String(line)) diff --git a/src/util/port.ts b/src/util/port.ts new file mode 100644 index 0000000..33114ec --- /dev/null +++ b/src/util/port.ts @@ -0,0 +1,32 @@ +import net from 'node:net' + +/** + * True when something accepts connections on 127.0.0.1:port. + * + * A connect probe rather than trying to bind: Docker publishes on 0.0.0.0, and + * on macOS a test bind to one address can succeed beside a listener on another. + */ +export function isPortInUse(port: number): Promise { + return new Promise((resolve) => { + const socket = net.connect({ port, host: '127.0.0.1' }) + socket.setTimeout(1_000) + socket.once('connect', () => { + socket.destroy() + resolve(true) + }) + socket.once('timeout', () => { + socket.destroy() + resolve(false) + }) + socket.once('error', () => resolve(false)) + }) +} + +/** The first port after `port` that nothing listens on. */ +export async function nextFreePort(port: number): Promise { + const last = Math.min(port + 100, 65_535) + for (let candidate = port + 1; candidate <= last; candidate++) { + if (!(await isPortInUse(candidate))) return candidate + } + throw new Error(`No free port between ${port + 1} and ${last}. Pass one with --port.`) +} diff --git a/src/util/pullProgress.ts b/src/util/pullProgress.ts index 1fb12e4..7832f62 100644 --- a/src/util/pullProgress.ts +++ b/src/util/pullProgress.ts @@ -27,10 +27,11 @@ const UNIT_BYTES: Record = { } export function humanBytes(bytes: number): string { - if (bytes >= UNIT_BYTES['GB']!) { - return `${(bytes / UNIT_BYTES['GB']!).toFixed(1)} GB` + const { GB = 1e9, MB = 1e6 } = UNIT_BYTES + if (bytes >= GB) { + return `${(bytes / GB).toFixed(1)} GB` } - return `${Math.round(bytes / UNIT_BYTES['MB']!)} MB` + return `${Math.round(bytes / MB)} MB` } function parseSize(raw: string): number { diff --git a/src/util/typesense.ts b/src/util/typesense.ts index 2d84cc7..235616c 100644 --- a/src/util/typesense.ts +++ b/src/util/typesense.ts @@ -1,5 +1,8 @@ export interface TypesenseClient { collectionExists(name: string): Promise + getCollection(name: string): Promise + listCollections(): Promise + listAliases(): Promise createCollection(schema: object): Promise deleteCollection(name: string): Promise importDocuments(name: string, jsonl: string): Promise @@ -7,6 +10,8 @@ export interface TypesenseClient { listKeys(): Promise deleteKey(id: number): Promise search(name: string, params: Record): Promise + /** The HTTP status of a request, whatever it is. Throws only when nothing answers. */ + status(method: string, path: string, body?: string): Promise } export interface KeySpec { @@ -21,6 +26,18 @@ export interface CreatedKey { value: string } +export interface StoredCollection { + name: string + num_documents: number + fields: { name: string; type: string; facet?: boolean; optional?: boolean; index?: boolean }[] + default_sorting_field?: string +} + +export interface StoredAlias { + name: string + collection_name: string +} + export interface StoredKey { id: number description: string @@ -57,7 +74,7 @@ export function createTypesenseClient(baseUrl: string, apiKey: string): Typesens async function request( method: string, path: string, - options: { body?: string; contentType?: string; allow404?: boolean } = {}, + options: { body?: string; contentType?: string; allow404?: boolean; anyStatus?: boolean } = {}, ): Promise<{ status: number; text: string }> { let response: Response try { @@ -80,7 +97,9 @@ export function createTypesenseClient(baseUrl: string, apiKey: string): Typesens } const text = await response.text() - if (!response.ok && !(options.allow404 === true && response.status === 404)) { + const allowed = + options.anyStatus === true || (options.allow404 === true && response.status === 404) + if (!response.ok && !allowed) { throw new TypesenseError( `Typesense replied ${response.status} to ${method} ${path}: ${text.slice(0, 300)}`, response.status, @@ -106,6 +125,19 @@ export function createTypesenseClient(baseUrl: string, apiKey: string): Typesens return status === 200 }, + async getCollection(name) { + return requestJson('GET', `/collections/${encodeURIComponent(name)}`) + }, + + async listCollections() { + return requestJson('GET', '/collections') + }, + + async listAliases() { + const { aliases } = await requestJson<{ aliases?: StoredAlias[] }>('GET', '/aliases') + return aliases ?? [] + }, + async createCollection(schema) { await request('POST', '/collections', { body: JSON.stringify(schema), @@ -150,5 +182,15 @@ export function createTypesenseClient(baseUrl: string, apiKey: string): Typesens `/collections/${encodeURIComponent(name)}/documents/search?${query}`, ) }, + + async status(method, path, body) { + const options = { anyStatus: true, contentType: 'text/plain' } + const { status } = await request( + method, + path, + body === undefined ? options : { ...options, body }, + ) + return status + }, } } diff --git a/templates/nextjs/files/app/collections/[name]/page.tsx b/templates/nextjs/files/app/collections/[name]/page.tsx new file mode 100644 index 0000000..a72a4ab --- /dev/null +++ b/templates/nextjs/files/app/collections/[name]/page.tsx @@ -0,0 +1,22 @@ +import type { Metadata } from 'next' +import { Suspense } from 'react' +import { ShowAllPage } from '../../search' + +export async function generateMetadata({ + params, +}: { + params: Promise<{ name: string }> +}): Promise { + const { name } = await params + return { title: `Search ${decodeURIComponent(name)} | Typesense` } +} + +// The client page reads the query with useSearchParams, which needs a Suspense +// boundary, or `next build` refuses to prerender. +export default function CollectionRoute() { + return ( + + + + ) +} diff --git a/templates/nextjs/files/app/icon.png b/templates/nextjs/files/app/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..dca9badb45ef5b832e682e4bca90c77c1fc8d671 GIT binary patch literal 34884 zcmXt9by!s2(_f^)1!)24PDNNyx|Z(lZWa{jMmhvUx?z!SSVB^el3rrz5Rep5Qu@7q zf6w~|56?aKp0ji2&V1&~XXeIesL6xzsPI4_5Li(`Rtp4r1pD`gg9VI8rarI$|8UUYvUP@I81gcNOzqP~!fua@^WucLKqGg`b9MYB1r3DGFdNN$L?d38*ATa#mBX^ryLsPsEDX@#4J2X4{ z=4Xz3e#?RITJ0D9Z=+)Tmm{y|u1p`&*SaSpg|I@Ga@GZHZ%-+~`RbJ26Dg4sXduwK ztekPcGTHJ4W{V4$t`HoE#Z7Dy#!75O=kWI#u%}olxQjq*pinC~d(*1sV#csevA~pi znfz%VC7>DI1;HR{zNBbs2;{SCsLPAiK&#u$XXwDZ8iqfD&z5N^9}MvK>F2RjnWxgI z_D6vm0ai1z@I$H1FFvQbb&45*!mT{~(E=b)i0})lWmKj@M?BTUZ`C?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cG{EC=5%+Rjfu(;V530im`sXtEw$;Akj*FAsvLJf+bp5D zQ%q(`QTYqx`rp3&U*Emj|2tcKyMMD=8YHJlN6z4@&b(geF;U zMpnc(Z$2Xie;>3%c*n~kS&F0o7h4xt7z~tc0!@MM zV=}XcGP&jIA~8bj(6_kvJ`_6w>_=oQQdpA5g+382$g+CSQVDk-r=rHJxR4`gf~;6C zP|!#4YS-a;YHs6w1+OG%lc(iub)NLHlHOq!q$9Gd0&O1zM4fqO@NnFCDt7W1=5bmd zWR2LN$C4MtomnD#K$4ZjZ43@BkIMrZb?-r`QyvrMZPT{s$KbSPgms`VV;NP8nbT~F zx*^oDTFZ1<@ZJ~`2OJ;#U=2v0hghx9zWuF|JGv@$c%ckTc+R$TIKyBhGRK6tt(76m zIwf+t8g+Q(MwDk{PM|%oAmQd>zHeV&r_Nf5zJhy!Utt-2K6gEfA7g>swKgbJA11lfU6uCiE7DE)r!k3G|v z)&jS|m%m}C`d!#&8OMG7k08)}ekt=U^>%$JEcx?zUEBHXl4_ErPwJUlD}9+gb>;)B P3I+yGS3j3^P6 - {/* eslint-disable-next-line @next/next/no-img-element */} - -
-

{hit.title}

-

- {hit.authors.join(', ')} · {hit.publication_year} -

-

- ★ {hit.average_rating} · {hit.ratings_count.toLocaleString()} ratings -

-
- - ) +export const metadata: Metadata = { + title: + config.collections.length === 1 && only + ? `Search ${only.name} | Typesense` + : 'Search | Typesense', + description: 'Typo-tolerant search with Typesense.', } export default function Home() { - return ( -
-
-

Search {collectionName}

-

- Misspell it on purpose. Typesense corrects typos as you type. -

-
- - - - -
- {/* One facet, per the plan. `authors` is faceted in scripts/schema.ts. */} - - -
- - hitComponent={BookHit} classNames={{ list: styles.hitList }} /> -
-
-
-
- ) + return } diff --git a/templates/nextjs/files/app/search.module.css b/templates/nextjs/files/app/search.module.css index 2fb5b4b..1dd614a 100644 --- a/templates/nextjs/files/app/search.module.css +++ b/templates/nextjs/files/app/search.module.css @@ -1,44 +1,86 @@ -/* Scoped to the search page, so the scaffold's globals.css and layout.tsx are - left exactly as create-next-app generated them. */ +/* Scoped to the search pages, so the scaffold's globals.css and layout.tsx stay + as create-next-app generated them. The tokens follow cloud.typesense.org. */ .page { + --ts-page: #fefefe; + --ts-panel: #f7f7fa; + --ts-border: #e6e6ee; + --ts-border-strong: #c9cad6; + --ts-text: #303138; + --ts-muted: #6f7082; + --ts-indigo: #3943b7; + --ts-pink: #ed0e73; + --ts-pink-tint: #fde7f1; + --ts-checkbox-border: #9495a6; + /* - * `width: 100%` is not redundant, and removing it breaks the page in a way that - * is easy to misread as a search bug. - * - * The scaffold's own globals.css sets `body { display: flex; flex-direction: - * column }`, which makes this element a flex item. Auto margins in the cross - * axis suppress the default `align-items: stretch`, so without an explicit - * width the element is sized to fit-content — and its width then tracks - * whatever the current results happen to be. Typing would resize the search box - * and shift the whole layout sideways on every keystroke. - * - * Setting the width explicitly makes the layout independent of both the result - * set and whatever the framework's stylesheet does to body. + * `width: 100%` is not redundant. The scaffold's globals.css sets + * `body { display: flex; flex-direction: column }`, which makes this element a + * flex item, and without an explicit width it sizes to its content: the layout + * would then shift sideways on every keystroke. */ width: 100%; - max-width: 60rem; + min-height: 100vh; + background: var(--ts-page); + color: var(--ts-text); + font-family: var(--font-body), system-ui, sans-serif; + /* Above Cloud's .95rem: Palanquin's small x-height reads too small on large monitors. */ + font-size: 1.0625rem; + line-height: 1.6; +} + +.topbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 1rem 1.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.logo { + display: block; + height: 2rem; + width: auto; +} + +.nav { + display: flex; + gap: 1.25rem; + font-size: 1rem; +} + +.nav a { + color: var(--ts-muted); + text-decoration: none; +} + +.nav a:hover { + color: var(--ts-pink); +} + +.content { + max-width: 72rem; margin: 0 auto; - padding: 3rem 1.5rem 6rem; - font-family: var(--font-geist-sans), system-ui, sans-serif; + padding: 2.5rem 1.5rem 6rem; } .header { - margin-bottom: 2rem; + margin-bottom: 1.5rem; } .heading { - font-size: 1.75rem; - font-weight: 650; - letter-spacing: -0.02em; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 2.25rem; + font-weight: 600; + line-height: 1.2; + color: var(--ts-indigo); margin: 0 0 0.35rem; - text-transform: capitalize; } .subheading { margin: 0; - opacity: 0.6; - font-size: 0.95rem; + color: var(--ts-muted); } .searchRoot { @@ -47,21 +89,27 @@ .input { width: 100%; - padding: 0.85rem 1rem; - font-size: 1.05rem; + padding: 0.8rem 1rem; font: inherit; - border-radius: 0.6rem; - border: 1px solid color-mix(in srgb, currentColor 18%, transparent); - background: color-mix(in srgb, currentColor 4%, transparent); + font-size: 1.2rem; color: inherit; + background: var(--ts-page); + border: 1px solid var(--ts-border-strong); + border-radius: 0.375rem; } .input:focus { - outline: 2px solid color-mix(in srgb, currentColor 45%, transparent); - outline-offset: 1px; + outline: none; + border-color: var(--ts-pink); + box-shadow: 0 0 0 3px var(--ts-pink-tint); } -/* InstantSearch renders submit and reset buttons; the demo does not need them. */ +/* The browser's own clear button is blue and ignores the palette. */ +.input::-webkit-search-cancel-button { + appearance: none; +} + +/* InstantSearch renders submit and reset buttons; the search box does not need them. */ .hiddenButton { display: none; } @@ -69,18 +117,15 @@ .layout { display: grid; /* - * minmax(0, 1fr) rather than 1fr: a bare `1fr` means `minmax(auto, 1fr)`, and - * that `auto` floor is the column's min-content width. One long title — the - * dataset has "The Seven-Percent Solution: Being a Reprint from the - * Reminiscences of John H. Watson, MD" — would then force the column wider than - * its share and squeeze the facet sidebar. + * minmax(0, 1fr), not 1fr: `1fr` means `minmax(auto, 1fr)`, whose floor is + * the column's min-content width, so one long title would squeeze the facets. */ - grid-template-columns: 14rem minmax(0, 1fr); + grid-template-columns: 16.5rem minmax(0, 1fr); gap: 2.5rem; align-items: start; } -@media (max-width: 40rem) { +@media (max-width: 44rem) { .layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; @@ -89,15 +134,22 @@ .sidebar { position: sticky; - top: 2rem; + top: 1.5rem; + display: flex; + flex-direction: column; + gap: 1.5rem; + padding: 1.25rem; + background: var(--ts-page); + border: 1px solid var(--ts-border); + border-radius: 0.5rem; } .facetHeading { - font-size: 0.7rem; - text-transform: uppercase; - letter-spacing: 0.08em; - opacity: 0.55; - margin: 0 0 0.75rem; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.125rem; + font-weight: 600; + color: var(--ts-text); + margin: 0 0 0.6rem; } .facetList { @@ -106,8 +158,8 @@ padding: 0; display: flex; flex-direction: column; - gap: 0.4rem; - font-size: 0.9rem; + gap: 0.5rem; + font-size: 1rem; } .facetLabel { @@ -117,94 +169,213 @@ cursor: pointer; } +/* The Typesense Cloud checkbox: Bootstrap's custom checkbox, with its sizes, + colors and check mark. */ +.facetCheckbox { + appearance: none; + flex-shrink: 0; + width: 1.35rem; + height: 1.35rem; + margin: 0; + border: 1px solid var(--ts-checkbox-border); + border-radius: 0.375rem; + background: var(--ts-page) 50% / 50% 50% no-repeat; + cursor: pointer; + transition: + background-color 0.15s ease-in-out, + border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out; +} + +.facetCheckbox:checked { + background-color: var(--ts-pink); + border-color: var(--ts-pink); + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23fefefe' d='m6.564.75-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3E%3C/svg%3E"); +} + +.facetCheckbox:focus-visible { + outline: none; + box-shadow: 0 0 0 0.2rem rgba(237, 14, 115, 0.14); +} + +.facetCheckbox:focus-visible:not(:checked) { + border-color: rgba(237, 14, 115, 0.55); +} + +.facetCheckbox:active:not(:checked) { + background-color: #fbb3d3; + border-color: #fbb3d3; +} + +@media (prefers-reduced-motion: reduce) { + .facetCheckbox { + transition: none; + } +} + .facetCount { margin-left: auto; + padding: 0 0.45rem; + font-size: 0.875rem; + color: var(--ts-muted); + background: var(--ts-panel); + border-radius: 1rem; font-variant-numeric: tabular-nums; - font-size: 0.8rem; - opacity: 0.5; } .facetSearch { - margin-bottom: 0.75rem; + margin-bottom: 0.6rem; } -/* The facet's own search box renders submit and reset buttons of its own; the - input alone is enough here. */ .facetSearch button { display: none; } .facetSearch input { width: 100%; + padding: 0.4rem 0.6rem; font: inherit; - font-size: 0.85rem; - padding: 0.4rem 0.55rem; - border-radius: 0.4rem; - border: 1px solid color-mix(in srgb, currentColor 15%, transparent); - background: transparent; + font-size: 0.95rem; color: inherit; + background: var(--ts-panel); + border: 1px solid var(--ts-border); + border-radius: 0.375rem; +} + +.facetSearch input:focus { + outline: none; + border-color: var(--ts-pink); } .stats { - font-size: 0.8rem; - opacity: 0.55; - margin-bottom: 1rem; - font-variant-numeric: tabular-nums; + font-size: 0.95rem; + color: var(--ts-muted); + margin-bottom: 0.5rem; } .hitList { list-style: none; margin: 0; padding: 0; - display: flex; - flex-direction: column; - gap: 0.5rem; +} + +.hitList > li + li { + border-top: 1px solid var(--ts-border); } .hit { display: flex; gap: 1rem; - padding: 0.75rem; - border-radius: 0.6rem; - align-items: center; -} - -.hit:hover { - background: color-mix(in srgb, currentColor 4%, transparent); + padding: 1rem 0; + align-items: flex-start; } .cover { - width: 3rem; - height: 4.5rem; + width: 3.75rem; + height: 5.5rem; object-fit: cover; border-radius: 0.25rem; - background: color-mix(in srgb, currentColor 10%, transparent); + background: var(--ts-panel); flex-shrink: 0; } /* Flex items refuse to shrink below their content by default; without this a long - title pushes the cover image out of the row instead of wrapping. */ + title pushes the cover out of the row instead of wrapping. */ .hitBody { min-width: 0; } .title { - font-size: 1rem; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.25rem; font-weight: 600; - margin: 0 0 0.2rem; line-height: 1.3; + margin: 0 0 0.35rem; overflow-wrap: break-word; } -.meta { +/* The typo correction is the point of the demo, so the matched words carry the accent. */ +.title mark { + color: var(--ts-pink); + background: var(--ts-pink-tint); + border-radius: 0.2rem; + padding: 0 0.1rem; +} + +.fields { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 1.25rem; margin: 0; - font-size: 0.875rem; - opacity: 0.7; + font-size: 1rem; +} + +.field { + display: flex; +} + +.field dt { + color: var(--ts-muted); + margin-right: 0.35rem; } -.rating { - margin: 0.15rem 0 0; - font-size: 0.8rem; - opacity: 0.5; +.field dd { + margin: 0; font-variant-numeric: tabular-nums; } + +.error { + margin: 0 0 1.5rem; + padding: 0.75rem 1rem; + border: 1px solid var(--ts-pink); + border-radius: 0.375rem; + background: var(--ts-pink-tint); + font-size: 1rem; +} + +.empty { + margin: 0; + padding: 1rem 0; + color: var(--ts-muted); +} + +.section + .section { + margin-top: 2.5rem; +} + +.sectionHeader { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 1rem; + padding-bottom: 0.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.sectionTitle { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.5rem; + font-weight: 600; + color: var(--ts-indigo); + margin: 0; +} + +.link { + color: var(--ts-pink); + font-size: 1rem; + text-decoration: none; +} + +.link:hover { + text-decoration: underline; +} + +.back { + display: inline-block; + margin-bottom: 1.25rem; +} + +.page a:focus-visible { + outline: 2px solid var(--ts-pink); + outline-offset: 2px; +} diff --git a/templates/nextjs/files/app/search.tsx b/templates/nextjs/files/app/search.tsx new file mode 100644 index 0000000..c897064 --- /dev/null +++ b/templates/nextjs/files/app/search.tsx @@ -0,0 +1,285 @@ +'use client' + +import { Catamaran, Palanquin } from 'next/font/google' +import Link from 'next/link' +import { notFound, useParams, useSearchParams } from 'next/navigation' +import type { ReactNode } from 'react' +import { + Configure, + Highlight, + Hits, + Index, + InstantSearch, + RefinementList, + SearchBox, + Stats, + useInstantSearch, +} from 'react-instantsearch' +import type { Hit } from 'instantsearch.js' +import { collections, searchClient, type Collection, type SearchConfig } from '../lib/typesense' +import styles from './search.module.css' + +/** + * Every field name below comes from typesense.config.json, so these pages work + * for any collection. Change what they show there, not here. + */ +type Document = Record + +// The Typesense Cloud dashboard's typefaces: Palanquin for text, Catamaran for headings. +const body = Palanquin({ + weight: ['400', '500', '600'], + subsets: ['latin'], + variable: '--font-body', +}) +const heading = Catamaran({ + weight: ['500', '600', '700'], + subsets: ['latin'], + variable: '--font-heading', +}) + +function label(field: string): string { + const words = field.replace(/[_-]+/g, ' ') + return words.charAt(0).toUpperCase() + words.slice(1) +} + +function format(value: unknown): string { + if (Array.isArray(value)) return value.join(', ') + // Not toLocaleString: it would print a year as "2,008". + return value === null || value === undefined ? '' : String(value) +} + +function DocumentHit({ hit, search }: { hit: Hit; search: SearchConfig }) { + const image = search.image === null ? '' : format(hit[search.image]) + const details = search.display + .map((field) => [field, format(hit[field])] as const) + .filter(([, value]) => value !== '') + + return ( +
+ {image !== '' && ( + // eslint-disable-next-line @next/next/no-img-element + (event.currentTarget.style.display = 'none')} + /> + )} +
+

+ +

+
+ {details.map(([field, value]) => ( +
+
{label(field)}
+
{value}
+
+ ))} +
+
+
+ ) +} + +// Made once per collection: an inline component would remount every hit on each render. +const hitComponents = Object.fromEntries( + collections.map(({ name, search }) => [ + name, + function CollectionHit({ hit }: { hit: Hit }) { + return + }, + ]), +) + +/** InstantSearch turns a failed request into zero hits; say what went wrong instead. */ +function SearchError() { + const { error } = useInstantSearch({ catchError: true }) + if (error === undefined) return null + return ( +

+ Search failed: {error.message} Check the field names in typesense.config.json. +

+ ) +} + +function Shell({ + title, + indexName, + initialQuery, + children, +}: { + title: string + indexName: string + initialQuery?: string + children: ReactNode +}) { + return ( +
+
+ + {/* eslint-disable-next-line @next/next/no-img-element */} + Typesense + + +
+
+
+

{title}

+

+ Misspell it on purpose. Typesense corrects typos as you type. +

+
+ + + + + {children} + +
+
+ ) +} + +/** One collection with its own facets: the home page when only one is selected. */ +export function CollectionPage({ + collection, + initialQuery, + showBack = false, +}: { + collection: Collection + initialQuery?: string + showBack?: boolean +}) { + const { name, search } = collection + const facets = search.facets.length > 0 + + return ( + + {showBack && ( + + ← All collections + + )} +
+ {facets && ( + + )} + +
+ + + hitComponent={hitComponents[name]} + classNames={{ list: styles.hitList }} + /> +
+
+
+ ) +} + +/** The top 5 hits of one collection, inside an , with a link to all of them. */ +function Section({ collection, rootIndex }: { collection: Collection; rootIndex: string }) { + const { results, uiState } = useInstantSearch() + const query = uiState[rootIndex]?.query ?? '' + const href = `/collections/${encodeURIComponent(collection.name)}${ + query === '' ? '' : `?q=${encodeURIComponent(query)}` + }` + + return ( +
+
+

{collection.name}

+ + Show all in {collection.name} + +
+ {results.nbHits === 0 ? ( +

No results in {collection.name}.

+ ) : ( + + hitComponent={hitComponents[collection.name]} + classNames={{ list: styles.hitList }} + /> + )} +
+ ) +} + +/** One query, every selected collection: each in its own section. */ +export function FederatedPage() { + // The root index carries the query; every section, its own included, is an . + const rootIndex = collections[0]?.name ?? '' + return ( + + {collections.map((collection) => ( + + +
+ + ))} + + ) +} + +/** The home page: the full page for one collection, or one section for each of several. */ +export function HomePage() { + const [only] = collections + return collections.length === 1 && only !== undefined ? ( + + ) : ( + + ) +} + +/** "Show all in ": one collection with its facets, keeping the query. */ +export function ShowAllPage() { + const { name } = useParams<{ name: string }>() + const query = useSearchParams().get('q') ?? undefined + const collection = collections.find((entry) => entry.name === decodeURIComponent(name)) + if (collection === undefined) notFound() + return +} diff --git a/templates/nextjs/files/lib/typesense.ts b/templates/nextjs/files/lib/typesense.ts index dabc554..55c10f7 100644 --- a/templates/nextjs/files/lib/typesense.ts +++ b/templates/nextjs/files/lib/typesense.ts @@ -1,12 +1,13 @@ import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter' +import config from '../typesense.config.json' /** * Connects the browser to Typesense. * * Every value here is read from a NEXT_PUBLIC_ variable, which means it ships to * the browser. That is fine — and deliberate — because the only key in this file - * is the search-only key: it can run searches against one collection and nothing - * else. It cannot add documents, drop the collection, or create further keys. + * is the search-only key: it can search the collections in typesense.config.json + * and nothing else. It cannot add documents, drop a collection, or create keys. * * The admin key lives in the same .env.local file WITHOUT the NEXT_PUBLIC_ * prefix, so Next.js never exposes it. Only scripts/seed.ts reads it. @@ -20,10 +21,29 @@ function required(name: string, value: string | undefined): string { return value } -export const collectionName = required( - 'NEXT_PUBLIC_TYPESENSE_COLLECTION', - process.env.NEXT_PUBLIC_TYPESENSE_COLLECTION, -) +/** What the UI searches, facets and shows. Written by create-typesense-app; edit freely. */ +export interface SearchConfig { + queryBy: string[] + facets: string[] + title: string + image: string | null + display: string[] +} + +export interface Collection { + /** The collection or alias to search. */ + name: string + search: SearchConfig +} + +export const collections: Collection[] = config.collections.map(({ name, search }) => ({ + name, + search, +})) +const [first] = collections +if (first === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') +} const adapter = new TypesenseInstantSearchAdapter({ server: { @@ -34,7 +54,9 @@ const adapter = new TypesenseInstantSearchAdapter({ nodes: [ { host: required('NEXT_PUBLIC_TYPESENSE_HOST', process.env.NEXT_PUBLIC_TYPESENSE_HOST), - port: Number(required('NEXT_PUBLIC_TYPESENSE_PORT', process.env.NEXT_PUBLIC_TYPESENSE_PORT)), + port: Number( + required('NEXT_PUBLIC_TYPESENSE_PORT', process.env.NEXT_PUBLIC_TYPESENSE_PORT), + ), protocol: required( 'NEXT_PUBLIC_TYPESENSE_PROTOCOL', process.env.NEXT_PUBLIC_TYPESENSE_PROTOCOL, @@ -44,18 +66,16 @@ const adapter = new TypesenseInstantSearchAdapter({ // Results are cached briefly so typing does not re-fetch the same query. cacheSearchResultsForSeconds: 2 * 60, }, - additionalSearchParameters: { - /** - * Which fields a query is matched against. `authors` is here as well as - * `title` so that a misspelled author name ("tolkein") finds their books. - * - * Ranking is handled by the collection's `default_sorting_field` - * (`ratings_count`, see scripts/schema.ts): it breaks ties between equally - * good text matches in favour of the better-known book, which is why - * "hary potr" puts Philosopher's Stone first. - */ - query_by: 'title,authors', - }, + /** + * Which fields a query is matched against, per collection, from + * typesense.config.json. Ranking ties are broken by each schema's + * `default_sorting_field`, which is why "hary potr" puts the best-known Harry + * Potter book first. + */ + additionalSearchParameters: { query_by: first.search.queryBy.join(',') }, + collectionSpecificSearchParameters: Object.fromEntries( + collections.map(({ name, search }) => [name, { query_by: search.queryBy.join(',') }]), + ), }) export const searchClient = adapter.searchClient diff --git a/templates/nextjs/files/public/typesense-logo.svg b/templates/nextjs/files/public/typesense-logo.svg new file mode 100644 index 0000000..849a665 --- /dev/null +++ b/templates/nextjs/files/public/typesense-logo.svg @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/nextjs/files/scripts/schema.ts b/templates/nextjs/files/scripts/schema.ts deleted file mode 100644 index e7d159f..0000000 --- a/templates/nextjs/files/scripts/schema.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * The collection schema — the first file worth editing. - * - * Typesense needs a schema before it can index anything. That requirement is the - * reason this file exists rather than being hidden: change a field here, run - * `npm run seed`, and the collection is rebuilt to match. - * - * Full field reference: https://typesense.org/docs/latest/api/collections.html - */ - -/** Must match NEXT_PUBLIC_TYPESENSE_COLLECTION in .env.local. */ -export const collectionName = process.env.NEXT_PUBLIC_TYPESENSE_COLLECTION ?? 'books' - -export const booksSchema = { - name: collectionName, - fields: [ - // Searched, but not faceted: nobody filters by exact title. - { name: 'title', type: 'string', facet: false }, - - // `string[]` because a book can have several authors. Faceting is what lets - // the sidebar in app/page.tsx offer them as filters. - { name: 'authors', type: 'string[]', facet: true }, - - { name: 'publication_year', type: 'int32', facet: true }, - { name: 'average_rating', type: 'float', facet: true }, - - // Stored so hits can show a cover. Not searched. - { name: 'image_url', type: 'string', facet: false }, - - { name: 'ratings_count', type: 'int32', facet: true }, - ], - - /** - * The tie-breaker, and the reason a misspelling finds the *right* book. - * - * Typesense ranks by text-match score first. When several documents match a - * query equally well — as all seventeen Harry Potter records do for - * "hary potr" — this field decides the order. Sorting by ratings_count puts - * the best-known edition on top. Remove it and the order becomes arbitrary. - */ - default_sorting_field: 'ratings_count', -} as const diff --git a/templates/nextjs/files/scripts/seed.ts b/templates/nextjs/files/scripts/seed.ts index 8dc573f..b0d8963 100644 --- a/templates/nextjs/files/scripts/seed.ts +++ b/templates/nextjs/files/scripts/seed.ts @@ -1,8 +1,9 @@ /** * Rebuilds the collection from data/books.jsonl. * - * Idempotent: it drops the collection, recreates it from scripts/schema.ts, and - * re-imports every document. Run it after editing the schema or the data. + * Idempotent: it drops the collection, recreates it from the schema in + * typesense.config.json, and re-imports every document. Run it after editing the + * schema or the data. * * npm run seed * @@ -12,7 +13,6 @@ */ import { readFile, writeFile } from 'node:fs/promises' import path from 'node:path' -import { booksSchema, collectionName } from './schema' /** * Tags the browser-safe key so this script can find its own and avoid piling up a @@ -43,6 +43,15 @@ async function loadEnv(file: string): Promise { async function main(): Promise { await loadEnv('.env.local') + const config = JSON.parse(await readFile('typesense.config.json', 'utf8')) as { + collections: { name: string; schema: { name: string } }[] + } + const collection = config.collections[0] + if (collection === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') + } + const collectionName = collection.name + // Coalesced rather than checked for undefined so the type stays `string` inside // the request helper below. const adminApiKey = process.env.TYPESENSE_API_KEY ?? '' @@ -88,8 +97,8 @@ async function main(): Promise { // Drop first: Typesense will not retrofit an existing collection to a new schema. await typesense('DELETE', `/collections/${collectionName}`) - await typesense('POST', '/collections', JSON.stringify(booksSchema)) - console.log(' created the collection from scripts/schema.ts') + await typesense('POST', '/collections', JSON.stringify(collection.schema)) + console.log(' created the collection from typesense.config.json') const result = await typesense( 'POST', @@ -120,7 +129,7 @@ async function main(): Promise { console.log(` indexed ${imported} documents`) - await ensureSearchOnlyKey(typesense) + await ensureSearchOnlyKey(typesense, collectionName) console.log('\nDone. Try searching for "hary potr".') } @@ -137,7 +146,13 @@ async function main(): Promise { * the only key the browser ever receives. */ async function ensureSearchOnlyKey( - typesense: (method: string, endpoint: string, body?: string, contentType?: string) => Promise, + typesense: ( + method: string, + endpoint: string, + body?: string, + contentType?: string, + ) => Promise, + collectionName: string, ): Promise { const configured = process.env[SEARCH_KEY_VAR] ?? '' diff --git a/templates/nextjs/template.config.js b/templates/nextjs/template.config.js index f818b3d..52bedce 100644 --- a/templates/nextjs/template.config.js +++ b/templates/nextjs/template.config.js @@ -17,6 +17,17 @@ export default { }, seedCommand: 'tsx scripts/seed.ts', files: 'files/', + // The starter's demo page styles and artwork. app/favicon.ico goes because the + // overlay's app/icon.png is the Typesense favicon, and Next.js would serve both. + remove: [ + 'app/favicon.ico', + 'app/page.module.css', + 'public/file.svg', + 'public/globe.svg', + 'public/next.svg', + 'public/vercel.svg', + 'public/window.svg', + ], devCommand: 'npm run dev', devUrl: 'http://localhost:3000', } diff --git a/test/api-key.test.ts b/test/api-key.test.ts deleted file mode 100644 index 386343b..0000000 --- a/test/api-key.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { generateAdminKey } from '../src/util/apiKey.js' - -describe('generateAdminKey', () => { - it('returns a 43-character key (256 bits of entropy, base64url)', () => { - expect(generateAdminKey()).toHaveLength(43) - }) - - it('uses only URL-safe base64 characters', () => { - for (let i = 0; i < 50; i += 1) { - expect(generateAdminKey()).toMatch(/^[A-Za-z0-9_-]+$/) - } - }) - - /** - * The key is interpolated into a compose command and an env file, so anything - * needing quoting there would break the container start in a way that is - * miserable to debug. - */ - it('never contains characters that need shell or env-file quoting', () => { - for (let i = 0; i < 50; i += 1) { - expect(generateAdminKey()).not.toMatch(/["'`$\\\s#=]/) - } - }) - - it('generates a distinct key every time', () => { - const keys = new Set(Array.from({ length: 500 }, () => generateAdminKey())) - expect(keys.size).toBe(500) - }) - - it('is not a hardcoded constant', () => { - expect(generateAdminKey()).not.toBe(generateAdminKey()) - }) -}) diff --git a/test/cli.test.ts b/test/cli.test.ts deleted file mode 100644 index c1ac1e7..0000000 --- a/test/cli.test.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { mkdtempSync, mkdirSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { describe, expect, it } from 'vitest' -import { USAGE, isInteractive, parseCliArgs } from '../src/cli.js' -import { DEFAULT_PORT, STATE_FILE } from '../src/constants.js' -import { validateProjectName, validateTargetDir } from '../src/prompts.js' - -describe('parseCliArgs', () => { - it('defaults to an interactive run with no directory', () => { - expect(parseCliArgs([])).toEqual({ - projectName: undefined, - templateId: undefined, - port: DEFAULT_PORT, - yes: false, - help: false, - version: false, - }) - }) - - it('reads a positional directory and short flags', () => { - expect(parseCliArgs(['my-app', '-t', 'nextjs', '-y'])).toMatchObject({ - projectName: 'my-app', - templateId: 'nextjs', - yes: true, - }) - }) - - it('parses --port', () => { - expect(parseCliArgs(['--port', '9108']).port).toBe(9108) - }) - - it.each([['0'], ['70000'], ['abc'], ['8108.5'], ['']])('rejects --port %s', (value) => { - expect(() => parseCliArgs(['--port', value])).toThrow(/--port must be an integer/) - }) - - it.each(['nextjs', 'qwik', 'solid', 'vanilla'])('accepts the bundled template %s', (id) => { - expect(parseCliArgs(['-t', id]).templateId).toBe(id) - }) - - it.each(['svelte', 'astro'])('rejects unknown template %s before any prompting', (id) => { - expect(() => parseCliArgs(['-t', id])).toThrow(new RegExp(`Unknown template "${id}"`)) - }) - - it('rejects an unknown flag', () => { - expect(() => parseCliArgs(['--vector-search'])).toThrow() - }) - - it('rejects more than one directory argument', () => { - expect(() => parseCliArgs(['a', 'b'])).toThrow(/at most one directory argument/) - }) -}) - -describe('isInteractive', () => { - // Regression: @clack/prompts exports isTTY as a function, so `!isTTY` is always - // false and a piped run would fall through to a prompt that can never resolve. - it('is true only for a real stdin TTY outside CI', () => { - expect(isInteractive({ isTTY: true }, false)).toBe(true) - }) - - it('is false when stdin is piped', () => { - expect(isInteractive({ isTTY: undefined }, false)).toBe(false) - expect(isInteractive({ isTTY: false }, false)).toBe(false) - }) - - it('is false in CI even with a TTY', () => { - expect(isInteractive({ isTTY: true }, true)).toBe(false) - }) -}) - -describe('validateProjectName', () => { - it.each(['my-search-app', 'app', 'my_app', 'app.v2', 'a1'])('accepts %s', (name) => { - expect(validateProjectName(name)).toBeUndefined() - }) - - it.each([ - ['', /required/], - [' ', /required/], - ['my/app', /single directory name/], - ['..', /real directory name/], - ['.hidden', /cannot start with a dot/], - ['MyApp', /lowercase/], - ['my app', /lowercase letters/], - ])('rejects %s', (name, match) => { - expect(validateProjectName(name)).toMatch(match) - }) -}) - -describe('validateTargetDir', () => { - function scratch(): string { - return mkdtempSync(path.join(tmpdir(), 'cta-test-')) - } - - it('accepts a path that does not exist', () => { - expect(validateTargetDir(path.join(scratch(), 'fresh'))).toBeUndefined() - }) - - it('accepts an empty directory', () => { - expect(validateTargetDir(scratch())).toBeUndefined() - }) - - it('accepts a directory holding only our resume state, so re-runs work', () => { - const dir = scratch() - writeFileSync(path.join(dir, STATE_FILE), '{}') - mkdirSync(path.join(dir, '.git')) - expect(validateTargetDir(dir)).toBeUndefined() - }) - - it('rejects a non-empty directory', () => { - const dir = scratch() - writeFileSync(path.join(dir, 'package.json'), '{}') - expect(validateTargetDir(dir)).toMatch(/is not empty \(1 entry\)/) - }) - - // A run that got as far as starting the container leaves these behind. Refusing - // to resume would make every failed run need a manual rm -rf. - it.each(['docker-compose.yml', '.env.local', '.env'])( - 'accepts a directory containing only our own %s, so a failed run resumes', - (generated) => { - const dir = scratch() - writeFileSync(path.join(dir, generated), '') - expect(validateTargetDir(dir)).toBeUndefined() - }, - ) - - it('accepts a directory holding the full set of our generated files', () => { - const dir = scratch() - writeFileSync(path.join(dir, 'docker-compose.yml'), '') - writeFileSync(path.join(dir, '.env.local'), '') - writeFileSync(path.join(dir, STATE_FILE), '{}') - mkdirSync(path.join(dir, 'data')) - expect(validateTargetDir(dir)).toBeUndefined() - }) - - /** - * Regression: the downloaded dataset and the copied schema land in data/, so a - * completed run leaves that directory behind and the next run refused to start. - */ - it('accepts a directory containing only the data/ directory we create', () => { - const dir = scratch() - mkdirSync(path.join(dir, 'data')) - writeFileSync(path.join(dir, 'data', 'books.jsonl'), '{}') - expect(validateTargetDir(dir)).toBeUndefined() - }) - - it("still rejects a directory with somebody else's project in it", () => { - const dir = scratch() - writeFileSync(path.join(dir, 'docker-compose.yml'), '') - writeFileSync(path.join(dir, 'index.html'), '') - expect(validateTargetDir(dir)).toMatch(/is not empty/) - }) - - it('rejects an existing file', () => { - const dir = scratch() - const file = path.join(dir, 'my-app') - writeFileSync(file, '') - expect(validateTargetDir(file)).toMatch(/is not a directory/) - }) -}) - -describe('--dataset', () => { - it('defaults to undefined, so the prompt or the default decides', () => { - expect(parseCliArgs([]).dataset).toBeUndefined() - }) - - it.each(['books', 'empty'])('accepts %s', (name) => { - expect(parseCliArgs(['--dataset', name]).dataset).toBe(name) - }) - - // The download-failure message tells the user to run this, so it must exist. - it('rejects an unknown dataset name', () => { - expect(() => parseCliArgs(['--dataset', 'movies'])).toThrow(/Unknown dataset "movies"/) - }) - - it('is advertised in the usage text', () => { - expect(USAGE).toContain('--dataset') - }) -}) diff --git a/test/compose.test.ts b/test/compose.test.ts deleted file mode 100644 index 5fdbd0e..0000000 --- a/test/compose.test.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { execa } from 'execa' -import { describe, expect, it } from 'vitest' -import { composeFileContents, writeComposeFile } from '../src/steps/compose.js' -import { ADMIN_KEY_VAR, TYPESENSE_IMAGE } from '../src/constants.js' -import { checkDocker } from '../src/util/docker.js' - -const docker = await checkDocker() - -function scratch(): string { - return mkdtempSync(path.join(tmpdir(), 'cta-compose-')) -} - -const base = { projectName: 'my-app', port: 8108, envFile: '.env.local' } - -describe('composeFileContents', () => { - it('pins the Typesense image', () => { - expect(composeFileContents(base)).toContain(TYPESENSE_IMAGE) - }) - - it('enables CORS — the single highest-value thing this file does', () => { - expect(composeFileContents(base)).toContain('--enable-cors') - }) - - it('maps the requested host port to the container port', () => { - expect(composeFileContents({ ...base, port: 9108 })).toContain('9108:8108') - }) - - /** - * Regression: the key used to be injected with `${VAR}` substitution, which - * compose resolves only from `.env`. With a template whose env file is - * `.env.local`, a plain `docker compose down` then failed to interpolate and - * teardown was impossible without an extra flag. - */ - it('needs no variable substitution, so bare docker compose commands work', () => { - expect(composeFileContents(base)).not.toContain('${') - }) - - it("declares the template's env file, which is where the key comes from", () => { - expect(composeFileContents(base)).toMatch(/env_file:\n\s+- \.env\.local/) - expect(composeFileContents({ ...base, envFile: '.env' })).toMatch(/env_file:\n\s+- \.env$/m) - }) - - it('never inlines a literal key', () => { - // A 43-char base64url run would mean a real key had been baked in. - expect(composeFileContents(base)).not.toMatch(/[A-Za-z0-9_-]{43}/) - }) - - it('names the variable Typesense itself reads, so no mapping is needed', () => { - expect(ADMIN_KEY_VAR).toBe('TYPESENSE_API_KEY') - }) - - it('stores data in a named volume so teardown can remove it', () => { - const yaml = composeFileContents(base) - expect(yaml).toMatch(/^volumes:/m) - expect(yaml).not.toMatch(/\.\/[\w-]*data:/) - }) - - it('namespaces the container by project so two projects can coexist', () => { - expect(composeFileContents({ ...base, projectName: 'alpha' })).toContain('alpha') - expect(composeFileContents({ ...base, projectName: 'beta' })).toContain('beta') - }) -}) - -describe('writeComposeFile', () => { - it('writes docker-compose.yml and returns its path', async () => { - const dir = scratch() - const written = await writeComposeFile(dir, base) - expect(written).toBe(path.join(dir, 'docker-compose.yml')) - expect(readFileSync(written, 'utf8')).toContain('--enable-cors') - }) - - it('creates the project directory if it does not exist yet', async () => { - const dir = path.join(scratch(), 'nested', 'my-app') - const written = await writeComposeFile(dir, base) - expect(readFileSync(written, 'utf8')).toContain(TYPESENSE_IMAGE) - }) - - it('is idempotent — re-running produces identical content', async () => { - const dir = scratch() - const first = await writeComposeFile(dir, base) - const before = readFileSync(first, 'utf8') - await writeComposeFile(dir, base) - expect(readFileSync(first, 'utf8')).toBe(before) - }) -}) - -/** - * The string assertions above cannot catch invalid YAML or an unknown compose - * key. Only compose itself can, so ask it. - */ -describe.skipIf(!docker.available)('docker compose config', () => { - it('accepts the generated file with no variables in the environment at all', async () => { - const dir = scratch() - await writeComposeFile(dir, base) - writeFileSync(path.join(dir, '.env.local'), `${ADMIN_KEY_VAR}=test-key\n`) - const result = await execa( - 'docker', - ['compose', '--project-directory', dir, 'config', '--quiet'], - { timeout: 30_000 }, - ) - expect(result.exitCode).toBe(0) - }) - - it('reports a clear error when the declared env file is missing', async () => { - const dir = scratch() - await writeComposeFile(dir, base) - // No .env.local written — compose should refuse rather than start keyless. - await expect( - execa('docker', ['compose', '--project-directory', dir, 'config', '--quiet'], { - timeout: 30_000, - }), - ).rejects.toThrow(/env.?file/i) - }) -}) diff --git a/test/dataset-fetch.test.ts b/test/dataset-fetch.test.ts deleted file mode 100644 index 5caf992..0000000 --- a/test/dataset-fetch.test.ts +++ /dev/null @@ -1,196 +0,0 @@ -/** - * The dataset is fetched at scaffold time rather than bundled, which means the - * CLI depends on a file it does not control. These tests cover the download, - * the caching that keeps a re-run offline-safe, and — most importantly — the - * shape check that turns upstream drift into one clear error instead of ten - * thousand import failures. - * - * A local server stands in for dl.typesense.org so the suite needs no network. - */ -import { createServer, type Server } from 'node:http' -import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs' -import type { AddressInfo } from 'node:net' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { gzipSync } from 'node:zlib' -import { afterEach, describe, expect, it } from 'vitest' -import { - assertDatasetShape, - countJsonlDocuments, - ensureDataset, -} from '../src/steps/dataset.js' - -const servers: Server[] = [] - -afterEach(async () => { - await Promise.all( - servers.splice(0).map((server) => new Promise((resolve) => server.close(() => resolve()))), - ) -}) - -/** One record with the same fields the real dataset carries. */ -function record(id: number, title: string): string { - return JSON.stringify({ - id: String(id), - title, - authors: ['A. Writer'], - publication_year: 1997, - average_rating: 4.4, - image_url: 'https://example.com/cover.jpg', - ratings_count: 1000 + id, - }) -} - -const SAMPLE = [ - record(1, "Harry Potter and the Philosopher's Stone"), - record(2, 'The Hobbit'), - record(3, 'Dune'), -].join('\n') - -const REQUIRED = [ - 'title', - 'authors', - 'publication_year', - 'average_rating', - 'image_url', - 'ratings_count', -] - -/** Serves a body, gzipped or not, so both the happy and broken paths are real. */ -async function serve( - body: Buffer | string, - { status = 200 }: { status?: number } = {}, -): Promise { - const payload = typeof body === 'string' ? Buffer.from(body) : body - const server = createServer((_request, response) => { - response.writeHead(status, { - 'content-type': 'application/x-gzip', - 'content-length': String(payload.byteLength), - }) - response.end(payload) - }) - servers.push(server) - await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)) - const { port } = server.address() as AddressInfo - return `http://127.0.0.1:${port}/books.jsonl.gz` -} - -function scratch(): string { - return path.join(tmpdir(), `cta-ds-${Math.random().toString(36).slice(2)}`, 'my-app') -} - -describe('countJsonlDocuments', () => { - it('counts one document per line', () => { - expect(countJsonlDocuments(SAMPLE)).toBe(3) - }) - - it('ignores blank lines and a trailing newline', () => { - expect(countJsonlDocuments(`${SAMPLE}\n\n`)).toBe(3) - }) - - it('counts nothing in empty text', () => { - expect(countJsonlDocuments('')).toBe(0) - }) -}) - -describe('assertDatasetShape', () => { - it('accepts a record carrying every required field', () => { - expect(() => assertDatasetShape(SAMPLE, REQUIRED)).not.toThrow() - }) - - /** The point of the check: upstream drops or renames a field. */ - it('names the missing field when the upstream data changes', () => { - const withoutRatings = JSON.stringify({ id: '1', title: 'X', authors: ['Y'] }) - expect(() => assertDatasetShape(withoutRatings, REQUIRED)).toThrow(/ratings_count/) - }) - - it('rejects HTML served in place of the dataset', () => { - expect(() => assertDatasetShape('404', REQUIRED)).toThrow( - /could not be read|not valid/i, - ) - }) - - it('rejects an empty payload', () => { - expect(() => assertDatasetShape('', REQUIRED)).toThrow(/empty/i) - }) -}) - -describe('ensureDataset', () => { - it('downloads, decompresses and writes the JSONL into the project', async () => { - const dir = scratch() - const url = await serve(gzipSync(Buffer.from(SAMPLE))) - - const result = await ensureDataset(dir, { url }) - - expect(result.downloaded).toBe(true) - expect(result.documents).toBe(3) - expect(result.path).toBe(path.join(dir, 'data', 'books.jsonl')) - expect(readFileSync(result.path, 'utf8')).toContain('Harry Potter') - }) - - it('reports the compressed size actually transferred', async () => { - const compressed = gzipSync(Buffer.from(SAMPLE)) - const result = await ensureDataset(scratch(), { url: await serve(compressed) }) - expect(result.bytes).toBe(compressed.byteLength) - }) - - /** So a re-run works offline and does not re-download 476 KB every time. */ - it('reuses an existing copy without touching the network', async () => { - const dir = scratch() - mkdirSync(path.join(dir, 'data'), { recursive: true }) - writeFileSync(path.join(dir, 'data', 'books.jsonl'), SAMPLE) - - // An unreachable URL proves no request is made. - const result = await ensureDataset(dir, { url: 'http://127.0.0.1:1/nope.gz' }) - - expect(result.downloaded).toBe(false) - expect(result.bytes).toBe(0) - expect(result.documents).toBe(3) - }) - - it('re-downloads when the cached copy is empty rather than trusting it', async () => { - const dir = scratch() - mkdirSync(path.join(dir, 'data'), { recursive: true }) - writeFileSync(path.join(dir, 'data', 'books.jsonl'), '') - - const result = await ensureDataset(dir, { url: await serve(gzipSync(Buffer.from(SAMPLE))) }) - expect(result.downloaded).toBe(true) - expect(result.documents).toBe(3) - }) - - it('reports progress so a slow connection does not look like a hang', async () => { - const messages: string[] = [] - await ensureDataset(scratch(), { - url: await serve(gzipSync(Buffer.from(SAMPLE))), - onProgress: (message) => messages.push(message), - }) - expect(messages.length).toBeGreaterThan(0) - expect(messages.join(' ')).toMatch(/download/i) - }) - - it('gives an actionable error when the download fails', async () => { - await expect( - ensureDataset(scratch(), { url: 'http://127.0.0.1:1/unreachable.gz' }), - ).rejects.toThrow(/could not download|--dataset empty|dl\.typesense\.org|manually/i) - }) - - it('gives an actionable error on a non-200 response', async () => { - const url = await serve(gzipSync(Buffer.from(SAMPLE)), { status: 404 }) - await expect(ensureDataset(scratch(), { url })).rejects.toThrow(/404/) - }) - - it('reports a clear error when the payload is not gzip', async () => { - const url = await serve('this is not gzipped at all') - await expect(ensureDataset(scratch(), { url })).rejects.toThrow(/decompress|gzip/i) - }) - - it('refuses to write a dataset missing the fields the schema needs', async () => { - const wrong = JSON.stringify({ id: '1', title: 'Only a title' }) - const dir = scratch() - await expect( - ensureDataset(dir, { url: await serve(gzipSync(Buffer.from(wrong))) }), - ).rejects.toThrow(/ratings_count|authors/) - // Nothing half-written left behind. - expect(existsSync(path.join(dir, 'data', 'books.jsonl'))).toBe(false) - }) -}) diff --git a/test/dataset.test.ts b/test/dataset.test.ts deleted file mode 100644 index 0380f9c..0000000 --- a/test/dataset.test.ts +++ /dev/null @@ -1,89 +0,0 @@ -/** - * The schema is the one shipped asset the demo rests on; the data is fetched from - * dl.typesense.org at scaffold time. So this file checks the schema locally, and - * checks the live dataset still fits it in a test that skips without a network. - */ -import { readFileSync } from 'node:fs' -import path from 'node:path' -import { describe, expect, it } from 'vitest' -import { COLLECTION_NAME, DEMO_FACET_BY, DEMO_QUERY_BY } from '../src/constants.js' -import { dataDir } from '../src/paths.js' -import { - BOOKS_DATASET_URL, - REQUIRED_DATASET_FIELDS, - assertDatasetShape, - countJsonlDocuments, -} from '../src/steps/dataset.js' - -interface SchemaField { - name: string - type: string - facet?: boolean - optional?: boolean -} - -const schema = JSON.parse(readFileSync(path.join(dataDir, 'books.schema.json'), 'utf8')) as { - name: string - fields: SchemaField[] - default_sorting_field?: string -} - -const fieldNames = schema.fields.map((field) => field.name) - -describe('books.schema.json', () => { - it('names the collection the CLI expects', () => { - expect(schema.name).toBe(COLLECTION_NAME) - }) - - it('makes title searchable as a string', () => { - expect(schema.fields.find((field) => field.name === 'title')?.type).toBe('string') - }) - - it('declares every field the demo query searches', () => { - for (const field of DEMO_QUERY_BY.split(',')) { - expect(fieldNames).toContain(field) - } - }) - - it('makes the demo facet field facetable', () => { - expect(schema.fields.find((field) => field.name === DEMO_FACET_BY)?.facet).toBe(true) - }) - - /** This is what breaks the "hary potr" tie toward the best-known book. */ - it('sorts by popularity, so typo matches rank sensibly', () => { - expect(schema.default_sorting_field).toBe('ratings_count') - const field = schema.fields.find((f) => f.name === schema.default_sorting_field) - expect(['int32', 'int64', 'float']).toContain(field?.type) - }) - - it('requires exactly the fields the downloader validates', () => { - const required = schema.fields - .filter((field) => field.optional !== true) - .map((field) => field.name) - expect([...required].sort()).toEqual([...REQUIRED_DATASET_FIELDS].sort()) - }) -}) - -/** - * Guards against upstream drift in a file we do not control. Skipped rather than - * failed when offline, so the suite stays runnable on a plane. - */ -const online = await fetch(BOOKS_DATASET_URL, { method: 'HEAD' }) - .then((response) => response.ok) - .catch(() => false) - -describe.skipIf(!online)('the live dataset at dl.typesense.org', () => { - it( - 'still carries every field the schema indexes', - async () => { - const { gunzipSync } = await import('node:zlib') - const response = await fetch(BOOKS_DATASET_URL) - const jsonl = gunzipSync(Buffer.from(await response.arrayBuffer())).toString('utf8') - - expect(() => assertDatasetShape(jsonl, REQUIRED_DATASET_FIELDS)).not.toThrow() - expect(countJsonlDocuments(jsonl)).toBeGreaterThan(5_000) - expect(jsonl).toContain('Harry Potter') - }, - 120_000, - ) -}) diff --git a/test/docker-pull.integration.test.ts b/test/docker-pull.integration.test.ts deleted file mode 100644 index 67240be..0000000 --- a/test/docker-pull.integration.test.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Exercises the pull path against a real Docker, using a tiny throwaway image so - * it costs a fraction of a second and never touches the Typesense image the rest - * of the suite relies on. - */ -import { mkdtempSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { execa } from 'execa' -import { afterAll, describe, expect, it } from 'vitest' -import { - checkDocker, - composeImages, - composePull, - imageExists, - missingImages, -} from '../src/util/docker.js' -import { createPullTracker } from '../src/util/pullProgress.js' - -const docker = await checkDocker() - -// Tiny (a few kB) and unrelated to anything else the suite uses. -const TINY_IMAGE = 'hello-world:linux' - -function composeDir(image: string): string { - const dir = mkdtempSync(path.join(tmpdir(), 'cta-pull-')) - writeFileSync( - path.join(dir, 'docker-compose.yml'), - `services:\n probe:\n image: ${image}\n`, - ) - return dir -} - -afterAll(async () => { - if (docker.available) { - await execa('docker', ['rmi', TINY_IMAGE], { reject: false }).catch(() => undefined) - } -}) - -describe.skipIf(!docker.available)('image detection', () => { - it('reads the images straight out of the compose file', async () => { - expect(await composeImages(composeDir('typesense/typesense:30.2'))).toEqual([ - 'typesense/typesense:30.2', - ]) - }) - - it('reports a nonexistent image as absent rather than throwing', async () => { - expect(await imageExists('cta-does-not-exist/nope:1')).toBe(false) - }) - - it( - 'lists nothing missing when the image is already cached', - async () => { - await execa('docker', ['pull', TINY_IMAGE], { timeout: 120_000 }) - expect(await missingImages(composeDir(TINY_IMAGE))).toEqual([]) - expect(await imageExists(TINY_IMAGE)).toBe(true) - }, - 150_000, - ) - - it( - 'lists the image as missing once it is not cached', - async () => { - await execa('docker', ['rmi', TINY_IMAGE], { reject: false }) - expect(await missingImages(composeDir(TINY_IMAGE))).toEqual([TINY_IMAGE]) - }, - 60_000, - ) -}) - -describe.skipIf(!docker.available)('composePull', () => { - it( - 'streams progress lines that the tracker understands, and finishes', - async () => { - await execa('docker', ['rmi', TINY_IMAGE], { reject: false }) - // A warm pull emits only the two `Image ... Pulling/Pulled` lines and no - // layer lines, so the layer assertion below is only meaningful cold. - expect(await imageExists(TINY_IMAGE)).toBe(false) - - const dir = composeDir(TINY_IMAGE) - const tracker = createPullTracker() - const descriptions: string[] = [] - await composePull(dir, (line) => { - if (tracker.ingest(line)) descriptions.push(tracker.describe(TINY_IMAGE)) - }) - - // Something was reported, the tracker parsed it, and the image is now here. - expect(descriptions.length).toBeGreaterThan(0) - expect(tracker.snapshot().layers).toBeGreaterThan(0) - expect(tracker.snapshot().done).toBe(true) - expect(await imageExists(TINY_IMAGE)).toBe(true) - expect(await missingImages(dir)).toEqual([]) - }, - 180_000, - ) - - it('fails with a readable error for an image that does not exist', async () => { - const dir = composeDir('cta-does-not-exist/nope:1') - await expect(composePull(dir)).rejects.toThrow(/pull/i) - }, 120_000) -}) diff --git a/test/env-keys.test.ts b/test/env-keys.test.ts deleted file mode 100644 index 2c5c837..0000000 --- a/test/env-keys.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * The hard rule from CLAUDE.md, as a test. - * - * The env *file writer* arrives in M2. What can already be locked down is the - * classification it will be driven by: which variables are browser-visible and - * which are not. If those two lists ever overlap, the whole project is a security - * anti-pattern (PLAN.md §6), so the assertion lives here from M0 onward. - */ -import { describe, expect, it } from 'vitest' -import { - ADMIN_KEY_VAR, - PRIVATE_ENV_VARS, - PUBLIC_ENV_VARS, - SEARCH_KEY_VAR, -} from '../src/constants.js' -import { assertAdminKeyNeverPublic } from '../src/summary.js' -import { loadTemplates } from '../src/templates.js' - -describe('admin key exposure', () => { - it('never lists the admin key as browser-visible', () => { - expect(PUBLIC_ENV_VARS).not.toContain(ADMIN_KEY_VAR) - }) - - it('keeps the public and private sets disjoint', () => { - const overlap = PUBLIC_ENV_VARS.filter((name) => - (PRIVATE_ENV_VARS as readonly string[]).includes(name), - ) - expect(overlap).toEqual([]) - }) - - it('exposes the search-only key and nothing else secret', () => { - expect(PUBLIC_ENV_VARS).toContain(SEARCH_KEY_VAR) - const secrets = PUBLIC_ENV_VARS.filter( - (name) => /KEY/.test(name) && name !== SEARCH_KEY_VAR, - ) - expect(secrets).toEqual([]) - }) - - it('passes the runtime guard for every template prefix', async () => { - for (const template of await loadTemplates()) { - expect(() => assertAdminKeyNeverPublic(template.env.publicPrefix)).not.toThrow() - } - }) - - it('would produce no prefixed admin variable for any template', async () => { - for (const template of await loadTemplates()) { - const prefixed = PUBLIC_ENV_VARS.map((name) => `${template.env.publicPrefix}${name}`) - expect(prefixed).not.toContain(`${template.env.publicPrefix}${ADMIN_KEY_VAR}`) - for (const name of prefixed) { - expect(name).not.toMatch(/ADMIN/) - } - } - }) -}) diff --git a/test/env.test.ts b/test/env.test.ts deleted file mode 100644 index 44deaa2..0000000 --- a/test/env.test.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { describe, expect, it } from 'vitest' -import { - connectionEnvValues, - envVarName, - parseEnvContents, - readEnvFile, - upsertEnvContents, - writeEnvFile, -} from '../src/steps/env.js' -import { ADMIN_KEY_VAR, HOST_VAR, PUBLIC_ENV_VARS, SEARCH_KEY_VAR } from '../src/constants.js' - -function scratch(): string { - return mkdtempSync(path.join(tmpdir(), 'cta-env-')) -} - -describe('envVarName', () => { - // THE hard rule. Publicness is looked up, not passed in, so a caller cannot - // mark the admin key browser-visible by mistake. - it.each(['NEXT_PUBLIC_', 'PUBLIC_'])('never prefixes the admin key with %s', (prefix) => { - expect(envVarName(ADMIN_KEY_VAR, prefix)).toBe(ADMIN_KEY_VAR) - }) - - it('prefixes the search-only key', () => { - expect(envVarName(SEARCH_KEY_VAR, 'NEXT_PUBLIC_')).toBe(`NEXT_PUBLIC_${SEARCH_KEY_VAR}`) - expect(envVarName(SEARCH_KEY_VAR, 'PUBLIC_')).toBe(`PUBLIC_${SEARCH_KEY_VAR}`) - }) - - it('prefixes the non-secret connection details', () => { - expect(envVarName(HOST_VAR, 'PUBLIC_')).toBe(`PUBLIC_${HOST_VAR}`) - }) - - it('rejects a name that is on neither list, rather than guessing', () => { - expect(() => envVarName('TYPESENSE_MYSTERY', 'PUBLIC_')).toThrow(/TYPESENSE_MYSTERY/) - }) -}) - -describe('upsertEnvContents', () => { - it('writes a new variable into empty content', () => { - const result = upsertEnvContents('', { [ADMIN_KEY_VAR]: 'abc123' }, 'NEXT_PUBLIC_') - expect(result).toContain(`${ADMIN_KEY_VAR}=abc123`) - }) - - it('replaces an existing value instead of appending a duplicate', () => { - const existing = `${ADMIN_KEY_VAR}=old\n` - const result = upsertEnvContents(existing, { [ADMIN_KEY_VAR]: 'new' }, 'NEXT_PUBLIC_') - expect(result).toContain(`${ADMIN_KEY_VAR}=new`) - expect(result).not.toContain('old') - expect(result.match(new RegExp(`^${ADMIN_KEY_VAR}=`, 'gm'))).toHaveLength(1) - }) - - it("preserves lines it does not own, including the framework's own vars", () => { - const existing = '# my notes\nSOME_OTHER_VAR=keep-me\n' - const result = upsertEnvContents(existing, { [ADMIN_KEY_VAR]: 'abc' }, 'NEXT_PUBLIC_') - expect(result).toContain('# my notes') - expect(result).toContain('SOME_OTHER_VAR=keep-me') - }) - - it('is idempotent — applying twice equals applying once', () => { - const once = upsertEnvContents('', { [ADMIN_KEY_VAR]: 'abc' }, 'NEXT_PUBLIC_') - const twice = upsertEnvContents(once, { [ADMIN_KEY_VAR]: 'abc' }, 'NEXT_PUBLIC_') - expect(twice).toBe(once) - }) - - it('does not confuse a prefixed variable with its unprefixed namesake', () => { - const result = upsertEnvContents( - '', - { [ADMIN_KEY_VAR]: 'secret', [SEARCH_KEY_VAR]: 'public' }, - 'NEXT_PUBLIC_', - ) - expect(result).toMatch(new RegExp(`^${ADMIN_KEY_VAR}=secret$`, 'm')) - expect(result).toMatch(new RegExp(`^NEXT_PUBLIC_${SEARCH_KEY_VAR}=public$`, 'm')) - expect(result).not.toMatch(new RegExp(`^${SEARCH_KEY_VAR}=`, 'm')) - }) - - it('refuses a value containing a newline, which would inject another variable', () => { - expect(() => - upsertEnvContents('', { [ADMIN_KEY_VAR]: `abc\nNEXT_PUBLIC_${ADMIN_KEY_VAR}=leaked` }, 'NEXT_PUBLIC_'), - ).toThrow(/newline/i) - }) - - it('ends with a single trailing newline', () => { - const result = upsertEnvContents('', { [ADMIN_KEY_VAR]: 'abc' }, 'NEXT_PUBLIC_') - expect(result.endsWith('\n')).toBe(true) - expect(result.endsWith('\n\n')).toBe(false) - }) -}) - -describe('writeEnvFile', () => { - it('creates the file, and the admin key lands unprefixed', async () => { - const file = path.join(scratch(), '.env.local') - await writeEnvFile(file, { [ADMIN_KEY_VAR]: 'abc123' }, 'NEXT_PUBLIC_') - const contents = readFileSync(file, 'utf8') - expect(contents).toMatch(new RegExp(`^${ADMIN_KEY_VAR}=abc123$`, 'm')) - expect(contents).not.toContain(`NEXT_PUBLIC_${ADMIN_KEY_VAR}`) - }) - - it('updates an existing file in place without losing its other contents', async () => { - const file = path.join(scratch(), '.env') - writeFileSync(file, 'EXISTING=1\n') - await writeEnvFile(file, { [ADMIN_KEY_VAR]: 'abc' }, 'PUBLIC_') - const contents = readFileSync(file, 'utf8') - expect(contents).toContain('EXISTING=1') - expect(contents).toContain(`${ADMIN_KEY_VAR}=abc`) - }) - - it('creates missing parent directories', async () => { - const file = path.join(scratch(), 'deep', 'my-app', '.env.local') - await writeEnvFile(file, { [ADMIN_KEY_VAR]: 'abc' }, 'NEXT_PUBLIC_') - expect(readFileSync(file, 'utf8')).toContain(ADMIN_KEY_VAR) - }) -}) - -describe('parseEnvContents', () => { - it('reads a simple assignment', () => { - expect(parseEnvContents(`${ADMIN_KEY_VAR}=abc\n`)).toEqual({ [ADMIN_KEY_VAR]: 'abc' }) - }) - - it('ignores comments and blank lines', () => { - expect(parseEnvContents(`# a comment\n\n${ADMIN_KEY_VAR}=abc\n`)).toEqual({ - [ADMIN_KEY_VAR]: 'abc', - }) - }) - - it('tolerates an export prefix and surrounding whitespace', () => { - expect(parseEnvContents(` export ${ADMIN_KEY_VAR}=abc \n`)).toEqual({ - [ADMIN_KEY_VAR]: 'abc', - }) - }) - - it('keeps prefixed and unprefixed variables separate', () => { - const parsed = parseEnvContents(`${ADMIN_KEY_VAR}=secret\nNEXT_PUBLIC_${SEARCH_KEY_VAR}=pub\n`) - expect(parsed[ADMIN_KEY_VAR]).toBe('secret') - expect(parsed[`NEXT_PUBLIC_${SEARCH_KEY_VAR}`]).toBe('pub') - }) - - it('returns an empty object for empty content', () => { - expect(parseEnvContents('')).toEqual({}) - }) - - it('round-trips what upsertEnvContents writes', () => { - const written = upsertEnvContents('', { [ADMIN_KEY_VAR]: 'abc123' }, 'NEXT_PUBLIC_') - expect(parseEnvContents(written)[ADMIN_KEY_VAR]).toBe('abc123') - }) -}) - -describe('readEnvFile', () => { - it('returns an empty object when the file does not exist yet', async () => { - expect(await readEnvFile(path.join(scratch(), 'nope.env'))).toEqual({}) - }) - - it('reads back what writeEnvFile wrote', async () => { - const file = path.join(scratch(), '.env.local') - await writeEnvFile(file, { [ADMIN_KEY_VAR]: 'abc' }, 'NEXT_PUBLIC_') - expect((await readEnvFile(file))[ADMIN_KEY_VAR]).toBe('abc') - }) -}) - -describe('connectionEnvValues', () => { - it('splits a local URL into host, port and protocol', () => { - expect(connectionEnvValues('http://127.0.0.1:8108', 'books', 'search-key')).toEqual({ - TYPESENSE_HOST: '127.0.0.1', - TYPESENSE_PORT: '8108', - TYPESENSE_PROTOCOL: 'http', - TYPESENSE_COLLECTION: 'books', - TYPESENSE_SEARCH_ONLY_API_KEY: 'search-key', - }) - }) - - it('fills in 443 for an https URL with no explicit port', () => { - const values = connectionEnvValues('https://abc.a1.typesense.net', 'books', 'k') - expect(values).toMatchObject({ - TYPESENSE_HOST: 'abc.a1.typesense.net', - TYPESENSE_PORT: '443', - TYPESENSE_PROTOCOL: 'https', - }) - }) - - it('fills in 80 for a bare http URL', () => { - expect(connectionEnvValues('http://localhost', 'books', 'k').TYPESENSE_PORT).toBe('80') - }) - - it('keeps an explicit non-default port', () => { - expect(connectionEnvValues('https://example.com:9443', 'books', 'k').TYPESENSE_PORT).toBe('9443') - }) - - it('never emits the admin key', () => { - const values = connectionEnvValues('http://127.0.0.1:8108', 'books', 'search-key') - expect(Object.keys(values)).not.toContain(ADMIN_KEY_VAR) - }) - - it('emits only names the public list knows, so every one gets prefixed', () => { - const values = connectionEnvValues('http://127.0.0.1:8108', 'books', 'k') - for (const name of Object.keys(values)) { - expect(PUBLIC_ENV_VARS).toContain(name) - } - }) - - it('round-trips through the writer with every value prefixed', () => { - const values = connectionEnvValues('http://127.0.0.1:8108', 'books', 'search-key') - const contents = upsertEnvContents('', values, 'NEXT_PUBLIC_') - for (const name of Object.keys(values)) { - expect(contents).toMatch(new RegExp(`^NEXT_PUBLIC_${name}=`, 'm')) - } - }) - - it('rejects a URL it cannot parse rather than writing rubbish', () => { - expect(() => connectionEnvValues('not-a-url', 'books', 'k')).toThrow() - }) -}) diff --git a/test/errors.test.ts b/test/errors.test.ts deleted file mode 100644 index d1c7d6f..0000000 --- a/test/errors.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * First-run failures worth explaining. Anyone who already runs Typesense on 8108 - * hits the port clash immediately, and docker's own wording ("driver failed - * programming external connectivity on endpoint ... Bind for 0.0.0.0:8108 - * failed") gives them nothing to act on. - */ -import { describe, expect, it } from 'vitest' -import { describeStartFailure } from '../src/steps/server.js' - -const REAL_DOCKER_ERROR = `\`docker compose up --detach\` failed: -Network my-app_default Creating -Network my-app_default Created -Container my-app-typesense Creating -Container my-app-typesense Starting -Error response from daemon: failed to set up container networking: driver failed programming external connectivity on endpoint my-app-typesense (a37d49a0): Bind for 0.0.0.0:8108 failed: port is already allocated` - -describe('describeStartFailure', () => { - it('recognises a port clash and says what to do about it', () => { - const message = describeStartFailure(REAL_DOCKER_ERROR, 8108) - expect(message).toMatch(/8108 is already in use/i) - expect(message).toContain('--port') - }) - - it('names the port that was actually requested', () => { - expect(describeStartFailure(REAL_DOCKER_ERROR.replace(/8108/g, '9108'), 9108)).toContain('9108') - }) - - it.each([ - 'Bind for 0.0.0.0:8108 failed: port is already allocated', - 'listen tcp 0.0.0.0:8108: bind: address already in use', - 'Ports are not available: exposing port TCP 0.0.0.0:8108 -> 127.0.0.1:0', - ])('recognises the clash from docker phrasing: %s', (stderr) => { - expect(describeStartFailure(stderr, 8108)).toMatch(/already in use/i) - }) - - it('mentions an existing Typesense as the likely cause', () => { - expect(describeStartFailure(REAL_DOCKER_ERROR, 8108)).toMatch(/already have one running|Typesense/i) - }) - - it('passes anything it does not recognise through untouched', () => { - const other = '`docker compose up --detach` failed:\nno space left on device' - expect(describeStartFailure(other, 8108)).toBe(other) - }) - - it('keeps the original docker output available for diagnosis', () => { - expect(describeStartFailure(REAL_DOCKER_ERROR, 8108)).toContain('port is already allocated') - }) -}) diff --git a/test/health.test.ts b/test/health.test.ts deleted file mode 100644 index c3baf4a..0000000 --- a/test/health.test.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { createServer, type Server } from 'node:http' -import type { AddressInfo } from 'node:net' -import { afterEach, describe, expect, it } from 'vitest' -import { waitForHealth } from '../src/steps/server.js' - -const servers: Server[] = [] - -afterEach(async () => { - await Promise.all( - servers.splice(0).map((server) => new Promise((resolve) => server.close(() => resolve()))), - ) -}) - -/** Serves /health with a caller-controlled body, so polling can be tested for real. */ -async function startFakeTypesense( - handler: (hit: number) => { status: number; body: string }, -): Promise<{ baseUrl: string; hits: () => number }> { - let hits = 0 - const server = createServer((request, response) => { - if (request.url !== '/health') { - response.writeHead(404).end() - return - } - hits += 1 - const { status, body } = handler(hits) - response.writeHead(status, { 'content-type': 'application/json' }).end(body) - }) - servers.push(server) - await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)) - const { port } = server.address() as AddressInfo - return { baseUrl: `http://127.0.0.1:${port}`, hits: () => hits } -} - -/** A port nothing is listening on. */ -async function unusedBaseUrl(): Promise { - const server = createServer() - await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)) - const { port } = server.address() as AddressInfo - await new Promise((resolve) => server.close(() => resolve())) - return `http://127.0.0.1:${port}` -} - -describe('waitForHealth', () => { - it('resolves as soon as /health reports ok', async () => { - const fake = await startFakeTypesense(() => ({ status: 200, body: '{"ok":true}' })) - await expect(waitForHealth(fake.baseUrl, { timeoutMs: 2_000 })).resolves.toBeUndefined() - expect(fake.hits()).toBe(1) - }) - - it('keeps polling while the server is still coming up', async () => { - const fake = await startFakeTypesense((hit) => - hit < 3 ? { status: 503, body: '{"ok":false}' } : { status: 200, body: '{"ok":true}' }, - ) - await waitForHealth(fake.baseUrl, { timeoutMs: 5_000, intervalMs: 20 }) - expect(fake.hits()).toBe(3) - }) - - it('does not treat ok:false as healthy', async () => { - const fake = await startFakeTypesense(() => ({ status: 200, body: '{"ok":false}' })) - await expect( - waitForHealth(fake.baseUrl, { timeoutMs: 200, intervalMs: 20 }), - ).rejects.toThrow() - expect(fake.hits()).toBeGreaterThan(1) - }) - - it('times out with an actionable message instead of hanging', async () => { - const baseUrl = await unusedBaseUrl() - await expect(waitForHealth(baseUrl, { timeoutMs: 300, intervalMs: 50 })).rejects.toThrow( - /docker compose logs/, - ) - }) - - it('names the URL it gave up on', async () => { - const baseUrl = await unusedBaseUrl() - await expect(waitForHealth(baseUrl, { timeoutMs: 200, intervalMs: 50 })).rejects.toThrow( - new RegExp(baseUrl.replace(/[.]/g, '\\.')), - ) - }) - - it('survives malformed JSON from a half-started server', async () => { - const fake = await startFakeTypesense((hit) => - hit < 2 ? { status: 200, body: 'nope' } : { status: 200, body: '{"ok":true}' }, - ) - await expect( - waitForHealth(fake.baseUrl, { timeoutMs: 5_000, intervalMs: 20 }), - ).resolves.toBeUndefined() - expect(fake.hits()).toBe(2) - }) -}) diff --git a/test/keys.test.ts b/test/keys.test.ts deleted file mode 100644 index 7540c59..0000000 --- a/test/keys.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * The scoping of the browser-visible key is the differentiator this whole project - * exists for, so the spec it sends to Typesense is asserted directly. - */ -import { describe, expect, it } from 'vitest' -import { COLLECTION_NAME } from '../src/constants.js' -import { SEARCH_KEY_DESCRIPTION, searchOnlyKeySpec } from '../src/steps/keys.js' - -describe('searchOnlyKeySpec', () => { - const spec = searchOnlyKeySpec(COLLECTION_NAME) - - it('grants document search and nothing else', () => { - expect(spec.actions).toEqual(['documents:search']) - }) - - it('is scoped to the one collection, not to *', () => { - expect(spec.collections).toEqual([COLLECTION_NAME]) - expect(spec.collections).not.toContain('*') - }) - - it('grants no write, no key management, no collection administration', () => { - const forbidden = [ - 'documents:create', - 'documents:upsert', - 'documents:update', - 'documents:delete', - 'documents:import', - 'documents:*', - 'collections:create', - 'collections:delete', - 'collections:*', - 'keys:create', - 'keys:*', - '*', - ] - for (const action of forbidden) { - expect(spec.actions).not.toContain(action) - } - }) - - it('is tagged so re-runs can find and replace it', () => { - expect(spec.description).toBe(SEARCH_KEY_DESCRIPTION) - }) - - it('scopes to whatever collection it is given', () => { - expect(searchOnlyKeySpec('movies').collections).toEqual(['movies']) - }) -}) diff --git a/test/provision.test.ts b/test/provision.test.ts deleted file mode 100644 index c69e70d..0000000 --- a/test/provision.test.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { createServer, type Server } from 'node:http' -import { existsSync, mkdtempSync, readFileSync } from 'node:fs' -import type { AddressInfo } from 'node:net' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { afterEach, describe, expect, it } from 'vitest' -import { ADMIN_KEY_VAR } from '../src/constants.js' -import type { ProjectConfig } from '../src/config.js' -import { COMPOSE_FILE } from '../src/steps/compose.js' -import { writeEnvFile } from '../src/steps/env.js' -import { provisionServer, serverBaseUrl } from '../src/steps/provision.js' -import { loadTemplate } from '../src/templates.js' - -const servers: Server[] = [] - -afterEach(async () => { - await Promise.all( - servers.splice(0).map((server) => new Promise((resolve) => server.close(() => resolve()))), - ) -}) - -/** Stands in for a Typesense the user already has running. */ -async function healthyServer(): Promise { - const server = createServer((request, response) => { - if (request.url === '/health') { - response.writeHead(200, { 'content-type': 'application/json' }).end('{"ok":true}') - return - } - response.writeHead(404).end() - }) - servers.push(server) - await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)) - const { port } = server.address() as AddressInfo - return `http://127.0.0.1:${port}` -} - -async function byoConfig(url: string, adminKey = 'their-own-key'): Promise { - const targetDir = path.join(mkdtempSync(path.join(tmpdir(), 'cta-prov-')), 'my-app') - return { - projectName: 'my-app', - targetDir, - template: await loadTemplate('nextjs'), - server: { kind: 'byo', flavour: 'existing', url, adminKey }, - dataset: 'books', - } -} - -describe('serverBaseUrl', () => { - it('points at the mapped host port for a Docker server', () => { - expect(serverBaseUrl({ kind: 'docker', port: 9108 })).toBe('http://127.0.0.1:9108') - }) - - it('uses the URL as given for a server the user brought', () => { - expect( - serverBaseUrl({ - kind: 'byo', - flavour: 'cloud', - url: 'https://abc.a1.typesense.net', - adminKey: 'k', - }), - ).toBe('https://abc.a1.typesense.net') - }) -}) - -describe('provisionServer with a server the user brought', () => { - it('writes no compose file — it is not our container to manage', async () => { - const config = await byoConfig(await healthyServer()) - const result = await provisionServer(config) - expect(result.composeFile).toBeUndefined() - expect(existsSync(path.join(config.targetDir, COMPOSE_FILE))).toBe(false) - }) - - it('keeps the admin key the user supplied instead of generating one', async () => { - const config = await byoConfig(await healthyServer(), 'supplied-key') - const result = await provisionServer(config) - expect(result.adminKey).toBe('supplied-key') - }) - - it('records the key in the env file, unprefixed', async () => { - const config = await byoConfig(await healthyServer(), 'supplied-key') - const result = await provisionServer(config) - const contents = readFileSync(result.envFile, 'utf8') - expect(contents).toMatch(new RegExp(`^${ADMIN_KEY_VAR}=supplied-key$`, 'm')) - expect(contents).not.toContain(`NEXT_PUBLIC_${ADMIN_KEY_VAR}`) - }) - - it("uses the template's env file name", async () => { - const config = await byoConfig(await healthyServer()) - const result = await provisionServer(config) - expect(path.basename(result.envFile)).toBe('.env.local') - }) - - it('fails with an actionable error when their server is unreachable', async () => { - const config = await byoConfig('http://127.0.0.1:1') - await expect( - provisionServer(config, { health: { timeoutMs: 300, intervalMs: 50 } }), - ).rejects.toThrow(/did not become healthy/) - }) - - it('reuses an admin key already present from an earlier run', async () => { - const config = await byoConfig(await healthyServer(), 'supplied-key') - await writeEnvFile( - path.join(config.targetDir, '.env.local'), - { [ADMIN_KEY_VAR]: 'from-earlier-run' }, - 'NEXT_PUBLIC_', - ) - const result = await provisionServer(config) - expect(result.adminKey).toBe('from-earlier-run') - expect(result.reusedAdminKey).toBe(true) - }) - - it('reports its progress so the CLI can show steps', async () => { - const config = await byoConfig(await healthyServer()) - const steps: string[] = [] - await provisionServer(config, { onStep: (message) => steps.push(message) }) - expect(steps.length).toBeGreaterThan(0) - expect(steps.join('\n')).toMatch(/health|Health/) - }) -}) diff --git a/test/pull-progress.test.ts b/test/pull-progress.test.ts deleted file mode 100644 index 7dc628b..0000000 --- a/test/pull-progress.test.ts +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Lines below are copied verbatim from a real `docker compose pull` of - * typesense/typesense:30.2 with output piped (not a TTY), which is how the CLI - * will always see it. - */ -import { describe, expect, it } from 'vitest' -import { createPullTracker, humanBytes } from '../src/util/pullProgress.js' - -const IMAGE = 'typesense/typesense:30.2' - -describe('humanBytes', () => { - it.each([ - [0, '0 MB'], - [1_049_000, '1 MB'], - [45_600_000, '46 MB'], - [1_500_000_000, '1.5 GB'], - ])('renders %i as %s', (bytes, expected) => { - expect(humanBytes(bytes)).toBe(expected) - }) -}) - -describe('createPullTracker', () => { - it('starts empty', () => { - expect(createPullTracker().snapshot()).toEqual({ - layers: 0, - completed: 0, - downloadedBytes: 0, - done: false, - }) - }) - - it('counts each layer once, even when docker repeats the line', () => { - const tracker = createPullTracker() - tracker.ingest(' 6ff5bb9c14a0 Pulling fs layer 0B') - tracker.ingest(' 6edbc812af48 Pulling fs layer 0B') - tracker.ingest(' 6ff5bb9c14a0 Pulling fs layer 0B') - expect(tracker.snapshot().layers).toBe(2) - }) - - it('sums the latest downloaded bytes per layer, not every update', () => { - const tracker = createPullTracker() - tracker.ingest(' 6edbc812af48 Pulling fs layer 0B') - tracker.ingest(' 6ff5bb9c14a0 Pulling fs layer 0B') - tracker.ingest(' 6edbc812af48 Downloading 1.049MB') - tracker.ingest(' 6edbc812af48 Downloading 5.243MB') - tracker.ingest(' 6ff5bb9c14a0 Downloading 2.097MB') - // Cumulative per layer: 5.243MB + 2.097MB, NOT 1.049 + 5.243 + 2.097. - expect(tracker.snapshot().downloadedBytes).toBe(5_243_000 + 2_097_000) - }) - - it('counts completed layers', () => { - const tracker = createPullTracker() - tracker.ingest(' 6edbc812af48 Pulling fs layer 0B') - tracker.ingest(' 4f4fb700ef54 Pulling fs layer 0B') - tracker.ingest(' 6edbc812af48 Pull complete 0B') - expect(tracker.snapshot()).toMatchObject({ layers: 2, completed: 1 }) - }) - - it('does not count "Download complete" as a finished layer — extraction follows', () => { - const tracker = createPullTracker() - tracker.ingest(' 4f4fb700ef54 Pulling fs layer 0B') - tracker.ingest(' 4f4fb700ef54 Download complete 0B') - expect(tracker.snapshot().completed).toBe(0) - }) - - it('is done only when the image reports Pulled', () => { - const tracker = createPullTracker() - tracker.ingest(` Image ${IMAGE} Pulling `) - expect(tracker.snapshot().done).toBe(false) - tracker.ingest(` Image ${IMAGE} Pulled `) - expect(tracker.snapshot().done).toBe(true) - }) - - it('ignores lines it does not understand', () => { - const tracker = createPullTracker() - expect(tracker.ingest('some unrelated warning')).toBe(false) - expect(tracker.ingest('')).toBe(false) - expect(tracker.snapshot().layers).toBe(0) - }) - - it('reports a change only when the snapshot actually moves', () => { - const tracker = createPullTracker() - expect(tracker.ingest(' 6edbc812af48 Pulling fs layer 0B')).toBe(true) - // Docker repeats identical byte counts constantly; those are not progress. - tracker.ingest(' 6edbc812af48 Downloading 5.243MB') - expect(tracker.ingest(' 6edbc812af48 Downloading 5.243MB')).toBe(false) - }) - - describe('describe', () => { - it('names the image before any layer is known', () => { - expect(createPullTracker().describe(IMAGE)).toBe(`Pulling ${IMAGE}`) - }) - - /** - * Layers only reach "Pull complete" during extraction, at the very end, so a - * layer counter shown during the download sits at 0/N for the whole thing and - * reads as stuck. Bytes are the honest signal until then. - */ - it('omits the layer count while nothing has finished yet', () => { - const tracker = createPullTracker() - tracker.ingest(' 6edbc812af48 Pulling fs layer 0B') - tracker.ingest(' 4f4fb700ef54 Pulling fs layer 0B') - tracker.ingest(' 6edbc812af48 Downloading 218MB') - expect(tracker.describe(IMAGE)).toBe(`Pulling ${IMAGE} — 218 MB downloaded`) - }) - - it('shows downloaded size and layer counts once known', () => { - const tracker = createPullTracker() - tracker.ingest(' 6edbc812af48 Pulling fs layer 0B') - tracker.ingest(' 4f4fb700ef54 Pulling fs layer 0B') - tracker.ingest(' 6edbc812af48 Downloading 45.6MB') - tracker.ingest(' 4f4fb700ef54 Pull complete 0B') - expect(tracker.describe(IMAGE)).toBe(`Pulling ${IMAGE} — 46 MB, layer 1/2`) - }) - - it('says it is done once pulled', () => { - const tracker = createPullTracker() - tracker.ingest(` Image ${IMAGE} Pulled `) - expect(tracker.describe(IMAGE)).toBe(`Pulled ${IMAGE}`) - }) - }) - - it('handles a whole real pull, ending complete', () => { - const tracker = createPullTracker() - const realLines = [ - ` Image ${IMAGE} Pulling `, - ' 6ff5bb9c14a0 Pulling fs layer 0B', - ' 6edbc812af48 Pulling fs layer 0B', - ' edb439b37967 Pulling fs layer 0B', - ' 4f4fb700ef54 Pulling fs layer 0B', - ' 6ff5bb9c14a0 Pulling fs layer 0B', - ' 6edbc812af48 Downloading 1.049MB', - ' 6edbc812af48 Downloading 22.02MB', - ' 4f4fb700ef54 Download complete 0B', - ' 6edbc812af48 Download complete 0B', - ' 6edbc812af48 Extracting 1.049MB', - ' 6edbc812af48 Pull complete 0B', - ' 4f4fb700ef54 Pull complete 0B', - ' edb439b37967 Pull complete 0B', - ' 6ff5bb9c14a0 Extracting 1B', - ' 6ff5bb9c14a0 Pull complete 0B', - ` Image ${IMAGE} Pulled `, - ] - for (const line of realLines) tracker.ingest(line) - - expect(tracker.snapshot()).toMatchObject({ layers: 4, completed: 4, done: true }) - expect(tracker.describe(IMAGE)).toBe(`Pulled ${IMAGE}`) - }) -}) diff --git a/test/scaffold.test.ts b/test/scaffold.test.ts deleted file mode 100644 index 85d61be..0000000 --- a/test/scaffold.test.ts +++ /dev/null @@ -1,428 +0,0 @@ -import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { describe, expect, it } from 'vitest' -import { buildScaffoldCommand, scaffoldInvocation, tokenizeCommand } from '../src/steps/scaffold.js' -import { applyOverlay, removeSuperseded } from '../src/steps/overlay.js' -import { - addPackageScripts, - installPlan, - mergeScripts, - projectScripts, -} from '../src/steps/deps.js' -import { - clearRunState, - hasRunState, - markRunStarted, - readRunState, -} from '../src/util/state.js' -import { STATE_FILE } from '../src/constants.js' -import { loadTemplate } from '../src/templates.js' -import { validateTargetDir } from '../src/prompts.js' - -function scratch(): string { - return mkdtempSync(path.join(tmpdir(), 'cta-m3-')) -} - -describe('tokenizeCommand', () => { - it('splits on whitespace', () => { - expect(tokenizeCommand('npm install typesense')).toEqual(['npm', 'install', 'typesense']) - }) - - it('collapses repeated whitespace', () => { - expect(tokenizeCommand('npm install typesense')).toEqual([ - 'npm', - 'install', - 'typesense', - ]) - }) - - it('keeps a double-quoted argument together', () => { - expect(tokenizeCommand('npm create vite -- --template "my template"')).toEqual([ - 'npm', - 'create', - 'vite', - '--', - '--template', - 'my template', - ]) - }) - - it('keeps a single-quoted argument together', () => { - expect(tokenizeCommand("cmd --name 'two words'")).toEqual(['cmd', '--name', 'two words']) - }) - - it('returns nothing for an empty command', () => { - expect(tokenizeCommand(' ')).toEqual([]) - }) -}) - -describe('buildScaffoldCommand', () => { - it('splits the manifest command into a program and its arguments', () => { - const { command, args } = buildScaffoldCommand( - 'npx --yes create-next-app@latest {{dir}} --ts', - '/tmp/my-app', - ) - expect(command).toBe('npx') - expect(args).toEqual(['--yes', 'create-next-app@latest', '/tmp/my-app', '--ts']) - }) - - /** - * The directory is user-supplied and may contain spaces. Substituting into the - * string before tokenising would split it into two arguments and scaffold into - * the wrong place. - */ - it('keeps a directory containing spaces as one argument', () => { - const { args } = buildScaffoldCommand('npx create-next-app {{dir}} --ts', '/tmp/my app/here') - expect(args).toContain('/tmp/my app/here') - expect(args).toEqual(['create-next-app', '/tmp/my app/here', '--ts']) - }) - - it('substitutes every occurrence of the placeholder', () => { - const { args } = buildScaffoldCommand('cmd {{dir}} --out {{dir}}', '/tmp/x') - expect(args).toEqual(['/tmp/x', '--out', '/tmp/x']) - }) - - it('rejects a command with no placeholder', () => { - expect(() => buildScaffoldCommand('npx create-next-app --ts', '/tmp/x')).toThrow(/\{\{dir\}\}/) - }) - - it('rejects an empty command', () => { - expect(() => buildScaffoldCommand(' ', '/tmp/x')).toThrow() - }) - - it('builds a runnable command from the real Next.js manifest', async () => { - const template = await loadTemplate('nextjs') - const { command, args } = buildScaffoldCommand(template.scaffold, '/tmp/my-app') - expect(command).toBe('npx') - expect(args).toContain('/tmp/my-app') - // Verified against create-next-app 16: a second install pass is wasteful, so - // the manifest skips it and the dependency step installs everything at once. - expect(args).toContain('--skip-install') - }) -}) - -describe('applyOverlay', () => { - it('copies files into the project, creating directories as needed', async () => { - const source = scratch() - const target = scratch() - mkdirSync(path.join(source, 'app'), { recursive: true }) - mkdirSync(path.join(source, 'lib'), { recursive: true }) - writeFileSync(path.join(source, 'app', 'page.tsx'), 'export default null') - writeFileSync(path.join(source, 'lib', 'typesense.ts'), 'export const x = 1') - - const written = await applyOverlay(source, target) - - expect(written.sort()).toEqual([ - path.join('app', 'page.tsx'), - path.join('lib', 'typesense.ts'), - ]) - expect(readFileSync(path.join(target, 'app', 'page.tsx'), 'utf8')).toContain('export default') - }) - - /** The overlay owns app/page.tsx — replacing the framework's default is the point. */ - it("overwrites the framework's own files", async () => { - const source = scratch() - const target = scratch() - mkdirSync(path.join(source, 'app'), { recursive: true }) - mkdirSync(path.join(target, 'app'), { recursive: true }) - writeFileSync(path.join(source, 'app', 'page.tsx'), 'ours') - writeFileSync(path.join(target, 'app', 'page.tsx'), 'the default page') - - await applyOverlay(source, target) - expect(readFileSync(path.join(target, 'app', 'page.tsx'), 'utf8')).toBe('ours') - }) - - it('ignores .gitkeep placeholders', async () => { - const source = scratch() - const target = scratch() - writeFileSync(path.join(source, '.gitkeep'), '') - writeFileSync(path.join(source, 'real.ts'), 'x') - - expect(await applyOverlay(source, target)).toEqual(['real.ts']) - }) - - it('is idempotent', async () => { - const source = scratch() - const target = scratch() - writeFileSync(path.join(source, 'a.ts'), 'x') - const first = await applyOverlay(source, target) - expect(await applyOverlay(source, target)).toEqual(first) - }) -}) - -describe('mergeScripts', () => { - const base = JSON.stringify( - { name: 'my-app', scripts: { dev: 'next dev', build: 'next build' } }, - null, - 2, - ) - - it("leaves the framework's own scripts alone", () => { - const merged = JSON.parse(mergeScripts(base, { seed: 'tsx scripts/seed.ts' })) as { - scripts: Record - } - expect(merged.scripts['dev']).toBe('next dev') - expect(merged.scripts['build']).toBe('next build') - expect(merged.scripts['seed']).toBe('tsx scripts/seed.ts') - }) - - it('adds the typesense lifecycle scripts', () => { - const merged = JSON.parse( - mergeScripts(base, { - 'typesense:up': 'docker compose up -d', - 'typesense:down': 'docker compose down --volumes', - }), - ) as { scripts: Record } - expect(merged.scripts['typesense:up']).toBe('docker compose up -d') - expect(merged.scripts['typesense:down']).toBe('docker compose down --volumes') - }) - - it('is idempotent', () => { - const once = mergeScripts(base, { seed: 'tsx scripts/seed.ts' }) - expect(mergeScripts(once, { seed: 'tsx scripts/seed.ts' })).toBe(once) - }) - - it('preserves everything else in package.json', () => { - const withDeps = JSON.stringify({ - name: 'my-app', - private: true, - scripts: { dev: 'next dev' }, - dependencies: { next: '16.3.0' }, - }) - const merged = JSON.parse(mergeScripts(withDeps, { seed: 'x' })) as Record - expect(merged['private']).toBe(true) - expect(merged['dependencies']).toEqual({ next: '16.3.0' }) - }) - - it('copes with a package.json that has no scripts block', () => { - const merged = JSON.parse(mergeScripts('{"name":"x"}', { seed: 'y' })) as { - scripts: Record - } - expect(merged.scripts['seed']).toBe('y') - }) - - it('ends with a trailing newline, as npm writes it', () => { - expect(mergeScripts(base, { seed: 'x' }).endsWith('\n')).toBe(true) - }) -}) - -describe('addPackageScripts', () => { - it('writes the merged scripts back to disk', async () => { - const dir = scratch() - writeFileSync( - path.join(dir, 'package.json'), - JSON.stringify({ name: 'my-app', scripts: { dev: 'next dev' } }, null, 2), - ) - - await addPackageScripts(dir, { seed: 'tsx scripts/seed.ts' }) - - const written = JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')) as { - scripts: Record - } - expect(written.scripts).toEqual({ dev: 'next dev', seed: 'tsx scripts/seed.ts' }) - }) - - it('fails clearly when there is no package.json to merge into', async () => { - await expect(addPackageScripts(scratch(), { seed: 'x' })).rejects.toThrow(/package\.json/) - }) -}) - -describe('run state', () => { - it('reports no state for an untouched directory', () => { - expect(hasRunState(scratch())).toBe(false) - }) - - it('records and reads back the run', async () => { - const dir = path.join(scratch(), 'my-app') - await markRunStarted(dir, { version: 1, template: 'nextjs' }) - - expect(hasRunState(dir)).toBe(true) - expect(await readRunState(dir)).toEqual({ version: 1, template: 'nextjs' }) - }) - - it('writes it under the documented filename', async () => { - const dir = scratch() - await markRunStarted(dir, { version: 1, template: 'nextjs' }) - expect(readFileSync(path.join(dir, STATE_FILE), 'utf8')).toContain('nextjs') - }) - - /** Deleted on success, so a finished project is not silently scaffolded over. */ - it('clears the marker', async () => { - const dir = scratch() - await markRunStarted(dir, { version: 1, template: 'nextjs' }) - await clearRunState(dir) - expect(hasRunState(dir)).toBe(false) - expect(await readRunState(dir)).toBeUndefined() - }) - - it('clearing an absent marker is not an error', async () => { - await expect(clearRunState(scratch())).resolves.toBeUndefined() - }) - - it('treats unreadable state as absent rather than throwing', async () => { - const dir = scratch() - writeFileSync(path.join(dir, STATE_FILE), 'not json at all') - expect(await readRunState(dir)).toBeUndefined() - }) -}) - -describe('validateTargetDir with a resume marker', () => { - it('resumes a directory holding a half-finished project', async () => { - const dir = scratch() - // What a crash after scaffolding leaves behind. - writeFileSync(path.join(dir, 'package.json'), '{"name":"my-app"}') - mkdirSync(path.join(dir, 'app')) - writeFileSync(path.join(dir, 'app', 'page.tsx'), 'export default null') - - expect(validateTargetDir(dir)).toMatch(/is not empty/) - - await markRunStarted(dir, { version: 1, template: 'nextjs' }) - expect(validateTargetDir(dir)).toBeUndefined() - }) - - /** Cleared on success, so a finished project is not scaffolded over. */ - it('refuses a finished project again once the marker is cleared', async () => { - const dir = scratch() - writeFileSync(path.join(dir, 'package.json'), '{"name":"my-app"}') - await markRunStarted(dir, { version: 1, template: 'nextjs' }) - await clearRunState(dir) - expect(validateTargetDir(dir)).toMatch(/is not empty/) - }) -}) - -const nextjsTemplate = await loadTemplate('nextjs') - -describe('projectScripts', () => { - const scripts = projectScripts(nextjsTemplate) - - it('adds exactly the three scripts the plan calls for', () => { - expect(Object.keys(scripts).sort()).toEqual(['seed', 'typesense:down', 'typesense:up']) - }) - - it('starts the server detached, so the shell comes back', () => { - expect(scripts['typesense:up']).toBe('docker compose up --detach') - }) - - /** - * Deliberately NOT `--volumes`: this is the everyday "stop for now" script, and - * wiping the index on every stop means the app comes back empty until reseeded. - * A full wipe is `docker compose down --volumes`, which the CLI prints. - */ - it('stops the server without destroying the indexed data', () => { - expect(scripts['typesense:down']).toBe('docker compose down') - expect(scripts['typesense:down']).not.toContain('--volumes') - }) - - it('needs no --env-file, because the compose file needs no substitution', () => { - for (const script of Object.values(scripts)) { - expect(script).not.toContain('--env-file') - } - }) - - it('takes the seed command from the manifest, not from src/', () => { - expect(scripts['seed']).toBe(nextjsTemplate.seedCommand) - expect(nextjsTemplate.devDeps).toContain('tsx') - }) - - it('uses whatever runner a manifest declares', () => { - const pretend = { ...nextjsTemplate, seedCommand: 'node --run seed' } - expect(projectScripts(pretend)['seed']).toBe('node --run seed') - }) -}) - -describe('removeSuperseded', () => { - it('deletes the files a template says its overlay replaces', async () => { - const dir = scratch() - writeFileSync(path.join(dir, 'counter.js'), 'export const x = 1') - writeFileSync(path.join(dir, 'keep.js'), 'keep me') - - expect(await removeSuperseded(dir, ['counter.js'])).toEqual(['counter.js']) - expect(existsSync(path.join(dir, 'counter.js'))).toBe(false) - expect(existsSync(path.join(dir, 'keep.js'))).toBe(true) - }) - - it('deletes a directory and its contents', async () => { - const dir = scratch() - mkdirSync(path.join(dir, 'assets')) - writeFileSync(path.join(dir, 'assets', 'logo.svg'), '') - - await removeSuperseded(dir, ['assets']) - expect(existsSync(path.join(dir, 'assets'))).toBe(false) - }) - - /** A framework CLI may stop shipping a file; that must not fail the run. */ - it('ignores paths that are already gone', async () => { - expect(await removeSuperseded(scratch(), ['never-existed.js'])).toEqual([]) - }) - - it('does nothing when the list is empty', async () => { - expect(await removeSuperseded(scratch(), [])).toEqual([]) - }) - - it('refuses a path that escapes the project directory', async () => { - await expect(removeSuperseded(scratch(), ['../outside.txt'])).rejects.toThrow(/outside/) - }) -}) - -describe('scaffoldInvocation', () => { - /** - * Regression: create-vite treats its directory argument as relative to cwd even - * when handed an absolute path, silently building a nested tree - * (private/tmp/.../my-app) and leaving the real target empty. create-next-app - * accepts either. A bare name in the parent directory works for both. - */ - it('passes a bare directory name and runs in the parent', () => { - const { args, cwd } = scaffoldInvocation(nextjsTemplate, '/tmp/somewhere/my-app') - expect(args).toContain('my-app') - expect(args).not.toContain('/tmp/somewhere/my-app') - expect(cwd).toBe('/tmp/somewhere') - }) - - it('does the same for the vanilla template', async () => { - const vanilla = await loadTemplate('vanilla') - const { command, args, cwd } = scaffoldInvocation(vanilla, '/tmp/somewhere/my-app') - expect(command).toBe('npm') - expect(args).toEqual(['create', 'vite@latest', 'my-app', '--', '--template', 'vanilla']) - expect(cwd).toBe('/tmp/somewhere') - }) - - it('keeps a name containing spaces as a single argument', () => { - const { args } = scaffoldInvocation(nextjsTemplate, '/tmp/some dir/my app') - expect(args).toContain('my app') - }) -}) - -describe('installPlan', () => { - /** - * Order matters, and not academically. create-vite's qwik starter pins - * vite@^8 while @builder.io/qwik declares `peer vite@">=5 <8"`, so a plain - * `npm install` in a freshly scaffolded project fails with ERESOLVE before we - * add anything. The template corrects the pin through devDeps, which only - * helps if devDeps are installed first. - */ - it('installs devDeps before deps, so a corrected pin lands first', () => { - const plan = installPlan(['typesense'], ['vite@^7']) - expect(plan.map((step) => step.args)).toEqual([ - ['install', '--save-dev', 'vite@^7'], - ['install', 'typesense'], - ]) - }) - - it('skips the devDeps step when a template needs none', () => { - expect(installPlan(['typesense'], [])).toHaveLength(1) - expect(installPlan(['typesense'], [])[0]?.args).toEqual(['install', 'typesense']) - }) - - it('describes each step for the progress spinner', () => { - const plan = installPlan(['typesense', 'instantsearch.js'], ['tsx']) - expect(plan.map((step) => step.description)).toEqual([ - 'Installing tsx', - 'Installing typesense, instantsearch.js', - ]) - }) - - it('plans nothing when there is nothing to install', () => { - expect(installPlan([], [])).toEqual([]) - }) -}) diff --git a/test/search.integration.test.ts b/test/search.integration.test.ts deleted file mode 100644 index ab33a07..0000000 --- a/test/search.integration.test.ts +++ /dev/null @@ -1,242 +0,0 @@ -/** - * THE M2 acceptance criterion, automated. - * - * A search issued with ONLY the search-only key returns Harry Potter for - * "hary potr" — and that same key can do nothing else. Everything upstream exists - * to make this one assertion true. - */ -import { mkdtempSync } from 'node:fs' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { - ADMIN_KEY_VAR, - COLLECTION_NAME, - DEMO_FACET_BY, - DEMO_QUERY_BY, - SEARCH_KEY_VAR, - TYPO_DEMO_QUERY, -} from '../src/constants.js' -import type { ProjectConfig } from '../src/config.js' -import { readEnvFile } from '../src/steps/env.js' -import { provisionServer, type ProvisionedServer } from '../src/steps/provision.js' -import { setUpSearch, type SearchSetupResult } from '../src/steps/searchSetup.js' -import { composeDown } from '../src/steps/server.js' -import { loadTemplate } from '../src/templates.js' -import { checkDocker } from '../src/util/docker.js' -import { createTypesenseClient, TypesenseError } from '../src/util/typesense.js' - -const docker = await checkDocker() - -const PORT = 8392 -const PROJECT = 'cta-m2' -const projectDir = path.join(mkdtempSync(path.join(tmpdir(), 'cta-m2-')), PROJECT) -const envFile = path.join(projectDir, '.env.local') - -let server: ProvisionedServer -let setup: SearchSetupResult - -async function config(): Promise { - return { - projectName: PROJECT, - targetDir: projectDir, - template: await loadTemplate('nextjs'), - server: { kind: 'docker', port: PORT }, - dataset: 'books', - } -} - -beforeAll(async () => { - if (!docker.available) return - const projectConfig = await config() - server = await provisionServer(projectConfig) - setup = await setUpSearch(projectConfig, server) -}, 300_000) - -afterAll(async () => { - if (docker.available) { - await composeDown(projectDir).catch(() => undefined) - } -}, 120_000) - -describe.skipIf(!docker.available)('search with only the search-only key', () => { - /** A client holding the browser-visible key and nothing else. */ - function browserClient() { - return createTypesenseClient(server.baseUrl, setup.searchOnlyKey) - } - - it('returns Harry Potter for "hary potr" — two typos, no exact term', async () => { - const result = await browserClient().search(COLLECTION_NAME, { - q: TYPO_DEMO_QUERY, - query_by: DEMO_QUERY_BY, - }) - - expect(result.found).toBeGreaterThan(0) - expect(String(result.hits[0]?.document['title'])).toContain('Harry Potter') - }) - - it('finds only Harry Potter books, not incidental typo collisions', async () => { - const result = await browserClient().search(COLLECTION_NAME, { - q: TYPO_DEMO_QUERY, - query_by: DEMO_QUERY_BY, - }) - for (const hit of result.hits) { - expect(String(hit.document['title'])).toContain('Harry Potter') - } - }) - - it('is the key from the env file, not one held only in memory', async () => { - const values = await readEnvFile(envFile) - const fromEnv = values[`NEXT_PUBLIC_${SEARCH_KEY_VAR}`] - expect(fromEnv).toBe(setup.searchOnlyKey) - - const result = await createTypesenseClient(server.baseUrl, fromEnv!).search(COLLECTION_NAME, { - q: TYPO_DEMO_QUERY, - query_by: DEMO_QUERY_BY, - }) - expect(String(result.hits[0]?.document['title'])).toContain('Harry Potter') - }) - - it('indexed the whole downloaded dataset', () => { - expect(setup.documentsImported).toBeGreaterThan(5_000) - }) - - it('ranks the best-known book first, via ratings_count', async () => { - const result = await browserClient().search(COLLECTION_NAME, { - q: TYPO_DEMO_QUERY, - query_by: DEMO_QUERY_BY, - }) - expect(String(result.hits[0]?.document['title'])).toContain("Philosopher's Stone") - expect(Number(result.hits[0]?.document['ratings_count'])).toBeGreaterThan(1_000_000) - }) - - it('carries cover images, so the UI can show them', async () => { - const result = await browserClient().search(COLLECTION_NAME, { - q: TYPO_DEMO_QUERY, - query_by: DEMO_QUERY_BY, - }) - expect(String(result.hits[0]?.document['image_url'])).toMatch(/^https:/) - }) - - /** The CLI proves the aha moment itself before reporting success. */ - it('was verified during setup, with the search key rather than the admin key', () => { - expect(setup.verification.query).toBe(TYPO_DEMO_QUERY) - expect(setup.verification.found).toBeGreaterThan(0) - expect(setup.verification.topHit).toContain('Harry Potter') - }) - - it.each([ - ['tolkein', 'author misspelled'], - ['grate gatsby', 'both words wrong'], - ['sherlok holmes', 'transposed letters'], - ['hitchikers guide', 'dropped letter'], - ])('tolerates "%s" (%s)', async (query) => { - const result = await browserClient().search(COLLECTION_NAME, { - q: query, - query_by: DEMO_QUERY_BY, - }) - expect(result.found).toBeGreaterThan(0) - }) - - it('facets, so the UI can show one', async () => { - const result = await browserClient().search(COLLECTION_NAME, { - q: '*', - query_by: DEMO_QUERY_BY, - facet_by: DEMO_FACET_BY, - }) - expect(result.found).toBeGreaterThan(5_000) - expect(result.facet_counts?.[0]?.counts?.length ?? 0).toBeGreaterThan(0) - }) -}) - -describe.skipIf(!docker.available)('the search-only key is genuinely restricted', () => { - function browserClient() { - return createTypesenseClient(server.baseUrl, setup.searchOnlyKey) - } - - it('cannot import documents', async () => { - await expect( - browserClient().importDocuments(COLLECTION_NAME, '{"id":"x","title":"Injected"}'), - ).rejects.toThrow(TypesenseError) - }) - - it('cannot delete the collection', async () => { - await expect(browserClient().deleteCollection(COLLECTION_NAME)).rejects.toThrow(TypesenseError) - // Still there, checked with the admin key. - const admin = createTypesenseClient(server.baseUrl, server.adminKey) - expect(await admin.collectionExists(COLLECTION_NAME)).toBe(true) - }) - - it('cannot list or mint keys — no privilege escalation', async () => { - await expect(browserClient().listKeys()).rejects.toThrow(TypesenseError) - await expect( - browserClient().createKey({ - description: 'escalated', - actions: ['*'], - collections: ['*'], - }), - ).rejects.toThrow(TypesenseError) - }) - - it('cannot search a collection it was not scoped to', async () => { - const admin = createTypesenseClient(server.baseUrl, server.adminKey) - await admin.createCollection({ - name: 'secrets', - fields: [{ name: 'body', type: 'string' }], - }) - await expect( - browserClient().search('secrets', { q: 'anything', query_by: 'body' }), - ).rejects.toThrow(TypesenseError) - }) -}) - -describe.skipIf(!docker.available)('the env file', () => { - it('keeps the admin key unprefixed and the search key prefixed', async () => { - const values = await readEnvFile(envFile) - expect(values[ADMIN_KEY_VAR]).toBe(server.adminKey) - expect(values[`NEXT_PUBLIC_${ADMIN_KEY_VAR}`]).toBeUndefined() - expect(values[`NEXT_PUBLIC_${SEARCH_KEY_VAR}`]).toBe(setup.searchOnlyKey) - }) - - it('never writes the admin key under any public name', async () => { - const values = await readEnvFile(envFile) - for (const [name, value] of Object.entries(values)) { - if (name.startsWith('NEXT_PUBLIC_')) { - expect(value).not.toBe(server.adminKey) - } - } - }) - - it('records where the collection is, so the template needs no hardcoding', async () => { - const values = await readEnvFile(envFile) - expect(values['NEXT_PUBLIC_TYPESENSE_HOST']).toBe('127.0.0.1') - expect(values['NEXT_PUBLIC_TYPESENSE_PORT']).toBe(String(PORT)) - expect(values['NEXT_PUBLIC_TYPESENSE_PROTOCOL']).toBe('http') - expect(values['NEXT_PUBLIC_TYPESENSE_COLLECTION']).toBe(COLLECTION_NAME) - }) -}) - -describe.skipIf(!docker.available)('re-running', () => { - it('recreates the collection and still ends up searchable', async () => { - const projectConfig = await config() - const second = await setUpSearch(projectConfig, server) - - expect(second.replacedCollection).toBe(true) - expect(second.documentsImported).toBe(setup.documentsImported) - // The dataset was cached in the project, so no second download. - - const result = await createTypesenseClient(server.baseUrl, second.searchOnlyKey).search( - COLLECTION_NAME, - { q: TYPO_DEMO_QUERY, query_by: DEMO_QUERY_BY }, - ) - expect(String(result.hits[0]?.document['title'])).toContain('Harry Potter') - }, 120_000) - - it('does not accumulate a new search key on every run', async () => { - const admin = createTypesenseClient(server.baseUrl, server.adminKey) - const ours = (await admin.listKeys()).filter( - (key) => key.description === 'create-typesense-app search-only key', - ) - expect(ours).toHaveLength(1) - }) -}) diff --git a/test/seed.test.ts b/test/seed.test.ts deleted file mode 100644 index a85c9d4..0000000 --- a/test/seed.test.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Typesense's bulk import answers with one JSON object per line rather than a - * single status — a 200 can still mean every document failed. Misreading that - * would report "Indexed 225 documents" over an empty collection, so the parsing - * is pinned down here. - */ -import { describe, expect, it } from 'vitest' -import { parseImportResponse } from '../src/steps/seed.js' - -describe('parseImportResponse', () => { - it('counts a fully successful import', () => { - const body = ['{"success":true}', '{"success":true}', '{"success":true}'].join('\n') - expect(parseImportResponse(body)).toEqual({ imported: 3, failed: 0, errors: [] }) - }) - - it('counts failures separately and keeps their messages', () => { - const body = [ - '{"success":true}', - '{"success":false,"error":"Field `publication_year` must be an int32.","document":"{\\"id\\":\\"9\\"}"}', - '{"success":true}', - ].join('\n') - const outcome = parseImportResponse(body) - expect(outcome.imported).toBe(2) - expect(outcome.failed).toBe(1) - expect(outcome.errors[0]).toContain('must be an int32') - }) - - it('treats an all-failed import as zero imported, not as success', () => { - const body = [ - '{"success":false,"error":"Bad JSON."}', - '{"success":false,"error":"Bad JSON."}', - ].join('\n') - expect(parseImportResponse(body)).toMatchObject({ imported: 0, failed: 2 }) - }) - - it('ignores blank lines and trailing newlines', () => { - expect(parseImportResponse('{"success":true}\n\n{"success":true}\n')).toMatchObject({ - imported: 2, - failed: 0, - }) - }) - - it('handles an empty body', () => { - expect(parseImportResponse('')).toEqual({ imported: 0, failed: 0, errors: [] }) - }) - - it('counts an unparseable line as a failure rather than throwing', () => { - const outcome = parseImportResponse('{"success":true}\ngateway timeout') - expect(outcome.imported).toBe(1) - expect(outcome.failed).toBe(1) - expect(outcome.errors.join(' ')).toMatch(/gateway timeout|could not be parsed/i) - }) - - it('keeps only a handful of error messages, so the output stays readable', () => { - const body = Array.from({ length: 50 }, () => '{"success":false,"error":"nope"}').join('\n') - const outcome = parseImportResponse(body) - expect(outcome.failed).toBe(50) - expect(outcome.errors.length).toBeLessThanOrEqual(5) - }) -}) diff --git a/test/server-lifecycle.integration.test.ts b/test/server-lifecycle.integration.test.ts deleted file mode 100644 index abfa899..0000000 --- a/test/server-lifecycle.integration.test.ts +++ /dev/null @@ -1,167 +0,0 @@ -/** - * The M1 acceptance criterion, automated: a real container comes up, /health - * reports ok, and teardown leaves nothing behind. - * - * Skipped when Docker is unavailable so the unit suite still runs anywhere. - */ -import { mkdtempSync } from 'node:fs' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { execa } from 'execa' -import { afterAll, describe, expect, it } from 'vitest' -import { ADMIN_KEY_VAR } from '../src/constants.js' -import type { ProjectConfig } from '../src/config.js' -import { COMPOSE_FILE } from '../src/steps/compose.js' -import { readEnvFile } from '../src/steps/env.js' -import { provisionServer } from '../src/steps/provision.js' -import { composeDown, waitForHealth } from '../src/steps/server.js' -import { loadTemplate } from '../src/templates.js' -import { checkDocker } from '../src/util/docker.js' - -const docker = await checkDocker() - -// A high port, so a developer's own Typesense on 8108 is never disturbed. -const PORT = 8391 -const PROJECT = 'cta-m1' - -const projectDir = path.join(mkdtempSync(path.join(tmpdir(), 'cta-m1-')), PROJECT) -const envFile = path.join(projectDir, '.env.local') -const baseUrl = `http://127.0.0.1:${PORT}` - -async function containerExists(): Promise { - const { stdout } = await execa('docker', [ - 'ps', - '--all', - '--filter', - `name=^${PROJECT}-typesense$`, - '--format', - '{{.Names}}', - ]) - return stdout.trim() !== '' -} - -async function volumeCount(): Promise { - const { stdout } = await execa('docker', [ - 'volume', - 'ls', - '--filter', - `name=${PROJECT}`, - '--format', - '{{.Name}}', - ]) - return stdout.trim() === '' ? 0 : stdout.trim().split('\n').length -} - -afterAll(async () => { - // Never leave a container behind, even if an assertion above failed. - if (docker.available) { - await composeDown(projectDir).catch(() => undefined) - } -}) - -describe.skipIf(!docker.available)('server lifecycle against a real container', () => { - let adminKey = '' - - async function config(): Promise { - return { - projectName: PROJECT, - targetDir: projectDir, - template: await loadTemplate('nextjs'), - server: { kind: 'docker', port: PORT }, - dataset: 'books', - } - } - - it( - 'starts Typesense, reports healthy, and answers only with the generated key', - async () => { - const result = await provisionServer(await config()) - adminKey = result.adminKey - - expect(result.composeFile).toBe(path.join(projectDir, COMPOSE_FILE)) - expect(result.reusedAdminKey).toBe(false) - expect(adminKey).toHaveLength(43) - - // The M1 curl, as a request: GET /health returns {"ok":true}. - const health = await fetch(`${baseUrl}/health`) - expect(await health.json()).toEqual({ ok: true }) - - // The generated key is really in force: an admin-only endpoint needs it... - const authorized = await fetch(`${baseUrl}/collections`, { - headers: { 'X-TYPESENSE-API-KEY': adminKey }, - }) - expect(authorized.status).toBe(200) - - // ...and rejects a wrong one, so the container is not running open. - const unauthorized = await fetch(`${baseUrl}/collections`, { - headers: { 'X-TYPESENSE-API-KEY': 'not-the-key' }, - }) - expect(unauthorized.status).toBe(401) - }, - 180_000, - ) - - it( - 'writes the admin key to the env file unprefixed, never to the browser', - async () => { - const contents = await readEnvFile(envFile) - expect(contents[ADMIN_KEY_VAR]).toBe(adminKey) - expect(contents[`NEXT_PUBLIC_${ADMIN_KEY_VAR}`]).toBeUndefined() - }, - ) - - it( - 're-runs cleanly: the key is reused and the container is not disturbed', - async () => { - const result = await provisionServer(await config()) - expect(result.reusedAdminKey).toBe(true) - expect(result.adminKey).toBe(adminKey) - expect(await containerExists()).toBe(true) - - // Still the same key in force, so the container was not recreated with a new one. - const authorized = await fetch(`${baseUrl}/collections`, { - headers: { 'X-TYPESENSE-API-KEY': adminKey }, - }) - expect(authorized.status).toBe(200) - }, - 180_000, - ) - - /** - * Regression, and the M1 criterion: this is the *bare* command printed for the - * user, with no --env-file. With `${...}` substitution in the compose file it - * failed to interpolate and teardown was impossible. - */ - it( - 'tears down with a bare `docker compose down --volumes`, leaving nothing behind', - async () => { - expect(await containerExists()).toBe(true) - expect(await volumeCount()).toBeGreaterThan(0) - - const result = await execa('docker', ['compose', 'down', '--volumes'], { - cwd: projectDir, - timeout: 120_000, - }) - expect(result.exitCode).toBe(0) - - expect(await containerExists()).toBe(false) - expect(await volumeCount()).toBe(0) - await expect(fetch(`${baseUrl}/health`)).rejects.toThrow() - }, - 180_000, - ) - - it( - 'and brings itself back up with a bare `docker compose up -d` too', - async () => { - await execa('docker', ['compose', 'up', '--detach'], { - cwd: projectDir, - timeout: 180_000, - }) - await waitForHealth(baseUrl, { timeoutMs: 60_000 }) - expect((await (await fetch(`${baseUrl}/health`)).json())).toEqual({ ok: true }) - await composeDown(projectDir) - }, - 240_000, - ) -}) diff --git a/test/summary.test.ts b/test/summary.test.ts deleted file mode 100644 index d971f42..0000000 --- a/test/summary.test.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { mkdtempSync } from 'node:fs' -import { tmpdir } from 'node:os' -import path from 'node:path' -import { describe, expect, it } from 'vitest' -import { ADMIN_KEY_VAR, SEARCH_KEY_VAR, TYPESENSE_IMAGE } from '../src/constants.js' -import { resolveDefaults } from '../src/prompts.js' -import type { PromptOptions } from '../src/prompts.js' -import { nextStepsLines, summaryLines } from '../src/summary.js' -import { loadTemplates } from '../src/templates.js' -import type { DockerStatus } from '../src/util/docker.js' - -const dockerUp: DockerStatus = { - available: true, - composeVersion: '5.1.2', - serverVersion: '29.4.0', -} - -const dockerDown: DockerStatus = { available: false, reason: 'the Docker daemon is not responding' } - -async function options(overrides: Partial = {}): Promise { - return { - templates: await loadTemplates(), - docker: dockerUp, - cwd: mkdtempSync(path.join(tmpdir(), 'cta-summary-')), - port: 8108, - ...overrides, - } -} - -describe('resolveDefaults', () => { - it('defaults to the first template, Docker and the books dataset', async () => { - const config = resolveDefaults(await options()) - expect(config.projectName).toBe('my-search-app') - expect(config.template.id).toBe('nextjs') - expect(config.dataset).toBe('books') - expect(config.server).toEqual({ kind: 'docker', port: 8108 }) - }) - - it('honours a positional name and an explicit template', async () => { - const config = resolveDefaults(await options({ projectName: 'demo', templateId: 'nextjs' })) - expect(config.projectName).toBe('demo') - expect(config.template.id).toBe('nextjs') - expect(config.targetDir.endsWith(path.join(path.sep, 'demo'))).toBe(true) - }) - - it('refuses --yes when Docker is down, and says what to do instead', async () => { - const withDockerDown = { ...(await options()), docker: dockerDown } - expect(() => resolveDefaults(withDockerDown)).toThrow( - /drop --yes and choose "I already have one running"/, - ) - }) - - it('rejects an invalid project name before touching anything', async () => { - const badName = await options({ projectName: 'My App' }) - expect(() => resolveDefaults(badName)).toThrow(/lowercase/) - }) -}) - -describe('summaryLines', () => { - it('shows the pinned image and port for a Docker run', async () => { - const lines = summaryLines(resolveDefaults(await options())).join('\n') - expect(lines).toContain(TYPESENSE_IMAGE) - expect(lines).toContain('port 8108') - expect(lines).toContain('CORS enabled') - }) - - it('lists the search-only key as browser-visible and the admin key as server-only', async () => { - const config = resolveDefaults(await options()) - const lines = summaryLines(config).join('\n') - expect(lines).toContain(`NEXT_PUBLIC_${SEARCH_KEY_VAR}`) - expect(lines).toContain(ADMIN_KEY_VAR) - expect(lines).not.toContain(`NEXT_PUBLIC_${ADMIN_KEY_VAR}`) - }) - - /** - * Proves the summary reads the manifest instead of assuming Next.js conventions. - * Uses a synthetic manifest rather than a second bundled template: the point is - * that nothing here is hardcoded, and that must hold for whatever comes next. - */ - it('follows whatever prefix and env file the manifest declares', async () => { - const config = resolveDefaults(await options()) - const pretend = { - ...config, - template: { - ...config.template, - env: { file: '.env', publicPrefix: 'PUBLIC_' }, - }, - } - const lines = summaryLines(pretend).join('\n') - expect(lines).toContain(`PUBLIC_${SEARCH_KEY_VAR}`) - expect(lines).toContain('.env') - expect(lines).not.toContain('NEXT_PUBLIC_') - }) - - it('points at the template dev URL in the next steps', async () => { - const nextjs = nextStepsLines(resolveDefaults(await options())).join('\n') - expect(nextjs).toContain('http://localhost:3000') - expect(nextjs).toContain('hary potr') - - }) -}) diff --git a/test/templates.test.ts b/test/templates.test.ts deleted file mode 100644 index c3610da..0000000 --- a/test/templates.test.ts +++ /dev/null @@ -1,267 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - TEMPLATE_IDS, - TemplateManifestError, - loadTemplate, - loadTemplates, - resolveTemplateWithoutPrompting, - validateManifest, -} from '../src/templates.js' - -/** A manifest that passes, so each test can break exactly one thing. */ -function validManifest(): Record { - return { - id: 'nextjs', - name: 'Next.js + react-instantsearch', - scaffold: 'npx --yes create-next-app@latest {{dir}} --ts --yes', - deps: ['typesense', 'typesense-instantsearch-adapter'], - env: { file: '.env.local', publicPrefix: 'NEXT_PUBLIC_' }, - seedCommand: 'tsx scripts/seed.ts', - files: 'files/', - devCommand: 'npm run dev', - devUrl: 'http://localhost:3000', - } -} - -const source = 'test/manifest' - -function expectRejected(mutate: (manifest: Record) => void, match: RegExp): void { - const manifest = validManifest() - mutate(manifest) - expect(() => validateManifest(manifest, source)).toThrow(match) - expect(() => validateManifest(manifest, source)).toThrow(TemplateManifestError) -} - -describe('validateManifest', () => { - it('accepts a complete manifest', () => { - expect(validateManifest(validManifest(), source)).toMatchObject({ - id: 'nextjs', - env: { publicPrefix: 'NEXT_PUBLIC_' }, - }) - }) - - it('rejects non-objects', () => { - for (const bad of [undefined, null, 'nextjs', 42, ['nextjs']]) { - expect(() => validateManifest(bad, source)).toThrow(/default export must be an object/) - } - }) - - it.each(['id', 'name', 'scaffold', 'files', 'devCommand', 'devUrl'])( - 'rejects a missing %s', - (key) => { - expectRejected((manifest) => delete manifest[key], new RegExp(`"${key}" must be`)) - }, - ) - - it('rejects unknown keys so a typo cannot fail silently', () => { - expectRejected( - (manifest) => { - manifest['devComand'] = 'npm run dev' - }, - /unknown manifest key: devComand/, - ) - }) - - it('rejects unknown env keys', () => { - expectRejected( - (manifest) => { - manifest['env'] = { ...(manifest['env'] as object), prefix: 'NEXT_PUBLIC_' } - }, - /unknown env key: prefix/, - ) - }) - - it('rejects a scaffold command without {{dir}}', () => { - expectRejected( - (manifest) => { - manifest['scaffold'] = 'npx --yes create-next-app@latest --ts --yes' - }, - /must contain the \{\{dir\}\} placeholder/, - ) - }) - - it('rejects a publicPrefix missing its trailing underscore', () => { - expectRejected( - (manifest) => { - manifest['env'] = { ...validManifest()['env'] as object, publicPrefix: 'NEXT_PUBLIC' } - }, - /must end with "_"/, - ) - }) - - it('rejects a lowercase publicPrefix', () => { - expectRejected( - (manifest) => { - manifest['env'] = { ...validManifest()['env'] as object, publicPrefix: 'next_public_' } - }, - /SCREAMING_SNAKE_CASE/, - ) - }) - - it('rejects an empty deps array', () => { - expectRejected( - (manifest) => { - manifest['deps'] = [] - }, - /"deps" must be a non-empty array/, - ) - }) - - it('rejects paths that escape the project directory', () => { - expectRejected( - (manifest) => { - manifest['files'] = '../../etc/' - }, - /must not contain ".."/, - ) - expectRejected( - (manifest) => { - manifest['env'] = { ...validManifest()['env'] as object, file: '/etc/environment' } - }, - /"env.file" must be relative/, - ) - }) - - it('rejects a non-http devUrl', () => { - expectRejected( - (manifest) => { - manifest['devUrl'] = 'localhost:3000' - }, - /must be an http\(s\) URL/, - ) - }) - - it('rejects a non-kebab-case id', () => { - expectRejected( - (manifest) => { - manifest['id'] = 'NextJS' - }, - /must be lowercase kebab-case/, - ) - }) -}) - -describe('bundled templates', () => { - it('ships the templates in the directory, nextjs first as the default', async () => { - const templates = await loadTemplates() - expect(templates.map((template) => template.id)).toEqual(['nextjs', 'qwik', 'solid', 'vanilla']) - }) - - it('gives each template its own env conventions rather than assuming one', async () => { - const byId = Object.fromEntries((await loadTemplates()).map((t) => [t.id, t])) - expect(byId['nextjs']?.env.publicPrefix).toBe('NEXT_PUBLIC_') - expect(byId['vanilla']?.env.publicPrefix).toBe('VITE_') - expect(byId['solid']?.env.publicPrefix).toBe('VITE_') - expect(byId['qwik']?.env.publicPrefix).toBe('VITE_') - expect(byId['nextjs']?.env.file).not.toBe(byId['solid']?.env.file) - expect(byId['nextjs']?.seedCommand).not.toBe(byId['solid']?.seedCommand) - }) - - /** Every template must reach the same aha moment, whatever its stack. */ - it.each(['nextjs', 'qwik', 'solid', 'vanilla'])('%s wires up the search dependencies', async (id) => { - const template = await loadTemplate(id) - expect(template.deps).toContain('typesense-instantsearch-adapter') - expect(template.devUrl).toMatch(/^http:\/\/localhost:\d+$/) - expect(template.seedCommand).toMatch(/seed\.(ts|js)$/) - }) - - it.each(TEMPLATE_IDS)('%s satisfies the contract', async (id) => { - const manifest = await loadTemplate(id) - expect(manifest.id).toBe(id) - expect(manifest.deps).toContain('typesense') - expect(manifest.deps).toContain('typesense-instantsearch-adapter') - }) - - - - it('reports a helpful error for an unknown template id', async () => { - await expect(loadTemplate('svelte')).rejects.toThrow(/file not found/) - }) -}) - -describe('resolveTemplateWithoutPrompting', () => { - it('defers to the prompt now that there is a real choice', async () => { - expect(resolveTemplateWithoutPrompting(await loadTemplates())).toBeUndefined() - }) - - it('settles immediately when only one template is bundled', async () => { - const [nextjs] = await loadTemplates() - expect(resolveTemplateWithoutPrompting([nextjs!])?.id).toBe('nextjs') - }) - - it('honours an explicit id', async () => { - const templates = await loadTemplates() - expect(resolveTemplateWithoutPrompting(templates, 'nextjs')?.id).toBe('nextjs') - }) - - it('rejects an id that is not on offer', async () => { - const templates = await loadTemplates() - expect(() => resolveTemplateWithoutPrompting(templates, 'astro')).toThrow(/Unknown template/) - }) - - it('honours vanilla too', async () => { - expect(resolveTemplateWithoutPrompting(await loadTemplates(), 'solid')?.id).toBe('solid') - }) - - -}) - -describe('the contract carries everything framework-specific', () => { - it('declares the command that runs the seed script', async () => { - const [nextjs] = await loadTemplates() - expect(nextjs?.seedCommand).toBe('tsx scripts/seed.ts') - }) - - it('requires a seedCommand', () => { - expectRejected((manifest) => delete manifest['seedCommand'], /"seedCommand" must be/) - }) - - /** - * accessor was in the contract but nothing ever read it: the overlay files are - * static and reference process.env directly, so there is nothing to interpolate. - * Rejecting it keeps the contract to fields that actually do something. - */ - it('rejects the retired accessor field rather than silently ignoring it', () => { - expectRejected( - (manifest) => { - manifest['env'] = { ...(manifest['env'] as object), accessor: 'process.env' } - }, - /unknown env key: accessor/, - ) - }) - - it('discovers its templates from the directory, not a hardcoded list', async () => { - const { readdirSync } = await import('node:fs') - const { templatesDir } = await import('../src/paths.js') - const onDisk = readdirSync(templatesDir, { withFileTypes: true }) - .filter((entry) => entry.isDirectory()) - .map((entry) => entry.name) - .sort() - expect([...TEMPLATE_IDS].sort()).toEqual(onDisk) - }) -}) - -describe('remove', () => { - it('defaults to nothing when a template does not need it', () => { - expect(validateManifest(validManifest(), source).remove).toEqual([]) - }) - - it('accepts a list of paths the overlay supersedes', () => { - const manifest = validManifest() - manifest['remove'] = ['src/counter.js', 'src/assets'] - expect(validateManifest(manifest, source).remove).toEqual(['src/counter.js', 'src/assets']) - }) - - /** Same guard as `files`: a template must not reach outside the project. */ - it.each(['../../etc/passwd', '/etc/passwd'])('rejects the escaping path %s', (bad) => { - expectRejected((manifest) => { - manifest['remove'] = [bad] - }, /must (not contain "\.\."|be relative)/) - }) - - it('rejects a non-array', () => { - expectRejected((manifest) => { - manifest['remove'] = 'src/counter.js' - }, /"remove" must be an array/) - }) -}) From 3a9f38ef3339a9c5bba0ea84014fd121887ac0d3 Mon Sep 17 00:00:00 2001 From: Nikhil Adiga Date: Mon, 23 Nov 2026 17:21:24 +0530 Subject: [PATCH 02/16] Move the Qwik, Solid and Vanilla templates to the generic search UI --- templates/qwik/files/index.html | 10 +- templates/qwik/files/public/favicon.png | Bin 0 -> 34884 bytes .../qwik/files/public/typesense-logo.svg | 144 ++++++++ templates/qwik/files/scripts/schema.js | 42 --- templates/qwik/files/scripts/seed.js | 17 +- templates/qwik/files/src/app.css | 336 +++++++++++++---- templates/qwik/files/src/app.jsx | 264 ++++++++++---- templates/qwik/files/src/index.css | 5 +- templates/qwik/files/src/typesense.js | 35 +- templates/qwik/template.config.js | 5 +- templates/solid/files/index.html | 10 +- templates/solid/files/public/favicon.png | Bin 0 -> 34884 bytes .../solid/files/public/typesense-logo.svg | 144 ++++++++ templates/solid/files/scripts/schema.js | 42 --- templates/solid/files/scripts/seed.js | 17 +- templates/solid/files/src/App.css | 311 ++++++++++++---- templates/solid/files/src/App.jsx | 336 ++++++++++++----- templates/solid/files/src/typesense.js | 37 +- templates/solid/template.config.js | 5 +- templates/vanilla/files/index.html | 10 +- templates/vanilla/files/public/favicon.png | Bin 0 -> 34884 bytes .../vanilla/files/public/typesense-logo.svg | 144 ++++++++ templates/vanilla/files/scripts/schema.js | 42 --- templates/vanilla/files/scripts/seed.js | 17 +- templates/vanilla/files/src/main.js | 288 +++++++++++---- templates/vanilla/files/src/style.css | 337 ++++++++++++++---- templates/vanilla/files/src/typesense.js | 38 +- templates/vanilla/template.config.js | 3 +- 28 files changed, 2014 insertions(+), 625 deletions(-) create mode 100644 templates/qwik/files/public/favicon.png create mode 100644 templates/qwik/files/public/typesense-logo.svg delete mode 100644 templates/qwik/files/scripts/schema.js create mode 100644 templates/solid/files/public/favicon.png create mode 100644 templates/solid/files/public/typesense-logo.svg delete mode 100644 templates/solid/files/scripts/schema.js create mode 100644 templates/vanilla/files/public/favicon.png create mode 100644 templates/vanilla/files/public/typesense-logo.svg delete mode 100644 templates/vanilla/files/scripts/schema.js diff --git a/templates/qwik/files/index.html b/templates/qwik/files/index.html index 46ceaba..1bbcded 100644 --- a/templates/qwik/files/index.html +++ b/templates/qwik/files/index.html @@ -2,9 +2,15 @@ - + + + + - Search books + Search
diff --git a/templates/qwik/files/public/favicon.png b/templates/qwik/files/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..dca9badb45ef5b832e682e4bca90c77c1fc8d671 GIT binary patch literal 34884 zcmXt9by!s2(_f^)1!)24PDNNyx|Z(lZWa{jMmhvUx?z!SSVB^el3rrz5Rep5Qu@7q zf6w~|56?aKp0ji2&V1&~XXeIesL6xzsPI4_5Li(`Rtp4r1pD`gg9VI8rarI$|8UUYvUP@I81gcNOzqP~!fua@^WucLKqGg`b9MYB1r3DGFdNN$L?d38*ATa#mBX^ryLsPsEDX@#4J2X4{ z=4Xz3e#?RITJ0D9Z=+)Tmm{y|u1p`&*SaSpg|I@Ga@GZHZ%-+~`RbJ26Dg4sXduwK ztekPcGTHJ4W{V4$t`HoE#Z7Dy#!75O=kWI#u%}olxQjq*pinC~d(*1sV#csevA~pi znfz%VC7>DI1;HR{zNBbs2;{SCsLPAiK&#u$XXwDZ8iqfD&z5N^9}MvK>F2RjnWxgI z_D6vm0ai1z@I$H1FFvQbb&45*!mT{~(E=b)i0})lWmKj@M?BTUZ`C?5R!iz89Ux#q z-ec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;V530im`sXtEw$;Akj*FAsvLJf+bp5D zQ%q(`QTYqx`rp3&U*Emj|2tcKyMMD=8YHJlN6z4@&b(geF;U zMpnc(Z$2Xie;>3%c*n~kS&F0o7h4xt7z~tc0!@MM zV=}XcGP&jIA~8bj(6_kvJ`_6w>_=oQQdpA5g+382$g+CSQVDk-r=rHJxR4`gf~;6C zP|!#4YS-a;YHs6w1+OG%lc(iub)NLHlHOq!q$9Gd0&O1zM4fqO@NnFCDt7W1=5bmd zWR2LN$C4MtomnD#K$4ZjZ43@BkIMrZb?-r`QyvrMZPT{s$KbSPgms`VV;NP8nbT~F zx*^oDTFZ1<@ZJ~`2OJ;#U=2v0hghx9zWuF|JGv@$c%ckTc+R$TIKyBhGRK6tt(76m zIwf+t8g+Q(MwDk{PM|%oAmQd>zHeV&r_Nf5zJhy!Utt-2K6gEfA7g>swKgbJA11lfU6uCiE7DE)r!k3G|v z)&jS|m%m}C`d!#&8OMG7k08)}ekt=U^>%$JEcx?zUEBHXl4_ErPwJUlD}9+gb>;)B P3I+yGS3j3^P6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/qwik/files/scripts/schema.js b/templates/qwik/files/scripts/schema.js deleted file mode 100644 index b2f7b25..0000000 --- a/templates/qwik/files/scripts/schema.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * The collection schema — the first file worth editing. - * - * Typesense needs a schema before it can index anything. That requirement is the - * reason this file exists rather than being hidden: change a field here, run - * `npm run seed`, and the collection is rebuilt to match. - * - * Full field reference: https://typesense.org/docs/latest/api/collections.html - */ - -/** Must match VITE_TYPESENSE_COLLECTION in .env. */ -export const collectionName = process.env.VITE_TYPESENSE_COLLECTION ?? 'books' - -export const booksSchema = { - name: collectionName, - fields: [ - // Searched, but not faceted: nobody filters by exact title. - { name: 'title', type: 'string', facet: false }, - - // `string[]` because a book can have several authors. Faceting is what lets - // the sidebar in src/app.jsx offer them as filters. - { name: 'authors', type: 'string[]', facet: true }, - - { name: 'publication_year', type: 'int32', facet: true }, - { name: 'average_rating', type: 'float', facet: true }, - - // Stored so hits can show a cover. Not searched. - { name: 'image_url', type: 'string', facet: false }, - - { name: 'ratings_count', type: 'int32', facet: true }, - ], - - /** - * The tie-breaker, and the reason a misspelling finds the *right* book. - * - * Typesense ranks by text-match score first. When several documents match a - * query equally well — as all seventeen Harry Potter records do for - * "hary potr" — this field decides the order. Sorting by ratings_count puts - * the best-known edition on top. Remove it and the order becomes arbitrary. - */ - default_sorting_field: 'ratings_count', -} diff --git a/templates/qwik/files/scripts/seed.js b/templates/qwik/files/scripts/seed.js index f3b95f8..3f6de2f 100644 --- a/templates/qwik/files/scripts/seed.js +++ b/templates/qwik/files/scripts/seed.js @@ -1,8 +1,9 @@ /** * Rebuilds the collection from data/books.jsonl. * - * Idempotent: it drops the collection, recreates it from scripts/schema.js, and - * re-imports every document. Run it after editing the schema or the data. + * Idempotent: it drops the collection, recreates it from the schema in + * typesense.config.json, and re-imports every document. Run it after editing the + * schema or the data. * * npm run seed * @@ -42,8 +43,12 @@ async function loadEnv(file) { async function main() { await loadEnv(ENV_FILE) - // Imported after the env is loaded, since the schema reads the collection name. - const { booksSchema, collectionName } = await import('./schema.js') + const config = JSON.parse(await readFile('typesense.config.json', 'utf8')) + const collection = config.collections[0] + if (collection === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') + } + const collectionName = collection.name const adminApiKey = process.env.TYPESENSE_API_KEY ?? '' if (adminApiKey === '') { @@ -83,8 +88,8 @@ async function main() { // Drop first: Typesense will not retrofit an existing collection to a new schema. await typesense('DELETE', `/collections/${collectionName}`) - await typesense('POST', '/collections', JSON.stringify(booksSchema)) - console.log(' created the collection from scripts/schema.js') + await typesense('POST', '/collections', JSON.stringify(collection.schema)) + console.log(' created the collection from typesense.config.json') const result = await typesense( 'POST', diff --git a/templates/qwik/files/src/app.css b/templates/qwik/files/src/app.css index a4509ef..fd35ae8 100644 --- a/templates/qwik/files/src/app.css +++ b/templates/qwik/files/src/app.css @@ -1,63 +1,128 @@ +/* The tokens and sizes follow cloud.typesense.org, and match the Next.js + template's search.module.css. */ + .page { + --ts-page: #fefefe; + --ts-panel: #f7f7fa; + --ts-border: #e6e6ee; + --ts-border-strong: #c9cad6; + --ts-text: #303138; + --ts-muted: #6f7082; + --ts-indigo: #3943b7; + --ts-pink: #ed0e73; + --ts-pink-tint: #fde7f1; + --ts-checkbox-border: #9495a6; + /* Loaded from Google Fonts in index.html. */ + --font-body: "Palanquin"; + --font-heading: "Catamaran"; + /* - * Explicit width, not just max-width. Starters style their mount point in ways - * a template does not control (Qwik's sets #app to a centred flex column), and - * an element sized to fit-content would resize on every keystroke as results - * change. See the note in index.css. + * Explicit width: starters style their mount point in ways a template does not + * control, and an element sized to its content would resize on every keystroke. + * See the note in index.css. */ width: 100%; - max-width: 60rem; + min-height: 100vh; + background: var(--ts-page); + color: var(--ts-text); + font-family: var(--font-body), system-ui, sans-serif; + /* Above Cloud's .95rem: Palanquin's small x-height reads too small on large monitors. */ + font-size: 1.0625rem; + line-height: 1.6; +} + +.topbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 1rem 1.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.logo { + display: block; + height: 2rem; + width: auto; +} + +.nav { + display: flex; + gap: 1.25rem; + font-size: 1rem; +} + +.nav a { + color: var(--ts-muted); + text-decoration: none; +} + +.nav a:hover { + color: var(--ts-pink); +} + +.content { + max-width: 72rem; margin: 0 auto; - padding: 3rem 1.5rem 6rem; + padding: 2.5rem 1.5rem 6rem; } .header { - margin-bottom: 2rem; + margin-bottom: 1.5rem; } .heading { - font-size: 1.75rem; - font-weight: 650; - letter-spacing: -0.02em; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 2.25rem; + font-weight: 600; + line-height: 1.2; + color: var(--ts-indigo); margin: 0 0 0.35rem; - text-transform: capitalize; } .subheading { margin: 0; - opacity: 0.6; - font-size: 0.95rem; + color: var(--ts-muted); +} + +.search-root { + margin-bottom: 2rem; } .search-input { width: 100%; - padding: 0.85rem 1rem; - margin-bottom: 2rem; + padding: 0.8rem 1rem; font: inherit; - font-size: 1.05rem; - border-radius: 0.6rem; - border: 1px solid color-mix(in srgb, currentColor 18%, transparent); - background: color-mix(in srgb, currentColor 4%, transparent); + font-size: 1.2rem; color: inherit; + background: var(--ts-page); + border: 1px solid var(--ts-border-strong); + border-radius: 0.375rem; } .search-input:focus { - outline: 2px solid color-mix(in srgb, currentColor 45%, transparent); - outline-offset: 1px; + outline: none; + border-color: var(--ts-pink); + box-shadow: 0 0 0 3px var(--ts-pink-tint); +} + +/* The browser's own clear button is blue and ignores the palette. */ +.search-input::-webkit-search-cancel-button { + appearance: none; } .layout { display: grid; /* - * minmax(0, 1fr) rather than 1fr: a bare `1fr` floors at the column's - * min-content width, and one long title would push the facet sidebar aside. + * minmax(0, 1fr), not 1fr: `1fr` means `minmax(auto, 1fr)`, whose floor is + * the column's min-content width, so one long title would squeeze the facets. */ - grid-template-columns: 14rem minmax(0, 1fr); + grid-template-columns: 16.5rem minmax(0, 1fr); gap: 2.5rem; align-items: start; } -@media (max-width: 40rem) { +@media (max-width: 44rem) { .layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; @@ -66,15 +131,22 @@ .sidebar { position: sticky; - top: 2rem; + top: 1.5rem; + display: flex; + flex-direction: column; + gap: 1.5rem; + padding: 1.25rem; + background: var(--ts-page); + border: 1px solid var(--ts-border); + border-radius: 0.5rem; } .facet-heading { - font-size: 0.7rem; - text-transform: uppercase; - letter-spacing: 0.08em; - opacity: 0.55; - margin: 0 0 0.75rem; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.125rem; + font-weight: 600; + color: var(--ts-text); + margin: 0 0 0.6rem; } .facet-list { @@ -83,8 +155,8 @@ padding: 0; display: flex; flex-direction: column; - gap: 0.4rem; - font-size: 0.9rem; + gap: 0.5rem; + font-size: 1rem; } .facet-label { @@ -94,93 +166,213 @@ cursor: pointer; } +/* The Typesense Cloud checkbox: Bootstrap's custom checkbox, with its sizes, + colors and check mark. */ +.facet-checkbox { + appearance: none; + flex-shrink: 0; + width: 1.35rem; + height: 1.35rem; + margin: 0; + border: 1px solid var(--ts-checkbox-border); + border-radius: 0.375rem; + background: var(--ts-page) 50% / 50% 50% no-repeat; + cursor: pointer; + transition: + background-color 0.15s ease-in-out, + border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out; +} + +.facet-checkbox:checked { + background-color: var(--ts-pink); + border-color: var(--ts-pink); + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23fefefe' d='m6.564.75-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3E%3C/svg%3E"); +} + +.facet-checkbox:focus-visible { + outline: none; + box-shadow: 0 0 0 0.2rem rgba(237, 14, 115, 0.14); +} + +.facet-checkbox:focus-visible:not(:checked) { + border-color: rgba(237, 14, 115, 0.55); +} + +.facet-checkbox:active:not(:checked) { + background-color: #fbb3d3; + border-color: #fbb3d3; +} + +@media (prefers-reduced-motion: reduce) { + .facet-checkbox { + transition: none; + } +} + .facet-count { margin-left: auto; + padding: 0 0.45rem; + font-size: 0.875rem; + color: var(--ts-muted); + background: var(--ts-panel); + border-radius: 1rem; font-variant-numeric: tabular-nums; - font-size: 0.8rem; - opacity: 0.5; } .facet-search { - margin-bottom: 0.75rem; + margin-bottom: 0.6rem; +} + +.facet-search button { + display: none; } .facet-search input { width: 100%; + padding: 0.4rem 0.6rem; font: inherit; - font-size: 0.85rem; - padding: 0.4rem 0.55rem; - border-radius: 0.4rem; - border: 1px solid color-mix(in srgb, currentColor 15%, transparent); - background: transparent; + font-size: 0.95rem; color: inherit; + background: var(--ts-panel); + border: 1px solid var(--ts-border); + border-radius: 0.375rem; } -/* The facet's own search box renders submit and reset buttons; the input is enough. */ -.facet-search button { - display: none; +.facet-search input:focus { + outline: none; + border-color: var(--ts-pink); } .stats { - font-size: 0.8rem; - opacity: 0.55; - margin-bottom: 1rem; - font-variant-numeric: tabular-nums; + font-size: 0.95rem; + color: var(--ts-muted); + margin-bottom: 0.5rem; } .hit-list { list-style: none; margin: 0; padding: 0; - display: flex; - flex-direction: column; - gap: 0.5rem; +} + +.hit-list > li + li { + border-top: 1px solid var(--ts-border); } .hit { display: flex; gap: 1rem; - padding: 0.75rem; - border-radius: 0.6rem; - align-items: center; -} - -.hit:hover { - background: color-mix(in srgb, currentColor 4%, transparent); + padding: 1rem 0; + align-items: flex-start; } .cover { - width: 3rem; - height: 4.5rem; + width: 3.75rem; + height: 5.5rem; object-fit: cover; border-radius: 0.25rem; - background: color-mix(in srgb, currentColor 10%, transparent); + background: var(--ts-panel); flex-shrink: 0; } -/* Flex items refuse to shrink below their content, so a long title would push - the cover out of the row instead of wrapping. */ +/* Flex items refuse to shrink below their content by default; without this a long + title pushes the cover out of the row instead of wrapping. */ .hit-body { min-width: 0; } .title { - font-size: 1rem; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.25rem; font-weight: 600; - margin: 0 0 0.2rem; line-height: 1.3; + margin: 0 0 0.35rem; overflow-wrap: break-word; } -.meta { +/* The typo correction is the point of the demo, so the matched words carry the accent. */ +.title mark { + color: var(--ts-pink); + background: var(--ts-pink-tint); + border-radius: 0.2rem; + padding: 0 0.1rem; +} + +.fields { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 1.25rem; margin: 0; - font-size: 0.875rem; - opacity: 0.7; + font-size: 1rem; +} + +.field { + display: flex; +} + +.field dt { + color: var(--ts-muted); + margin-right: 0.35rem; } -.rating { - margin: 0.15rem 0 0; - font-size: 0.8rem; - opacity: 0.5; +.field dd { + margin: 0; font-variant-numeric: tabular-nums; } + +.error { + margin: 0 0 1.5rem; + padding: 0.75rem 1rem; + border: 1px solid var(--ts-pink); + border-radius: 0.375rem; + background: var(--ts-pink-tint); + font-size: 1rem; +} + +.empty { + margin: 0; + padding: 1rem 0; + color: var(--ts-muted); +} + +.section + .section { + margin-top: 2.5rem; +} + +.section-header { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 1rem; + padding-bottom: 0.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.section-title { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.5rem; + font-weight: 600; + color: var(--ts-indigo); + margin: 0; +} + +.link { + color: var(--ts-pink); + font-size: 1rem; + text-decoration: none; +} + +.link:hover { + text-decoration: underline; +} + +.back { + display: inline-block; + margin-bottom: 1.25rem; +} + +.page a:focus-visible { + outline: 2px solid var(--ts-pink); + outline-offset: 2px; +} diff --git a/templates/qwik/files/src/app.jsx b/templates/qwik/files/src/app.jsx index a8a11af..47b1d4f 100644 --- a/templates/qwik/files/src/app.jsx +++ b/templates/qwik/files/src/app.jsx @@ -1,14 +1,82 @@ import { component$, useSignal, useVisibleTask$ } from '@builder.io/qwik' import instantsearch from 'instantsearch.js' -import { hits, refinementList, searchBox, stats } from 'instantsearch.js/es/widgets' -import { collectionName, searchClient } from './typesense.js' +import { + configure, + hits, + index, + refinementList, + searchBox, + stats, +} from 'instantsearch.js/es/widgets' +import { collections, searchClient } from './typesense.js' import './app.css' +/** + * Every field name below comes from typesense.config.json, so this page works for + * any collection. Change what it shows there, not here. + * + * There is no router: `?collection=&q=` is "Show all in ". + * One collection in the file gets that full page as the home page. + */ +const params = new URLSearchParams(window.location.search) +const only = + collections.length === 1 + ? collections[0] + : collections.find((entry) => entry.name === params.get('collection')) +const initialQuery = params.get('q') ?? '' +document.title = only === undefined ? 'Search | Typesense' : `Search ${only.name} | Typesense` + +function label(field) { + const words = field.replace(/[_-]+/g, ' ') + return words.charAt(0).toUpperCase() + words.slice(1) +} + +function format(value) { + if (Array.isArray(value)) return value.join(', ') + // Not toLocaleString: it would print a year as "2,008". + return value === null || value === undefined ? '' : String(value) +} + +function hitsWidget(container, { name, search }) { + return hits({ + container, + cssClasses: { list: 'hit-list', item: 'hit', emptyRoot: 'empty' }, + templates: { + empty: `No results in ${name}.`, + item: (hit, { html, components }) => { + const image = search.image === null ? '' : format(hit[search.image]) + const details = search.display + .map((field) => [field, format(hit[field])]) + .filter(([, value]) => value !== '') + return html` + ${ + image !== '' && + // Real data has dead image URLs; a broken-image icon helps nobody. + html` (event.currentTarget.style.display = 'none')} + />` + } +
+

${components.Highlight({ hit, attribute: search.title })}

+
+ ${details.map( + ([field, value]) => + html`
${label(field)}
${value}
`, + )} +
+
+ ` + }, + }, + }) +} + export const App = component$(() => { - const searchBoxEl = useSignal() - const statsEl = useSignal() - const authorsEl = useSignal() - const hitsEl = useSignal() + const rootEl = useSignal() /** * InstantSearch runs entirely on the client, inside a visible task. @@ -19,87 +87,155 @@ export const App = component$(() => { * instances. Putting it in a signal would break serialisation. * * So the library keeps its own state in this closure and owns the DOM inside the - * four refs below. Nothing crosses Qwik's boundary, which is also why this file - * needs no $ event handlers. + * containers below, found by their data- attributes. Nothing crosses Qwik's + * boundary, which is also why this file needs no $ event handlers. */ useVisibleTask$(({ cleanup }) => { + const root = rootEl.value + const find = (selector) => root.querySelector(selector) + // The root index carries the query; on the federated page every section is an index(). + const rootIndex = only?.name ?? collections[0].name + const search = instantsearch({ - indexName: collectionName, + indexName: rootIndex, searchClient, + initialUiState: initialQuery === '' ? undefined : { [rootIndex]: { query: initialQuery } }, future: { preserveSharedStateOnUnmount: true }, }) search.addWidgets([ searchBox({ - container: searchBoxEl.value, - placeholder: 'Try "hary potr"', + container: find('[data-searchbox]'), + placeholder: only === undefined ? 'Search' : `Search ${only.name}`, + autofocus: true, // The demo needs neither: results update as you type. showSubmit: false, showReset: false, - cssClasses: { input: 'search-input' }, + cssClasses: { root: 'search-root', input: 'search-input' }, }), + ]) - stats({ - container: statsEl.value, - cssClasses: { root: 'stats' }, - }), + if (only !== undefined) { + search.addWidgets([ + stats({ container: find('[data-stats]'), cssClasses: { root: 'stats' } }), + ...only.search.facets.map((field) => + refinementList({ + container: find(`[data-facet="${CSS.escape(field)}"]`), + attribute: field, + limit: 8, + searchable: true, + searchablePlaceholder: `Filter ${label(field).toLowerCase()}`, + cssClasses: { + list: 'facet-list', + label: 'facet-label', + checkbox: 'facet-checkbox', + count: 'facet-count', + searchBox: 'facet-search', + }, + }), + ), + hitsWidget(find('[data-hits]'), only), + ]) + } else { + search.addWidgets( + collections.map((collection) => + index({ indexName: collection.name, indexId: `section-${collection.name}` }).addWidgets([ + configure({ hitsPerPage: 5 }), + hitsWidget(find(`[data-section="${CSS.escape(collection.name)}"]`), collection), + ]), + ), + ) + } - // One facet, on a field scripts/schema.js marks as facetable. - refinementList({ - container: authorsEl.value, - attribute: 'authors', - limit: 8, - searchable: true, - searchablePlaceholder: 'Filter authors', - cssClasses: { - list: 'facet-list', - label: 'facet-label', - count: 'facet-count', - searchBox: 'facet-search', - }, - }), - - hits({ - container: hitsEl.value, - cssClasses: { list: 'hit-list', item: 'hit' }, - templates: { - item: (hit, { html }) => html` - -
-

${hit.title}

-

${hit.authors.join(', ')} · ${hit.publication_year}

-

- ★ ${hit.average_rating} · ${hit.ratings_count.toLocaleString()} ratings -

-
- `, - }, - }), - ]) + // InstantSearch turns a failed request into zero hits; say what went wrong instead. + const alert = find('[role=alert]') + search.on('error', ({ error }) => { + alert.textContent = `Search failed: ${error.message} Check the field names in typesense.config.json.` + alert.hidden = false + }) + search.on('render', () => { + if (search.status !== 'error') { + alert.hidden = true + alert.textContent = '' + } + // "Show all" keeps whatever is in the search box. + const query = search.getUiState()[rootIndex]?.query ?? '' + for (const link of root.querySelectorAll('[data-show-all]')) { + const target = new URLSearchParams({ collection: link.dataset.showAll }) + if (query !== '') target.set('q', query) + link.href = `?${target}` + } + }) search.start() cleanup(() => search.dispose()) }) + const facets = only !== undefined && only.search.facets.length > 0 + return ( -
-
-

Search {collectionName}

-

Misspell it on purpose. Typesense corrects typos as you type.

+
+
+ + + +
+
+
+

{only === undefined ? 'Search' : `Search ${only.name}`}

+

Misspell it on purpose. Typesense corrects typos as you type.

+
-
+
+
- -
-
-
-
-
-
+ {only === undefined ? ( + collections.map(({ name }) => ( +
+ +
+
+ )) + ) : ( + <> + {collections.length > 1 && ( + + ← All collections + + )} +
+ {facets && ( + + )} +
+
+
+
+
+ + )} +
+ ) }) diff --git a/templates/qwik/files/src/index.css b/templates/qwik/files/src/index.css index f2ce47b..97fb5b2 100644 --- a/templates/qwik/files/src/index.css +++ b/templates/qwik/files/src/index.css @@ -7,9 +7,8 @@ * width in app.css only works if nothing above it fights for the same job. */ :root { - color-scheme: light dark; - font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; - line-height: 1.5; + /* The Typesense palette in app.css is light only. */ + color-scheme: light; } * { diff --git a/templates/qwik/files/src/typesense.js b/templates/qwik/files/src/typesense.js index f3a7a9d..2520285 100644 --- a/templates/qwik/files/src/typesense.js +++ b/templates/qwik/files/src/typesense.js @@ -1,11 +1,12 @@ import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter' +import config from '../typesense.config.json' /** * Connects the browser to Typesense. * * Everything here is read from a VITE_ variable, which means it ships to the * browser. That is deliberate: the only key in this file is the search-only key, - * which can run searches against one collection and nothing else. It cannot add + * which can search the collections in typesense.config.json and nothing else. It cannot add * documents, drop the collection, or create further keys. * * The admin key sits in the same .env file WITHOUT the VITE_ prefix, and Vite @@ -22,7 +23,15 @@ function required(name) { return value } -export const collectionName = required('VITE_TYPESENSE_COLLECTION') +/** + * What the UI searches, facets and shows, per collection: `{ name, search }`, + * where `search` is `{ queryBy, facets, title, image, display }`. Written by + * create-typesense-app; edit freely. + */ +export const collections = config.collections.map(({ name, search }) => ({ name, search })) +if (collections.length === 0) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') +} const adapter = new TypesenseInstantSearchAdapter({ server: { @@ -37,18 +46,16 @@ const adapter = new TypesenseInstantSearchAdapter({ // Results are cached briefly so typing does not re-fetch the same query. cacheSearchResultsForSeconds: 2 * 60, }, - additionalSearchParameters: { - /** - * Which fields a query is matched against. `authors` is here as well as - * `title` so a misspelled author name ("tolkein") finds their books. - * - * Ranking comes from the collection's `default_sorting_field` - * (`ratings_count`, see scripts/schema.js): it breaks ties between equally - * good text matches in favour of the better-known book, which is why - * "hary potr" puts Philosopher's Stone first. - */ - query_by: 'title,authors', - }, + /** + * Which fields a query is matched against, per collection, from + * typesense.config.json. Ranking ties are broken by each schema's + * `default_sorting_field`, which is why "hary potr" puts the best-known Harry + * Potter book first. + */ + additionalSearchParameters: { query_by: collections[0].search.queryBy.join(',') }, + collectionSpecificSearchParameters: Object.fromEntries( + collections.map(({ name, search }) => [name, { query_by: search.queryBy.join(',') }]), + ), }) export const searchClient = adapter.searchClient diff --git a/templates/qwik/template.config.js b/templates/qwik/template.config.js index fb90b16..c83c1e5 100644 --- a/templates/qwik/template.config.js +++ b/templates/qwik/template.config.js @@ -41,8 +41,9 @@ export default { files: 'files/', // The Qwik starter is a landing page. Our app replaces it, which would - // otherwise leave its artwork behind as unreferenced files. - remove: ['src/assets', 'public/icons.svg'], + // otherwise leave its artwork behind as unreferenced files. The overlay's + // public/favicon.png is the Typesense favicon, so the starter's goes too. + remove: ['src/assets', 'public/icons.svg', 'public/favicon.svg'], devCommand: 'npm run dev', devUrl: 'http://localhost:5173', diff --git a/templates/solid/files/index.html b/templates/solid/files/index.html index 3bd25bb..cc5eedc 100644 --- a/templates/solid/files/index.html +++ b/templates/solid/files/index.html @@ -2,9 +2,15 @@ - + - Search books + + + + Search | Typesense
diff --git a/templates/solid/files/public/favicon.png b/templates/solid/files/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..dca9badb45ef5b832e682e4bca90c77c1fc8d671 GIT binary patch literal 34884 zcmXt9by!s2(_f^)1!)24PDNNyx|Z(lZWa{jMmhvUx?z!SSVB^el3rrz5Rep5Qu@7q zf6w~|56?aKp0ji2&V1&~XXeI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i& zz}*`|b6a2=d9`Wo`Zo;&a+D67T0|QKpKQIYRjFg}Lw@=7YF7_r_qjj-I{L4|UO7_J z?y97xegb%+M`hw?4rL}7+`Gy>06no5mXyAa5|FAIk0TTHBLV$$G}O#dFXO?A6~c)ifwuGu0qjlt zb{tEm&D*clB_M&?_hCdf?Xjnx7x}UwTy&6EF`RS;(IoJ>b+EG*>wE@m?7g3~pf|bkP*eNzCi~gl>|_U2!hB%oo_9dXZ&Oz`aZXZZZVo^Uy&;VSW&6 zh6c)HevAQH5|~Vz^;_>|F@FMg8fnRu<0XW)2Ad>`zoHiaBgRymn7JRbk7Q4@$ zDhJuRbwpV(optn1%v5{oxXCN}>>82yw4~@wriC0V7G82fcG{EC=5%+Rjfu(;V530im`sXtEw$;Akj*FAsvLJf+bp5D zQ%q(`QTYqx`rp3&U*Emj|2tcKyMMD=8YHJlN6z4@&b(geF;U zMpnc(Z$2Xie;>3%c*n~kS&F0o7h4xt7z~tc0!@MM zV=}XcGP&jIA~8bj(6_kvJ`_6w>_=oQQdpA5g+382$g+CSQVDk-r=rHJxR4`gf~;6C zP|!#4YS-a;YHs6w1+OG%lc(iub)NLHlHOq!q$9Gd0&O1zM4fqO@NnFCDt7W1=5bmd zWR2LN$C4MtomnD#K$4ZjZ43@BkIMrZb?-r`QyvrMZPT{s$KbSPgms`VV;NP8nbT~F zx*^oDTFZ1<@ZJ~`2OJ;#U=2v0hghx9zWuF|JGv@$c%ckTc+R$TIKyBhGRK6tt(76m zIwf+t8g+Q(MwDk{PM|%oAmQd>zHeV&r_Nf5zJhy!Utt-2K6gEfA7g>swKgbJA11lfU6uCiE7DE)r!k3G|v z)&jS|m%m}C`d!#&8OMG7k08)}ekt=U^>%$JEcx?zUEBHXl4_ErPwJUlD}9+gb>;)B P3I+yGS3j3^P6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/solid/files/scripts/schema.js b/templates/solid/files/scripts/schema.js deleted file mode 100644 index 5468094..0000000 --- a/templates/solid/files/scripts/schema.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * The collection schema — the first file worth editing. - * - * Typesense needs a schema before it can index anything. That requirement is the - * reason this file exists rather than being hidden: change a field here, run - * `npm run seed`, and the collection is rebuilt to match. - * - * Full field reference: https://typesense.org/docs/latest/api/collections.html - */ - -/** Must match VITE_TYPESENSE_COLLECTION in .env. */ -export const collectionName = process.env.VITE_TYPESENSE_COLLECTION ?? 'books' - -export const booksSchema = { - name: collectionName, - fields: [ - // Searched, but not faceted: nobody filters by exact title. - { name: 'title', type: 'string', facet: false }, - - // `string[]` because a book can have several authors. Faceting is what lets - // the sidebar in src/App.jsx offer them as filters. - { name: 'authors', type: 'string[]', facet: true }, - - { name: 'publication_year', type: 'int32', facet: true }, - { name: 'average_rating', type: 'float', facet: true }, - - // Stored so hits can show a cover. Not searched. - { name: 'image_url', type: 'string', facet: false }, - - { name: 'ratings_count', type: 'int32', facet: true }, - ], - - /** - * The tie-breaker, and the reason a misspelling finds the *right* book. - * - * Typesense ranks by text-match score first. When several documents match a - * query equally well — as all seventeen Harry Potter records do for - * "hary potr" — this field decides the order. Sorting by ratings_count puts - * the best-known edition on top. Remove it and the order becomes arbitrary. - */ - default_sorting_field: 'ratings_count', -} diff --git a/templates/solid/files/scripts/seed.js b/templates/solid/files/scripts/seed.js index f3b95f8..3f6de2f 100644 --- a/templates/solid/files/scripts/seed.js +++ b/templates/solid/files/scripts/seed.js @@ -1,8 +1,9 @@ /** * Rebuilds the collection from data/books.jsonl. * - * Idempotent: it drops the collection, recreates it from scripts/schema.js, and - * re-imports every document. Run it after editing the schema or the data. + * Idempotent: it drops the collection, recreates it from the schema in + * typesense.config.json, and re-imports every document. Run it after editing the + * schema or the data. * * npm run seed * @@ -42,8 +43,12 @@ async function loadEnv(file) { async function main() { await loadEnv(ENV_FILE) - // Imported after the env is loaded, since the schema reads the collection name. - const { booksSchema, collectionName } = await import('./schema.js') + const config = JSON.parse(await readFile('typesense.config.json', 'utf8')) + const collection = config.collections[0] + if (collection === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') + } + const collectionName = collection.name const adminApiKey = process.env.TYPESENSE_API_KEY ?? '' if (adminApiKey === '') { @@ -83,8 +88,8 @@ async function main() { // Drop first: Typesense will not retrofit an existing collection to a new schema. await typesense('DELETE', `/collections/${collectionName}`) - await typesense('POST', '/collections', JSON.stringify(booksSchema)) - console.log(' created the collection from scripts/schema.js') + await typesense('POST', '/collections', JSON.stringify(collection.schema)) + console.log(' created the collection from typesense.config.json') const result = await typesense( 'POST', diff --git a/templates/solid/files/src/App.css b/templates/solid/files/src/App.css index 87bfa02..e632880 100644 --- a/templates/solid/files/src/App.css +++ b/templates/solid/files/src/App.css @@ -1,4 +1,19 @@ +/* The tokens follow cloud.typesense.org, and match the other templates. */ + .page { + --ts-page: #fefefe; + --ts-panel: #f7f7fa; + --ts-border: #e6e6ee; + --ts-border-strong: #c9cad6; + --ts-text: #303138; + --ts-muted: #6f7082; + --ts-indigo: #3943b7; + --ts-pink: #ed0e73; + --ts-pink-tint: #fde7f1; + --ts-checkbox-border: #9495a6; + --font-body: "Palanquin"; + --font-heading: "Catamaran"; + /* * Explicit width, not just max-width. Starters style their mount point in ways * a template does not control (Solid's sets #root to a centred flex column), and @@ -6,44 +21,90 @@ * change. See the note in index.css. */ width: 100%; - max-width: 60rem; + min-height: 100vh; + background: var(--ts-page); + color: var(--ts-text); + font-family: var(--font-body), system-ui, sans-serif; + /* Above Cloud's .95rem: Palanquin's small x-height reads too small on large monitors. */ + font-size: 1.0625rem; + line-height: 1.6; +} + +.topbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 1rem 1.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.logo { + display: block; + height: 2rem; + width: auto; +} + +.nav { + display: flex; + gap: 1.25rem; + font-size: 1rem; +} + +.nav a { + color: var(--ts-muted); + text-decoration: none; +} + +.nav a:hover { + color: var(--ts-pink); +} + +.content { + max-width: 72rem; margin: 0 auto; - padding: 3rem 1.5rem 6rem; + padding: 2.5rem 1.5rem 6rem; } .header { - margin-bottom: 2rem; + margin-bottom: 1.5rem; } .heading { - font-size: 1.75rem; - font-weight: 650; - letter-spacing: -0.02em; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 2.25rem; + font-weight: 600; + line-height: 1.2; + color: var(--ts-indigo); margin: 0 0 0.35rem; - text-transform: capitalize; } .subheading { margin: 0; - opacity: 0.6; - font-size: 0.95rem; + color: var(--ts-muted); } .search-input { width: 100%; - padding: 0.85rem 1rem; margin-bottom: 2rem; + padding: 0.8rem 1rem; font: inherit; - font-size: 1.05rem; - border-radius: 0.6rem; - border: 1px solid color-mix(in srgb, currentColor 18%, transparent); - background: color-mix(in srgb, currentColor 4%, transparent); + font-size: 1.2rem; color: inherit; + background: var(--ts-page); + border: 1px solid var(--ts-border-strong); + border-radius: 0.375rem; } .search-input:focus { - outline: 2px solid color-mix(in srgb, currentColor 45%, transparent); - outline-offset: 1px; + outline: none; + border-color: var(--ts-pink); + box-shadow: 0 0 0 3px var(--ts-pink-tint); +} + +/* The browser's own clear button is blue and ignores the palette. */ +.search-input::-webkit-search-cancel-button { + appearance: none; } .layout { @@ -52,12 +113,12 @@ * minmax(0, 1fr) rather than 1fr: a bare `1fr` floors at the column's * min-content width, and one long title would push the facet sidebar aside. */ - grid-template-columns: 14rem minmax(0, 1fr); + grid-template-columns: 16.5rem minmax(0, 1fr); gap: 2.5rem; align-items: start; } -@media (max-width: 40rem) { +@media (max-width: 44rem) { .layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; @@ -66,15 +127,22 @@ .sidebar { position: sticky; - top: 2rem; + top: 1.5rem; + display: flex; + flex-direction: column; + gap: 1.5rem; + padding: 1.25rem; + background: var(--ts-page); + border: 1px solid var(--ts-border); + border-radius: 0.5rem; } .facet-heading { - font-size: 0.7rem; - text-transform: uppercase; - letter-spacing: 0.08em; - opacity: 0.55; - margin: 0 0 0.75rem; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.125rem; + font-weight: 600; + color: var(--ts-text); + margin: 0 0 0.6rem; } .facet-list { @@ -83,8 +151,8 @@ padding: 0; display: flex; flex-direction: column; - gap: 0.4rem; - font-size: 0.9rem; + gap: 0.5rem; + font-size: 1rem; } .facet-label { @@ -94,70 +162,111 @@ cursor: pointer; } +/* The Typesense Cloud checkbox: Bootstrap's custom checkbox, with its sizes, + colors and check mark. */ +.facet-checkbox { + appearance: none; + flex-shrink: 0; + width: 1.35rem; + height: 1.35rem; + margin: 0; + border: 1px solid var(--ts-checkbox-border); + border-radius: 0.375rem; + background: var(--ts-page) 50% / 50% 50% no-repeat; + cursor: pointer; + transition: + background-color 0.15s ease-in-out, + border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out; +} + +.facet-checkbox:checked { + background-color: var(--ts-pink); + border-color: var(--ts-pink); + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23fefefe' d='m6.564.75-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3E%3C/svg%3E"); +} + +.facet-checkbox:focus-visible { + outline: none; + box-shadow: 0 0 0 0.2rem rgba(237, 14, 115, 0.14); +} + +.facet-checkbox:focus-visible:not(:checked) { + border-color: rgba(237, 14, 115, 0.55); +} + +.facet-checkbox:active:not(:checked) { + background-color: #fbb3d3; + border-color: #fbb3d3; +} + +@media (prefers-reduced-motion: reduce) { + .facet-checkbox { + transition: none; + } +} + .facet-count { margin-left: auto; + padding: 0 0.45rem; + font-size: 0.875rem; + color: var(--ts-muted); + background: var(--ts-panel); + border-radius: 1rem; font-variant-numeric: tabular-nums; - font-size: 0.8rem; - opacity: 0.5; } /* * Styled directly, not as `.facet-search input`. The widget-based templates put * this class on the wrapper InstantSearch renders around the input; here the - * markup is ours and the class is on the input itself, so a descendant selector - * matches nothing and the field falls back to the browser's default chrome. + * markup is ours and the class is on the input itself. */ .facet-search { width: 100%; - margin-bottom: 0.75rem; + margin-bottom: 0.6rem; + padding: 0.4rem 0.6rem; font: inherit; - font-size: 0.85rem; - padding: 0.4rem 0.55rem; - border-radius: 0.4rem; - border: 1px solid color-mix(in srgb, currentColor 15%, transparent); - background: transparent; + font-size: 0.95rem; color: inherit; + background: var(--ts-panel); + border: 1px solid var(--ts-border); + border-radius: 0.375rem; } .facet-search:focus { - outline: 2px solid color-mix(in srgb, currentColor 35%, transparent); - outline-offset: 1px; + outline: none; + border-color: var(--ts-pink); } .stats { - font-size: 0.8rem; - opacity: 0.55; - margin-bottom: 1rem; - font-variant-numeric: tabular-nums; + font-size: 0.95rem; + color: var(--ts-muted); + margin: 0 0 0.5rem; } .hit-list { list-style: none; margin: 0; padding: 0; - display: flex; - flex-direction: column; - gap: 0.5rem; +} + +.hit-list > li + li { + border-top: 1px solid var(--ts-border); } .hit { display: flex; gap: 1rem; - padding: 0.75rem; - border-radius: 0.6rem; - align-items: center; -} - -.hit:hover { - background: color-mix(in srgb, currentColor 4%, transparent); + padding: 1rem 0; + align-items: flex-start; } .cover { - width: 3rem; - height: 4.5rem; + width: 3.75rem; + height: 5.5rem; object-fit: cover; border-radius: 0.25rem; - background: color-mix(in srgb, currentColor 10%, transparent); + background: var(--ts-panel); flex-shrink: 0; } @@ -168,22 +277,96 @@ } .title { - font-size: 1rem; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.25rem; font-weight: 600; - margin: 0 0 0.2rem; line-height: 1.3; + margin: 0 0 0.35rem; overflow-wrap: break-word; } -.meta { +/* The typo correction is the point of the demo, so the matched words carry the accent. */ +.title mark { + color: var(--ts-pink); + background: var(--ts-pink-tint); + border-radius: 0.2rem; + padding: 0 0.1rem; +} + +.fields { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 1.25rem; margin: 0; - font-size: 0.875rem; - opacity: 0.7; + font-size: 1rem; +} + +.field { + display: flex; +} + +.field dt { + color: var(--ts-muted); + margin-right: 0.35rem; } -.rating { - margin: 0.15rem 0 0; - font-size: 0.8rem; - opacity: 0.5; +.field dd { + margin: 0; font-variant-numeric: tabular-nums; } + +.error { + margin: 0 0 1.5rem; + padding: 0.75rem 1rem; + border: 1px solid var(--ts-pink); + border-radius: 0.375rem; + background: var(--ts-pink-tint); + font-size: 1rem; +} + +.empty { + margin: 0; + padding: 1rem 0; + color: var(--ts-muted); +} + +.section + .section { + margin-top: 2.5rem; +} + +.section-header { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 1rem; + padding-bottom: 0.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.section-title { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.5rem; + font-weight: 600; + color: var(--ts-indigo); + margin: 0; +} + +.link { + color: var(--ts-pink); + font-size: 1rem; + text-decoration: none; +} + +.link:hover { + text-decoration: underline; +} + +.back { + display: inline-block; + margin-bottom: 1.25rem; +} + +.page a:focus-visible { + outline: 2px solid var(--ts-pink); + outline-offset: 2px; +} diff --git a/templates/solid/files/src/App.jsx b/templates/solid/files/src/App.jsx index 3408ba2..0b7ab6e 100644 --- a/templates/solid/files/src/App.jsx +++ b/templates/solid/files/src/App.jsx @@ -1,4 +1,4 @@ -import { For, createSignal, onCleanup, onMount } from 'solid-js' +import { For, Show, createSignal, onCleanup, onMount } from 'solid-js' import instantsearch from 'instantsearch.js' import { connectHits, @@ -6,113 +6,285 @@ import { connectSearchBox, connectStats, } from 'instantsearch.js/es/connectors' -import { collectionName, searchClient } from './typesense.js' +import { highlight } from 'instantsearch.js/es/helpers' +import { configure, index } from 'instantsearch.js/es/widgets' +import { collections, searchClient } from './typesense.js' import './App.css' -function App() { +/** + * Every field name below comes from typesense.config.json, so these pages work + * for any collection. Change what they show there, not here. + */ +function label(field) { + const words = field.replace(/[_-]+/g, ' ') + return words.charAt(0).toUpperCase() + words.slice(1) +} + +function format(value) { + if (Array.isArray(value)) return value.join(', ') + // Not toLocaleString: it would print a year as "2,008". + return value === null || value === undefined ? '' : String(value) +} + +/** + * Starts one InstantSearch instance for the life of the page. + * + * Connectors are the headless half of InstantSearch: instead of rendering a + * widget, they hand you state and the functions that change it. `connect` maps + * that straight onto a Solid signal, so the markup below is ordinary Solid + * rather than vanilla widgets mounted into empty divs. + */ +function createSearch(indexName, initialQuery) { const search = instantsearch({ - indexName: collectionName, + indexName, searchClient, + initialUiState: initialQuery ? { [indexName]: { query: initialQuery } } : undefined, future: { preserveSharedStateOnUnmount: true }, }) - /** - * Bridges an InstantSearch connector to a Solid signal. - * - * Connectors are the headless half of InstantSearch: instead of rendering a - * widget, they hand you state and the functions that change it. That maps - * straight onto a signal, so the markup below is ordinary Solid rather than - * vanilla widgets mounted into empty divs. - */ - function connect(connector, params = {}) { - const [state, setState] = createSignal() - search.addWidgets([connector((options) => setState(options))(params)]) - return state - } + // InstantSearch turns a failed request into zero hits; keep its error to show it. + const [error, setError] = createSignal() + search.on('error', () => setError(search.error)) + search.on('render', () => setError(search.error)) - const searchBox = connect(connectSearchBox) - const stats = connect(connectStats) - const authors = connect(connectRefinementList, { - attribute: 'authors', - limit: 8, - searchable: true, - }) - const hits = connect(connectHits) - - // Widgets must be registered before the search starts. + // Widgets must be registered before the search starts, so start on mount. onMount(() => search.start()) onCleanup(() => search.dispose()) + return { search, error } +} + +/** `parent` is the InstantSearch instance or an `index` widget inside it. */ +function connect(parent, connector, params = {}) { + const [state, setState] = createSignal() + parent.addWidgets([connector((options) => setState(options))(params)]) + return state +} + +function Hit(props) { + const image = () => (props.search.image === null ? '' : format(props.hit[props.search.image])) + const details = () => + props.search.display + .map((field) => [field, format(props.hit[field])]) + .filter(([, value]) => value !== '') + return ( -
-
-

Search {collectionName}

-

Misspell it on purpose. Typesense corrects typos as you type.

+
  • + + { + event.currentTarget.style.display = 'none' + }} + /> + +
    + {/* The hit values are HTML-escaped by InstantSearch; only is added. */} +

    + +

    +
    + + {([field, value]) => ( +
    +
    {label(field)}
    +
    {value}
    +
    + )} +
    +
    +
    +
  • + ) +} + +function Shell(props) { + // One index.html serves every page, so each page sets its own window title. + document.title = `${props.heading} | Typesense` + return ( +
    +
    + + + +
    +
    +
    +

    {props.heading}

    +

    Misspell it on purpose. Typesense corrects typos as you type.

    +
    + + props.searchBox()?.refine(event.currentTarget.value)} + /> + + + {(error) => ( + + )} + - searchBox()?.refine(event.currentTarget.value)} - /> - -
    -
    +
    + ) +} + +/** One collection with its own facets: the home page when only one is selected. */ +function CollectionPage(props) { + const { name, search: config } = props.collection + const { search, error } = createSearch(name, props.initialQuery) + const searchBox = connect(search, connectSearchBox) + const stats = connect(search, connectStats) + const facets = config.facets.map((field) => ({ + field, + state: connect(search, connectRefinementList, { attribute: field, limit: 8, searchable: true }), + })) + const hits = connect(search, connectHits) + + return ( + + + + ← All collections + + +
    0 ? 'layout' : undefined}> + 0}> + + +

    {(stats()?.nbHits ?? 0).toLocaleString()} results found in{' '} {stats()?.processingTimeMS ?? 0}ms

    -
      - - {(hit) => ( -
    • - -
      -

      {hit.title}

      -

      - {hit.authors.join(', ')} · {hit.publication_year} -

      -

      - ★ {hit.average_rating} · {hit.ratings_count.toLocaleString()} ratings -

      -
      -
    • - )} -
      + {(hit) => }
    -
    + + ) +} + +/** One query, every selected collection: each in its own `index` with its top 5 hits. */ +function FederatedPage() { + // The root index carries the query; every section, its own included, is an `index`. + const { search, error } = createSearch(collections[0].name) + const searchBox = connect(search, connectSearchBox) + const sections = collections.map((collection) => { + const section = index({ indexName: collection.name, indexId: `section-${collection.name}` }) + section.addWidgets([configure({ hitsPerPage: 5 })]) + search.addWidgets([section]) + return { collection, hits: connect(section, connectHits) } + }) + + const href = (name) => { + const query = searchBox()?.query ?? '' + return `?collection=${encodeURIComponent(name)}${query === '' ? '' : `&q=${encodeURIComponent(query)}`}` + } + + return ( + + + {({ collection, hits }) => ( +
    +
    +

    {collection.name}

    + + Show all in {collection.name} + +
    + + {(results) => ( + 0} + fallback={

    No results in {collection.name}.

    } + > +
      + + {(hit) => } + +
    +
    + )} +
    +
    + )} +
    +
    + ) +} + +/** + * One collection: its full page. Several: the federated page, and "Show all in" + * links back to this same page with `?collection=&q=`, since the + * project has no router. + */ +function App() { + const params = new URLSearchParams(location.search) + const chosen = + collections.length === 1 + ? collections[0] + : collections.find((collection) => collection.name === params.get('collection')) + + return chosen === undefined ? ( + + ) : ( + 1} + /> ) } diff --git a/templates/solid/files/src/typesense.js b/templates/solid/files/src/typesense.js index f3a7a9d..c84ce0f 100644 --- a/templates/solid/files/src/typesense.js +++ b/templates/solid/files/src/typesense.js @@ -1,12 +1,13 @@ import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter' +import config from '../typesense.config.json' /** * Connects the browser to Typesense. * * Everything here is read from a VITE_ variable, which means it ships to the * browser. That is deliberate: the only key in this file is the search-only key, - * which can run searches against one collection and nothing else. It cannot add - * documents, drop the collection, or create further keys. + * which can search the collections in typesense.config.json and nothing else. It + * cannot add documents, drop a collection, or create further keys. * * The admin key sits in the same .env file WITHOUT the VITE_ prefix, and Vite * refuses to expose unprefixed variables to client code. Only scripts/seed.js @@ -22,7 +23,15 @@ function required(name) { return value } -export const collectionName = required('VITE_TYPESENSE_COLLECTION') +/** + * What the UI searches, facets and shows, per collection (or alias). Written by + * create-typesense-app; edit freely. + */ +export const collections = config.collections.map(({ name, search }) => ({ name, search })) +const [first] = collections +if (first === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') +} const adapter = new TypesenseInstantSearchAdapter({ server: { @@ -37,18 +46,16 @@ const adapter = new TypesenseInstantSearchAdapter({ // Results are cached briefly so typing does not re-fetch the same query. cacheSearchResultsForSeconds: 2 * 60, }, - additionalSearchParameters: { - /** - * Which fields a query is matched against. `authors` is here as well as - * `title` so a misspelled author name ("tolkein") finds their books. - * - * Ranking comes from the collection's `default_sorting_field` - * (`ratings_count`, see scripts/schema.js): it breaks ties between equally - * good text matches in favour of the better-known book, which is why - * "hary potr" puts Philosopher's Stone first. - */ - query_by: 'title,authors', - }, + /** + * Which fields a query is matched against, per collection, from + * typesense.config.json. Ranking ties are broken by each schema's + * `default_sorting_field`, which is why "hary potr" puts the best-known Harry + * Potter book first. + */ + additionalSearchParameters: { query_by: first.search.queryBy.join(',') }, + collectionSpecificSearchParameters: Object.fromEntries( + collections.map(({ name, search }) => [name, { query_by: search.queryBy.join(',') }]), + ), }) export const searchClient = adapter.searchClient diff --git a/templates/solid/template.config.js b/templates/solid/template.config.js index e458a3d..1607e87 100644 --- a/templates/solid/template.config.js +++ b/templates/solid/template.config.js @@ -27,8 +27,9 @@ export default { files: 'files/', // The Solid starter is a landing page. Our App replaces it, which would - // otherwise leave its artwork behind as unreferenced files. - remove: ['src/assets', 'public/icons.svg'], + // otherwise leave its artwork behind as unreferenced files. favicon.svg goes + // because index.html points at the overlay's Typesense favicon.png. + remove: ['src/assets', 'public/icons.svg', 'public/favicon.svg'], devCommand: 'npm run dev', devUrl: 'http://localhost:5173', diff --git a/templates/vanilla/files/index.html b/templates/vanilla/files/index.html index 325a8c5..2c9b8a7 100644 --- a/templates/vanilla/files/index.html +++ b/templates/vanilla/files/index.html @@ -2,9 +2,15 @@ - + - Search books + + + + Search | Typesense
    diff --git a/templates/vanilla/files/public/favicon.png b/templates/vanilla/files/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..dca9badb45ef5b832e682e4bca90c77c1fc8d671 GIT binary patch literal 34884 zcmXt9by!s2(_f^)1!)24PDNNyx|Z(lZWa{jMmhvUx?z!SSVB^el3rrz5Rep5Qu@7q zf6w~|56?aKp0ji2&V1&~XXeIesL6xzsPI4_5Li(`Rtp4r1pD`gg9VI8rarI$|8UUYvUP@I81gcNOzqP~!fua@^WucLKqGg`b9MYB1r3DGFdNN$L?d38*ATa#mBX^ryLsPsEDX@#4J2X4{ z=4Xz3e#?RITJ0D9Z=+)Tmm{y|u1p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{tEm&D*clB_M&?_hCdf?Xjnx7x}UwTy&6EF`RS;(IoJ>b+EG*>wE@m?7g3~pf|bkP*eNzCi~gl>|_U2!hB%oo_9dXZ&Oz`aZXZZZVo^Uy&;VSW&6 zh6c)HevAQH5|~Vz^;_>|F@FMg8fnRu<0XW)2Ad>`zoHiaBgRymn7JRbk7Q4@$ zDhJuRbwpV(optn1%v5{oxXCN}>>82yw4~@wriC0V7G82fcG{EC=5%+Rjfu(;V530im`sXtEw$;Akj*FAsvLJf+bp5D zQ%q(`QTYqx`rp3&U*Emj|2tcKyMMD=8YHJlN6z4@&b(geF;U zMpnc(Z$2Xie;>3%c*n~kS&F0o7h4xt7z~tc0!@MM zV=}XcGP&jIA~8bj(6_kvJ`_6w>_=oQQdpA5g+382$g+CSQVDk-r=rHJxR4`gf~;6C zP|!#4YS-a;YHs6w1+OG%lc(iub)NLHlHOq!q$9Gd0&O1zM4fqO@NnFCDt7W1=5bmd zWR2LN$C4MtomnD#K$4ZjZ43@BkIMrZb?-r`QyvrMZPT{s$KbSPgms`VV;NP8nbT~F zx*^oDTFZ1<@ZJ~`2OJ;#U=2v0hghx9zWuF|JGv@$c%ckTc+R$TIKyBhGRK6tt(76m zIwf+t8g+Q(MwDk{PM|%oAmQd>zHeV&r_Nf5zJhy!Utt-2K6gEfA7g>swKgbJA11lfU6uCiE7DE)r!k3G|v z)&jS|m%m}C`d!#&8OMG7k08)}ekt=U^>%$JEcx?zUEBHXl4_ErPwJUlD}9+gb>;)B P3I+yGS3j3^P6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/vanilla/files/scripts/schema.js b/templates/vanilla/files/scripts/schema.js deleted file mode 100644 index 7e89f58..0000000 --- a/templates/vanilla/files/scripts/schema.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * The collection schema — the first file worth editing. - * - * Typesense needs a schema before it can index anything. That requirement is the - * reason this file exists rather than being hidden: change a field here, run - * `npm run seed`, and the collection is rebuilt to match. - * - * Full field reference: https://typesense.org/docs/latest/api/collections.html - */ - -/** Must match VITE_TYPESENSE_COLLECTION in .env. */ -export const collectionName = process.env.VITE_TYPESENSE_COLLECTION ?? 'books' - -export const booksSchema = { - name: collectionName, - fields: [ - // Searched, but not faceted: nobody filters by exact title. - { name: 'title', type: 'string', facet: false }, - - // `string[]` because a book can have several authors. Faceting is what lets - // the sidebar in src/main.js offer them as filters. - { name: 'authors', type: 'string[]', facet: true }, - - { name: 'publication_year', type: 'int32', facet: true }, - { name: 'average_rating', type: 'float', facet: true }, - - // Stored so hits can show a cover. Not searched. - { name: 'image_url', type: 'string', facet: false }, - - { name: 'ratings_count', type: 'int32', facet: true }, - ], - - /** - * The tie-breaker, and the reason a misspelling finds the *right* book. - * - * Typesense ranks by text-match score first. When several documents match a - * query equally well — as all seventeen Harry Potter records do for - * "hary potr" — this field decides the order. Sorting by ratings_count puts - * the best-known edition on top. Remove it and the order becomes arbitrary. - */ - default_sorting_field: 'ratings_count', -} diff --git a/templates/vanilla/files/scripts/seed.js b/templates/vanilla/files/scripts/seed.js index f3b95f8..3f6de2f 100644 --- a/templates/vanilla/files/scripts/seed.js +++ b/templates/vanilla/files/scripts/seed.js @@ -1,8 +1,9 @@ /** * Rebuilds the collection from data/books.jsonl. * - * Idempotent: it drops the collection, recreates it from scripts/schema.js, and - * re-imports every document. Run it after editing the schema or the data. + * Idempotent: it drops the collection, recreates it from the schema in + * typesense.config.json, and re-imports every document. Run it after editing the + * schema or the data. * * npm run seed * @@ -42,8 +43,12 @@ async function loadEnv(file) { async function main() { await loadEnv(ENV_FILE) - // Imported after the env is loaded, since the schema reads the collection name. - const { booksSchema, collectionName } = await import('./schema.js') + const config = JSON.parse(await readFile('typesense.config.json', 'utf8')) + const collection = config.collections[0] + if (collection === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') + } + const collectionName = collection.name const adminApiKey = process.env.TYPESENSE_API_KEY ?? '' if (adminApiKey === '') { @@ -83,8 +88,8 @@ async function main() { // Drop first: Typesense will not retrofit an existing collection to a new schema. await typesense('DELETE', `/collections/${collectionName}`) - await typesense('POST', '/collections', JSON.stringify(booksSchema)) - console.log(' created the collection from scripts/schema.js') + await typesense('POST', '/collections', JSON.stringify(collection.schema)) + console.log(' created the collection from typesense.config.json') const result = await typesense( 'POST', diff --git a/templates/vanilla/files/src/main.js b/templates/vanilla/files/src/main.js index b5743a7..e2bb9b2 100644 --- a/templates/vanilla/files/src/main.js +++ b/templates/vanilla/files/src/main.js @@ -1,82 +1,244 @@ import './style.css' import instantsearch from 'instantsearch.js' -import { hits, refinementList, searchBox, stats } from 'instantsearch.js/es/widgets' -import { collectionName, searchClient } from './typesense.js' - -document.querySelector('#app').innerHTML = ` -
    -
    -

    Search ${collectionName}

    -

    Misspell it on purpose. Typesense corrects typos as you type.

    -
    - - - -
    - -
    -
    -
    -
    -
    -
    -` +import { + configure, + hits, + index, + refinementList, + searchBox, + stats, +} from 'instantsearch.js/es/widgets' +import { collections, searchClient } from './typesense.js' + +/** + * Every field name below comes from typesense.config.json, so this page works for + * any collection. Change what it shows there, not here. + * + * One collection: its full page. Several: one section each, and + * `?collection=&q=` for "Show all in " (there is no router). + */ +function element(tag, className, text) { + const node = document.createElement(tag) + if (className) node.className = className + if (text !== undefined) node.textContent = text + return node +} + +function label(field) { + const words = field.replace(/[_-]+/g, ' ') + return words.charAt(0).toUpperCase() + words.slice(1) +} + +function format(value) { + if (Array.isArray(value)) return value.join(', ') + // Not toLocaleString: it would print a year as "2,008". + return value === null || value === undefined ? '' : String(value) +} + +function hitTemplate(search) { + return (hit, { html, components }) => { + const image = search.image === null ? '' : format(hit[search.image]) + const details = search.display + .map((field) => [field, format(hit[field])]) + .filter(([, value]) => value !== '') + return html` + ${ + image !== '' && + html` { + // Real data has dead image URLs; a broken-image icon helps nobody. + event.currentTarget.style.display = 'none' + }} + />` + } +
    +

    ${components.Highlight({ attribute: search.title, hit })}

    +
    + ${details.map( + ([field, value]) => + html`
    ${label(field)}
    ${value}
    `, + )} +
    +
    + ` + } +} + +const hitClasses = { list: 'hit-list', item: 'hit' } + +const params = new URLSearchParams(window.location.search) +const [first] = collections +const selected = + collections.length === 1 + ? first + : collections.find((collection) => collection.name === params.get('collection')) +// The root index carries the query; on the federated page every section is an index(). +const rootIndex = selected?.name ?? first.name +const heading = selected === undefined ? 'Search' : `Search ${selected.name}` +const initialQuery = params.get('q') ?? '' + +document.title = `${heading} | Typesense` + +const topbar = element('header', 'topbar') +const home = element('a') +home.href = 'https://typesense.org' +home.setAttribute('aria-label', 'Typesense') +const logo = element('img', 'logo') +logo.src = '/typesense-logo.svg' +logo.alt = 'Typesense' +home.append(logo) +const nav = element('nav', 'nav') +for (const [text, href] of [ + ['docs', 'https://typesense.org/docs/'], + ['github', 'https://github.com/typesense/typesense'], + ['cloud', 'https://cloud.typesense.org'], +]) { + const link = element('a', undefined, text) + link.href = href + nav.append(link) +} +topbar.append(home, nav) + +const page = element('main', 'content') +const header = element('div', 'header') +header.append( + element('h1', 'heading', heading), + element('p', 'subheading', 'Misspell it on purpose. Typesense corrects typos as you type.'), +) +const searchboxContainer = element('div') +const alert = element('p', 'error') +alert.setAttribute('role', 'alert') +alert.hidden = true +page.append(header, searchboxContainer, alert) +const shell = element('div', 'page') +shell.append(topbar, page) +document.querySelector('#app').replaceChildren(shell) const search = instantsearch({ - indexName: collectionName, + indexName: rootIndex, searchClient, + initialUiState: initialQuery === '' ? undefined : { [rootIndex]: { query: initialQuery } }, future: { preserveSharedStateOnUnmount: true }, }) search.addWidgets([ searchBox({ - container: '#searchbox', - placeholder: 'Try "hary potr"', + container: searchboxContainer, + placeholder: heading, + autofocus: true, // The demo needs neither: results update as you type. showSubmit: false, showReset: false, - cssClasses: { input: 'search-input' }, + cssClasses: { root: 'search-root', input: 'search-input' }, }), +]) - stats({ - container: '#stats', - cssClasses: { root: 'stats' }, - }), +if (selected !== undefined) { + const { search: config } = selected + if (collections.length > 1) { + const back = element('a', 'link back', '← All collections') + back.href = window.location.pathname + page.append(back) + } - // One facet, on a field scripts/schema.js marks as facetable. - refinementList({ - container: '#authors', - attribute: 'authors', - limit: 8, - searchable: true, - searchablePlaceholder: 'Filter authors', - cssClasses: { - list: 'facet-list', - label: 'facet-label', - count: 'facet-count', - searchBox: 'facet-search', - }, - }), + const facets = config.facets.length > 0 + const layout = element('div', facets ? 'layout' : undefined) + if (facets) { + const sidebar = element('aside', 'sidebar') + for (const field of config.facets) { + const section = element('section') + const container = element('div') + section.append(element('h2', 'facet-heading', label(field)), container) + sidebar.append(section) + search.addWidgets([ + refinementList({ + container, + attribute: field, + limit: 8, + searchable: true, + searchablePlaceholder: `Filter ${label(field).toLowerCase()}`, + cssClasses: { + list: 'facet-list', + label: 'facet-label', + checkbox: 'facet-checkbox', + count: 'facet-count', + searchBox: 'facet-search', + }, + }), + ]) + } + layout.append(sidebar) + } - hits({ - container: '#hits', - cssClasses: { list: 'hit-list', item: 'hit' }, - templates: { - item: (hit, { html }) => html` - -
    -

    ${hit.title}

    -

    ${hit.authors.join(', ')} · ${hit.publication_year}

    -

    - ★ ${hit.average_rating} · ${hit.ratings_count.toLocaleString()} ratings -

    -
    - `, - }, - }), -]) + const results = element('section') + const statsContainer = element('div') + const hitsContainer = element('div') + results.append(statsContainer, hitsContainer) + layout.append(results) + page.append(layout) + + search.addWidgets([ + stats({ container: statsContainer, cssClasses: { root: 'stats' } }), + hits({ + container: hitsContainer, + cssClasses: hitClasses, + templates: { item: hitTemplate(config) }, + }), + ]) +} else { + const links = [] + for (const { name, search: config } of collections) { + const section = element('section', 'section') + const sectionHeader = element('div', 'section-header') + const link = element('a', 'link', `Show all in ${name}`) + const hitsContainer = element('div') + sectionHeader.append(element('h2', 'section-title', name), link) + section.append(sectionHeader, hitsContainer) + page.append(section) + links.push([link, name]) + + search.addWidgets([ + index({ indexName: name, indexId: `section-${name}` }).addWidgets([ + configure({ hitsPerPage: 5 }), + hits({ + container: hitsContainer, + cssClasses: hitClasses, + templates: { + item: hitTemplate(config), + empty: (_, { html }) => html`

    No results in ${name}.

    `, + }, + }), + ]), + ]) + } + + // Each link keeps whatever is in the search box when it is clicked. + search.on('render', () => { + const query = search.getUiState()[rootIndex]?.query ?? '' + for (const [link, name] of links) { + const target = new URLSearchParams({ collection: name }) + if (query !== '') target.set('q', query) + link.href = `?${target}` + } + }) +} + +/** InstantSearch turns a failed request into zero hits; say what went wrong instead. */ +function showError(error) { + alert.hidden = error === undefined + alert.textContent = + error === undefined + ? '' + : `Search failed: ${error.message} Check the field names in typesense.config.json.` +} +// Listening also stops InstantSearch re-throwing the error as uncaught. +search.on('error', showError) +search.on('render', () => { + if (search.status !== 'error') showError(undefined) +}) search.start() diff --git a/templates/vanilla/files/src/style.css b/templates/vanilla/files/src/style.css index 187af5f..d5760fe 100644 --- a/templates/vanilla/files/src/style.css +++ b/templates/vanilla/files/src/style.css @@ -1,8 +1,4 @@ -:root { - color-scheme: light dark; - font-family: system-ui, -apple-system, "Segoe UI", sans-serif; - line-height: 1.5; -} +/* The tokens follow cloud.typesense.org. */ * { box-sizing: border-box; @@ -13,64 +9,122 @@ body { } .page { - /* - * Explicit width, not just max-width. Frameworks style `body` in ways a - * template does not control, and an element sized to fit-content would resize - * on every keystroke as results change. - */ + --ts-page: #fefefe; + --ts-panel: #f7f7fa; + --ts-border: #e6e6ee; + --ts-border-strong: #c9cad6; + --ts-text: #303138; + --ts-muted: #6f7082; + --ts-indigo: #3943b7; + --ts-pink: #ed0e73; + --ts-pink-tint: #fde7f1; + --ts-checkbox-border: #9495a6; + /* Loaded from Google Fonts in index.html: the Typesense Cloud dashboard's typefaces. */ + --font-body: "Palanquin"; + --font-heading: "Catamaran"; + width: 100%; - max-width: 60rem; + min-height: 100vh; + background: var(--ts-page); + color: var(--ts-text); + font-family: var(--font-body), system-ui, sans-serif; + /* Above Cloud's .95rem: Palanquin's small x-height reads too small on large monitors. */ + font-size: 1.0625rem; + line-height: 1.6; +} + +.topbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 1rem 1.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.logo { + display: block; + height: 2rem; + width: auto; +} + +.nav { + display: flex; + gap: 1.25rem; + font-size: 1rem; +} + +.nav a { + color: var(--ts-muted); + text-decoration: none; +} + +.nav a:hover { + color: var(--ts-pink); +} + +.content { + max-width: 72rem; margin: 0 auto; - padding: 3rem 1.5rem 6rem; + padding: 2.5rem 1.5rem 6rem; } .header { - margin-bottom: 2rem; + margin-bottom: 1.5rem; } .heading { - font-size: 1.75rem; - font-weight: 650; - letter-spacing: -0.02em; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 2.25rem; + font-weight: 600; + line-height: 1.2; + color: var(--ts-indigo); margin: 0 0 0.35rem; - text-transform: capitalize; } .subheading { margin: 0; - opacity: 0.6; - font-size: 0.95rem; + color: var(--ts-muted); +} + +.search-root { + margin-bottom: 2rem; } .search-input { width: 100%; - padding: 0.85rem 1rem; - margin-bottom: 2rem; + padding: 0.8rem 1rem; font: inherit; - font-size: 1.05rem; - border-radius: 0.6rem; - border: 1px solid color-mix(in srgb, currentColor 18%, transparent); - background: color-mix(in srgb, currentColor 4%, transparent); + font-size: 1.2rem; color: inherit; + background: var(--ts-page); + border: 1px solid var(--ts-border-strong); + border-radius: 0.375rem; } .search-input:focus { - outline: 2px solid color-mix(in srgb, currentColor 45%, transparent); - outline-offset: 1px; + outline: none; + border-color: var(--ts-pink); + box-shadow: 0 0 0 3px var(--ts-pink-tint); +} + +/* The browser's own clear button is blue and ignores the palette. */ +.search-input::-webkit-search-cancel-button { + appearance: none; } .layout { display: grid; /* - * minmax(0, 1fr) rather than 1fr: a bare `1fr` floors at the column's - * min-content width, and one long title would push the facet sidebar aside. + * minmax(0, 1fr), not 1fr: `1fr` means `minmax(auto, 1fr)`, whose floor is + * the column's min-content width, so one long title would squeeze the facets. */ - grid-template-columns: 14rem minmax(0, 1fr); + grid-template-columns: 16.5rem minmax(0, 1fr); gap: 2.5rem; align-items: start; } -@media (max-width: 40rem) { +@media (max-width: 44rem) { .layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; @@ -79,15 +133,22 @@ body { .sidebar { position: sticky; - top: 2rem; + top: 1.5rem; + display: flex; + flex-direction: column; + gap: 1.5rem; + padding: 1.25rem; + background: var(--ts-page); + border: 1px solid var(--ts-border); + border-radius: 0.5rem; } .facet-heading { - font-size: 0.7rem; - text-transform: uppercase; - letter-spacing: 0.08em; - opacity: 0.55; - margin: 0 0 0.75rem; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.125rem; + font-weight: 600; + color: var(--ts-text); + margin: 0 0 0.6rem; } .facet-list { @@ -96,8 +157,8 @@ body { padding: 0; display: flex; flex-direction: column; - gap: 0.4rem; - font-size: 0.9rem; + gap: 0.5rem; + font-size: 1rem; } .facet-label { @@ -107,93 +168,213 @@ body { cursor: pointer; } +/* The Typesense Cloud checkbox: Bootstrap's custom checkbox, with its sizes, + colors and check mark. */ +.facet-checkbox { + appearance: none; + flex-shrink: 0; + width: 1.35rem; + height: 1.35rem; + margin: 0; + border: 1px solid var(--ts-checkbox-border); + border-radius: 0.375rem; + background: var(--ts-page) 50% / 50% 50% no-repeat; + cursor: pointer; + transition: + background-color 0.15s ease-in-out, + border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out; +} + +.facet-checkbox:checked { + background-color: var(--ts-pink); + border-color: var(--ts-pink); + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23fefefe' d='m6.564.75-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3E%3C/svg%3E"); +} + +.facet-checkbox:focus-visible { + outline: none; + box-shadow: 0 0 0 0.2rem rgba(237, 14, 115, 0.14); +} + +.facet-checkbox:focus-visible:not(:checked) { + border-color: rgba(237, 14, 115, 0.55); +} + +.facet-checkbox:active:not(:checked) { + background-color: #fbb3d3; + border-color: #fbb3d3; +} + +@media (prefers-reduced-motion: reduce) { + .facet-checkbox { + transition: none; + } +} + .facet-count { margin-left: auto; + padding: 0 0.45rem; + font-size: 0.875rem; + color: var(--ts-muted); + background: var(--ts-panel); + border-radius: 1rem; font-variant-numeric: tabular-nums; - font-size: 0.8rem; - opacity: 0.5; } .facet-search { - margin-bottom: 0.75rem; + margin-bottom: 0.6rem; +} + +.facet-search button { + display: none; } .facet-search input { width: 100%; + padding: 0.4rem 0.6rem; font: inherit; - font-size: 0.85rem; - padding: 0.4rem 0.55rem; - border-radius: 0.4rem; - border: 1px solid color-mix(in srgb, currentColor 15%, transparent); - background: transparent; + font-size: 0.95rem; color: inherit; + background: var(--ts-panel); + border: 1px solid var(--ts-border); + border-radius: 0.375rem; } -/* The facet's own search box renders submit and reset buttons; the input is enough. */ -.facet-search button { - display: none; +.facet-search input:focus { + outline: none; + border-color: var(--ts-pink); } .stats { - font-size: 0.8rem; - opacity: 0.55; - margin-bottom: 1rem; - font-variant-numeric: tabular-nums; + font-size: 0.95rem; + color: var(--ts-muted); + margin-bottom: 0.5rem; } .hit-list { list-style: none; margin: 0; padding: 0; - display: flex; - flex-direction: column; - gap: 0.5rem; +} + +.hit-list > li + li { + border-top: 1px solid var(--ts-border); } .hit { display: flex; gap: 1rem; - padding: 0.75rem; - border-radius: 0.6rem; - align-items: center; -} - -.hit:hover { - background: color-mix(in srgb, currentColor 4%, transparent); + padding: 1rem 0; + align-items: flex-start; } .cover { - width: 3rem; - height: 4.5rem; + width: 3.75rem; + height: 5.5rem; object-fit: cover; border-radius: 0.25rem; - background: color-mix(in srgb, currentColor 10%, transparent); + background: var(--ts-panel); flex-shrink: 0; } -/* Flex items refuse to shrink below their content, so a long title would push - the cover out of the row instead of wrapping. */ +/* Flex items refuse to shrink below their content by default; without this a long + title pushes the cover out of the row instead of wrapping. */ .hit-body { min-width: 0; } .title { - font-size: 1rem; + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.25rem; font-weight: 600; - margin: 0 0 0.2rem; line-height: 1.3; + margin: 0 0 0.35rem; overflow-wrap: break-word; } -.meta { +/* The typo correction is the point of the demo, so the matched words carry the accent. */ +.title mark { + color: var(--ts-pink); + background: var(--ts-pink-tint); + border-radius: 0.2rem; + padding: 0 0.1rem; +} + +.fields { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 1.25rem; margin: 0; - font-size: 0.875rem; - opacity: 0.7; + font-size: 1rem; +} + +.field { + display: flex; +} + +.field dt { + color: var(--ts-muted); + margin-right: 0.35rem; } -.rating { - margin: 0.15rem 0 0; - font-size: 0.8rem; - opacity: 0.5; +.field dd { + margin: 0; font-variant-numeric: tabular-nums; } + +.error { + margin: 0 0 1.5rem; + padding: 0.75rem 1rem; + border: 1px solid var(--ts-pink); + border-radius: 0.375rem; + background: var(--ts-pink-tint); + font-size: 1rem; +} + +.empty { + margin: 0; + padding: 1rem 0; + color: var(--ts-muted); +} + +.section + .section { + margin-top: 2.5rem; +} + +.section-header { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 1rem; + padding-bottom: 0.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.section-title { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.5rem; + font-weight: 600; + color: var(--ts-indigo); + margin: 0; +} + +.link { + color: var(--ts-pink); + font-size: 1rem; + text-decoration: none; +} + +.link:hover { + text-decoration: underline; +} + +.back { + display: inline-block; + margin-bottom: 1.25rem; +} + +.page a:focus-visible { + outline: 2px solid var(--ts-pink); + outline-offset: 2px; +} diff --git a/templates/vanilla/files/src/typesense.js b/templates/vanilla/files/src/typesense.js index f3a7a9d..6ea599a 100644 --- a/templates/vanilla/files/src/typesense.js +++ b/templates/vanilla/files/src/typesense.js @@ -1,12 +1,13 @@ import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter' +import config from '../typesense.config.json' /** * Connects the browser to Typesense. * * Everything here is read from a VITE_ variable, which means it ships to the * browser. That is deliberate: the only key in this file is the search-only key, - * which can run searches against one collection and nothing else. It cannot add - * documents, drop the collection, or create further keys. + * which can search the collections in typesense.config.json and nothing else. It + * cannot add documents, drop a collection, or create further keys. * * The admin key sits in the same .env file WITHOUT the VITE_ prefix, and Vite * refuses to expose unprefixed variables to client code. Only scripts/seed.js @@ -22,7 +23,16 @@ function required(name) { return value } -export const collectionName = required('VITE_TYPESENSE_COLLECTION') +/** + * What the UI searches, facets and shows, per collection (or alias): `search` has + * queryBy, facets, title, image and display. Written by create-typesense-app; + * edit freely. + */ +export const collections = config.collections.map(({ name, search }) => ({ name, search })) +const [first] = collections +if (first === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') +} const adapter = new TypesenseInstantSearchAdapter({ server: { @@ -37,18 +47,16 @@ const adapter = new TypesenseInstantSearchAdapter({ // Results are cached briefly so typing does not re-fetch the same query. cacheSearchResultsForSeconds: 2 * 60, }, - additionalSearchParameters: { - /** - * Which fields a query is matched against. `authors` is here as well as - * `title` so a misspelled author name ("tolkein") finds their books. - * - * Ranking comes from the collection's `default_sorting_field` - * (`ratings_count`, see scripts/schema.js): it breaks ties between equally - * good text matches in favour of the better-known book, which is why - * "hary potr" puts Philosopher's Stone first. - */ - query_by: 'title,authors', - }, + /** + * Which fields a query is matched against, per collection, from + * typesense.config.json. Ranking ties are broken by each schema's + * `default_sorting_field`, which is why "hary potr" puts the best-known Harry + * Potter book first. + */ + additionalSearchParameters: { query_by: first.search.queryBy.join(',') }, + collectionSpecificSearchParameters: Object.fromEntries( + collections.map(({ name, search }) => [name, { query_by: search.queryBy.join(',') }]), + ), }) export const searchClient = adapter.searchClient diff --git a/templates/vanilla/template.config.js b/templates/vanilla/template.config.js index f0a45b8..a6cc5c5 100644 --- a/templates/vanilla/template.config.js +++ b/templates/vanilla/template.config.js @@ -29,7 +29,8 @@ export default { files: 'files/', // The Vite starter is a landing page. Our entry point replaces it, which would // otherwise leave its counter and artwork behind as unreferenced files. - remove: ['src/counter.js', 'src/assets', 'public/icons.svg'], + // public/favicon.svg goes because index.html now points at the overlay's favicon.png. + remove: ['src/counter.js', 'src/assets', 'public/icons.svg', 'public/favicon.svg'], devCommand: 'npm run dev', devUrl: 'http://localhost:5173', From 049ce1ef61b154af09eb39716cca0208915ebfbe Mon Sep 17 00:00:00 2001 From: Nikhil Adiga Date: Mon, 23 Nov 2026 17:21:32 +0530 Subject: [PATCH 03/16] Add React, Vue, SvelteKit and Angular templates --- templates/angular/files/angular.json | 79 ++++ .../angular/files/builders/application.js | 8 + .../files/builders/application.schema.json | 9 + .../angular/files/builders/builders.json | 14 + .../angular/files/builders/dev-server.js | 15 + .../files/builders/dev-server.schema.json | 18 + templates/angular/files/builders/env.js | 35 ++ templates/angular/files/builders/package.json | 4 + templates/angular/files/public/favicon.png | Bin 0 -> 34884 bytes .../angular/files/public/typesense-logo.svg | 144 +++++++ templates/angular/files/scripts/seed.mjs | 186 +++++++++ templates/angular/files/src/app/app.html | 127 ++++++ templates/angular/files/src/app/app.ts | 161 +++++++ templates/angular/files/src/env.d.ts | 4 + templates/angular/files/src/index.html | 17 + templates/angular/files/src/styles.css | 380 +++++++++++++++++ templates/angular/files/src/typesense.ts | 74 ++++ templates/angular/template.config.js | 40 ++ templates/react/files/index.html | 20 + templates/react/files/public/favicon.png | Bin 0 -> 34884 bytes .../react/files/public/typesense-logo.svg | 144 +++++++ templates/react/files/scripts/seed.ts | 205 +++++++++ templates/react/files/src/App.tsx | 42 ++ templates/react/files/src/main.tsx | 11 + templates/react/files/src/search.module.css | 390 +++++++++++++++++ templates/react/files/src/search.tsx | 245 +++++++++++ templates/react/files/src/typesense.ts | 76 ++++ templates/react/template.config.js | 37 ++ templates/sveltekit/files/scripts/seed.ts | 205 +++++++++ templates/sveltekit/files/src/env.ts | 25 ++ .../sveltekit/files/src/lib/Search.svelte | 217 ++++++++++ templates/sveltekit/files/src/lib/search.css | 392 ++++++++++++++++++ .../sveltekit/files/src/lib/typesense.ts | 66 +++ .../sveltekit/files/src/routes/+layout.svelte | 18 + .../sveltekit/files/src/routes/+layout.ts | 2 + .../sveltekit/files/src/routes/+page.svelte | 7 + .../routes/collections/[name]/+page.svelte | 11 + .../src/routes/collections/[name]/+page.ts | 12 + templates/sveltekit/files/static/favicon.png | Bin 0 -> 34884 bytes .../sveltekit/files/static/typesense-logo.svg | 144 +++++++ templates/sveltekit/template.config.js | 40 ++ templates/vue/files/index.html | 19 + templates/vue/files/public/favicon.png | Bin 0 -> 34884 bytes templates/vue/files/public/typesense-logo.svg | 144 +++++++ templates/vue/files/scripts/seed.js | 186 +++++++++ templates/vue/files/src/App.vue | 84 ++++ .../files/src/components/CollectionPage.vue | 38 ++ .../vue/files/src/components/DocumentHit.vue | 36 ++ .../files/src/components/FederatedPage.vue | 44 ++ templates/vue/files/src/style.css | 387 +++++++++++++++++ templates/vue/files/src/typesense.ts | 86 ++++ .../vue/files/src/vue-instantsearch.d.ts | 12 + templates/vue/template.config.js | 38 ++ 53 files changed, 4698 insertions(+) create mode 100644 templates/angular/files/angular.json create mode 100644 templates/angular/files/builders/application.js create mode 100644 templates/angular/files/builders/application.schema.json create mode 100644 templates/angular/files/builders/builders.json create mode 100644 templates/angular/files/builders/dev-server.js create mode 100644 templates/angular/files/builders/dev-server.schema.json create mode 100644 templates/angular/files/builders/env.js create mode 100644 templates/angular/files/builders/package.json create mode 100644 templates/angular/files/public/favicon.png create mode 100644 templates/angular/files/public/typesense-logo.svg create mode 100644 templates/angular/files/scripts/seed.mjs create mode 100644 templates/angular/files/src/app/app.html create mode 100644 templates/angular/files/src/app/app.ts create mode 100644 templates/angular/files/src/env.d.ts create mode 100644 templates/angular/files/src/index.html create mode 100644 templates/angular/files/src/styles.css create mode 100644 templates/angular/files/src/typesense.ts create mode 100644 templates/angular/template.config.js create mode 100644 templates/react/files/index.html create mode 100644 templates/react/files/public/favicon.png create mode 100644 templates/react/files/public/typesense-logo.svg create mode 100644 templates/react/files/scripts/seed.ts create mode 100644 templates/react/files/src/App.tsx create mode 100644 templates/react/files/src/main.tsx create mode 100644 templates/react/files/src/search.module.css create mode 100644 templates/react/files/src/search.tsx create mode 100644 templates/react/files/src/typesense.ts create mode 100644 templates/react/template.config.js create mode 100644 templates/sveltekit/files/scripts/seed.ts create mode 100644 templates/sveltekit/files/src/env.ts create mode 100644 templates/sveltekit/files/src/lib/Search.svelte create mode 100644 templates/sveltekit/files/src/lib/search.css create mode 100644 templates/sveltekit/files/src/lib/typesense.ts create mode 100644 templates/sveltekit/files/src/routes/+layout.svelte create mode 100644 templates/sveltekit/files/src/routes/+layout.ts create mode 100644 templates/sveltekit/files/src/routes/+page.svelte create mode 100644 templates/sveltekit/files/src/routes/collections/[name]/+page.svelte create mode 100644 templates/sveltekit/files/src/routes/collections/[name]/+page.ts create mode 100644 templates/sveltekit/files/static/favicon.png create mode 100644 templates/sveltekit/files/static/typesense-logo.svg create mode 100644 templates/sveltekit/template.config.js create mode 100644 templates/vue/files/index.html create mode 100644 templates/vue/files/public/favicon.png create mode 100644 templates/vue/files/public/typesense-logo.svg create mode 100644 templates/vue/files/scripts/seed.js create mode 100644 templates/vue/files/src/App.vue create mode 100644 templates/vue/files/src/components/CollectionPage.vue create mode 100644 templates/vue/files/src/components/DocumentHit.vue create mode 100644 templates/vue/files/src/components/FederatedPage.vue create mode 100644 templates/vue/files/src/style.css create mode 100644 templates/vue/files/src/typesense.ts create mode 100644 templates/vue/files/src/vue-instantsearch.d.ts create mode 100644 templates/vue/template.config.js diff --git a/templates/angular/files/angular.json b/templates/angular/files/angular.json new file mode 100644 index 0000000..88773fb --- /dev/null +++ b/templates/angular/files/angular.json @@ -0,0 +1,79 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "cli": { + "packageManager": "npm" + }, + "newProjectRoot": "projects", + "projects": { + "app": { + "projectType": "application", + "schematics": {}, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "./builders:application", + "options": { + "browser": "src/main.ts", + "tsConfig": "tsconfig.app.json", + "assets": [ + { + "glob": "**/*", + "input": "public" + } + ], + "styles": ["src/styles.css"], + "allowedCommonJsDependencies": [ + "@algolia/events", + "@babel/runtime", + "algoliasearch-helper", + "hogan.js", + "qs", + "typesense" + ] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "750kB", + "maximumError": "1MB" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "4kB", + "maximumError": "8kB" + } + ], + "outputHashing": "all" + }, + "development": { + "optimization": false, + "extractLicenses": false, + "sourceMap": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "builder": "./builders:dev-server", + "configurations": { + "production": { + "buildTarget": "app:build:production" + }, + "development": { + "buildTarget": "app:build:development" + } + }, + "defaultConfiguration": "development" + }, + "test": { + "builder": "@angular/build:unit-test" + } + } + } + } +} diff --git a/templates/angular/files/builders/application.js b/templates/angular/files/builders/application.js new file mode 100644 index 0000000..a449ae5 --- /dev/null +++ b/templates/angular/files/builders/application.js @@ -0,0 +1,8 @@ +const { createBuilder } = require('@angular-devkit/architect') +const { buildApplication } = require('@angular/build') +const { withEnv } = require('./env') + +/** `ng build`: @angular/build:application, with the NG_APP_ variables from .env. */ +module.exports = createBuilder(async function* (options, context) { + yield* buildApplication(await withEnv(options, context), context) +}) diff --git a/templates/angular/files/builders/application.schema.json b/templates/angular/files/builders/application.schema.json new file mode 100644 index 0000000..decf49c --- /dev/null +++ b/templates/angular/files/builders/application.schema.json @@ -0,0 +1,9 @@ +{ + "$comment": "Permissive on purpose: the wrapped Angular builder validates the options against its own schema. Only the flags listed here are accepted on the command line.", + "type": "object", + "properties": { + "watch": { + "type": "boolean" + } + } +} diff --git a/templates/angular/files/builders/builders.json b/templates/angular/files/builders/builders.json new file mode 100644 index 0000000..d23cc5c --- /dev/null +++ b/templates/angular/files/builders/builders.json @@ -0,0 +1,14 @@ +{ + "builders": { + "application": { + "implementation": "./application.js", + "schema": "./application.schema.json", + "description": "@angular/build:application, with the NG_APP_ variables from .env" + }, + "dev-server": { + "implementation": "./dev-server.js", + "schema": "./dev-server.schema.json", + "description": "@angular/build:dev-server, with the NG_APP_ variables from .env" + } + } +} diff --git a/templates/angular/files/builders/dev-server.js b/templates/angular/files/builders/dev-server.js new file mode 100644 index 0000000..f88e909 --- /dev/null +++ b/templates/angular/files/builders/dev-server.js @@ -0,0 +1,15 @@ +const { createBuilder } = require('@angular-devkit/architect') +const { executeDevServerBuilder } = require('@angular/build') +const { withEnv } = require('./env') + +/** + * `ng serve`: @angular/build:dev-server, with the NG_APP_ variables from .env. + * Read once at start, so restart it after editing .env. + */ +module.exports = createBuilder(async function* (options, context) { + // The dev server fetches the build target's options itself; hand it ours. + const getTargetOptions = context.getTargetOptions.bind(context) + context.getTargetOptions = async (target) => withEnv(await getTargetOptions(target), context) + const validated = await context.validateOptions(options, '@angular/build:dev-server') + yield* executeDevServerBuilder(validated, context) +}) diff --git a/templates/angular/files/builders/dev-server.schema.json b/templates/angular/files/builders/dev-server.schema.json new file mode 100644 index 0000000..87b493c --- /dev/null +++ b/templates/angular/files/builders/dev-server.schema.json @@ -0,0 +1,18 @@ +{ + "$comment": "Permissive on purpose: the wrapped Angular builder validates the options against its own schema. Only the flags listed here are accepted on the command line.", + "type": "object", + "properties": { + "buildTarget": { + "type": "string" + }, + "port": { + "type": "number" + }, + "host": { + "type": "string" + }, + "open": { + "type": "boolean" + } + } +} diff --git a/templates/angular/files/builders/env.js b/templates/angular/files/builders/env.js new file mode 100644 index 0000000..0e934c6 --- /dev/null +++ b/templates/angular/files/builders/env.js @@ -0,0 +1,35 @@ +/** + * The browser's half of .env: only the NG_APP_ variables, inlined as + * `import.meta.env`. Angular reads no env file by itself. + * + * The admin key, TYPESENSE_API_KEY, has no prefix, so it is skipped here and + * never reaches the bundle. Only scripts/seed.js reads it. + */ +const { readFileSync } = require('node:fs') +const path = require('node:path') + +const PREFIX = 'NG_APP_' + +function publicEnv(root) { + let contents = '' + try { + contents = readFileSync(path.join(root, '.env'), 'utf8') + } catch { + // No .env: the app reports each missing variable by name. + } + const env = {} + for (const line of contents.split('\n')) { + const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.exec(line) + if (match?.[1].startsWith(PREFIX)) env[match[1]] = match[2].trim() + } + return env +} + +/** Build options with the public env added to esbuild's `define`. */ +async function withEnv(options, context) { + const validated = await context.validateOptions(options, '@angular/build:application') + const env = JSON.stringify(publicEnv(context.workspaceRoot)) + return { ...validated, define: { ...validated.define, 'import.meta.env': env } } +} + +module.exports = { withEnv } diff --git a/templates/angular/files/builders/package.json b/templates/angular/files/builders/package.json new file mode 100644 index 0000000..475e017 --- /dev/null +++ b/templates/angular/files/builders/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "builders": "builders.json" +} diff --git a/templates/angular/files/public/favicon.png b/templates/angular/files/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..dca9badb45ef5b832e682e4bca90c77c1fc8d671 GIT binary patch literal 34884 zcmXt9by!s2(_f^)1!)24PDNNyx|Z(lZWa{jMmhvUx?z!SSVB^el3rrz5Rep5Qu@7q zf6w~|56?aKp0ji2&V1&~XXeIesL6xzsPI4_5Li(`Rtp4r1pD`gg9VI8rarI$|8UUYvUP@I81gcNOzqP~!fua@^WucLKqGg`b9MYB1r3DGFdNN$L?d38*ATa#mBX^ryLsPsEDX@#4J2X4{ z=4Xz3e#?RITJ0D9Z=+)Tmm{y|u1p`&*SaSpg|I@Ga@GZHZ%-+~`RbJ26Dg4sXduwK ztekPcGTHJ4W{V4$t`HoE#Z7Dy#!75O=kWI#u%}olxQjq*pinC~d(*1sV#csevA~pi znfz%VC7>DI1;HR{zNBbs2;{SCsLPAiK&#u$XXwDZ8iqfD&z5N^9}MvK>F2RjnWxgI z_D6vm0ai1z@I$H1FFvQbb&45*!mT{~(E=b)i0})lWmKj@M?BTUZ`C?5R!iz89Ux#q z-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(;V530im`sXtEw$;Akj*FAsvLJf+bp5D zQ%q(`QTYqx`rp3&U*Emj|2tcKyMMD=8YHJlN6z4@&b(geF;U zMpnc(Z$2Xie;>3%c*n~kS&F0o7h4xt7z~tc0!@MM zV=}XcGP&jIA~8bj(6_kvJ`_6w>_=oQQdpA5g+382$g+CSQVDk-r=rHJxR4`gf~;6C zP|!#4YS-a;YHs6w1+OG%lc(iub)NLHlHOq!q$9Gd0&O1zM4fqO@NnFCDt7W1=5bmd zWR2LN$C4MtomnD#K$4ZjZ43@BkIMrZb?-r`QyvrMZPT{s$KbSPgms`VV;NP8nbT~F zx*^oDTFZ1<@ZJ~`2OJ;#U=2v0hghx9zWuF|JGv@$c%ckTc+R$TIKyBhGRK6tt(76m zIwf+t8g+Q(MwDk{PM|%oAmQd>zHeV&r_Nf5zJhy!Utt-2K6gEfA7g>swKgbJA11lfU6uCiE7DE)r!k3G|v z)&jS|m%m}C`d!#&8OMG7k08)}ekt=U^>%$JEcx?zUEBHXl4_ErPwJUlD}9+gb>;)B P3I+yGS3j3^P6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/angular/files/scripts/seed.mjs b/templates/angular/files/scripts/seed.mjs new file mode 100644 index 0000000..2ece90b --- /dev/null +++ b/templates/angular/files/scripts/seed.mjs @@ -0,0 +1,186 @@ +/** + * Rebuilds the collection from data/books.jsonl. + * + * Idempotent: it drops the collection, recreates it from the schema in + * typesense.config.json, and re-imports every document. Run it after editing the + * schema or the data. + * + * npm run seed + * + * This is the only file that uses the admin key. Note the variable it reads — + * TYPESENSE_API_KEY, with no NG_APP_ prefix — so builders/env.js never + * inlines it into anything the browser downloads. + */ +import { readFile, writeFile } from 'node:fs/promises' +import path from 'node:path' + +/** + * Tags the browser-safe key so this script can find its own and avoid piling up a + * new one on every run. Must match what create-typesense-app uses. + */ +const SEARCH_KEY_DESCRIPTION = 'create-typesense-app search-only key' +const ENV_FILE = '.env' +const SEARCH_KEY_VAR = 'NG_APP_TYPESENSE_SEARCH_ONLY_API_KEY' + +/** + * Reads .env into process.env. + * + * Hand-rolled rather than using a library or Node's --env-file so this script + * runs the same way on every Node version the project might be on. + */ +async function loadEnv(file) { + const contents = await readFile(file, 'utf8').catch(() => '') + for (const line of contents.split('\n')) { + const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.exec(line) + if (match === null) continue + const [, name, rawValue = ''] = match + if (name !== undefined && process.env[name] === undefined) { + process.env[name] = rawValue.trim() + } + } +} + +async function main() { + await loadEnv(ENV_FILE) + + const config = JSON.parse(await readFile('typesense.config.json', 'utf8')) + const collection = config.collections[0] + if (collection === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') + } + const collectionName = collection.name + + const adminApiKey = process.env.TYPESENSE_API_KEY ?? '' + if (adminApiKey === '') { + throw new Error( + 'TYPESENSE_API_KEY is missing from .env. It is the admin key, and only this script uses it.', + ) + } + + const host = process.env.NG_APP_TYPESENSE_HOST ?? 'localhost' + const port = process.env.NG_APP_TYPESENSE_PORT ?? '8108' + const protocol = process.env.NG_APP_TYPESENSE_PROTOCOL ?? 'http' + const baseUrl = `${protocol}://${host}:${port}` + + async function typesense(method, endpoint, body, contentType = 'application/json') { + const response = await fetch(`${baseUrl}${endpoint}`, { + method, + headers: { 'X-TYPESENSE-API-KEY': adminApiKey, 'Content-Type': contentType }, + body, + }) + const text = await response.text() + // 404 is fine: dropping a collection that is not there yet. + if (!response.ok && response.status !== 404) { + throw new Error(`Typesense replied ${response.status} to ${method} ${endpoint}: ${text}`) + } + return text + } + + const datasetPath = path.join('data', 'books.jsonl') + const jsonl = await readFile(datasetPath, 'utf8').catch(() => { + throw new Error( + `${datasetPath} is missing. Download it with:\n` + + ' curl -L https://dl.typesense.org/datasets/books.jsonl.gz | gunzip > data/books.jsonl', + ) + }) + + console.log(`Rebuilding "${collectionName}" at ${baseUrl}`) + + // Drop first: Typesense will not retrofit an existing collection to a new schema. + await typesense('DELETE', `/collections/${collectionName}`) + await typesense('POST', '/collections', JSON.stringify(collection.schema)) + console.log(' created the collection from typesense.config.json') + + const result = await typesense( + 'POST', + `/collections/${collectionName}/documents/import?action=upsert`, + jsonl, + 'text/plain', + ) + + // The import replies with one JSON object per line: a 200 does not mean success. + let imported = 0 + const failures = [] + for (const line of result.split('\n')) { + if (line.trim() === '') continue + try { + const outcome = JSON.parse(line) + if (outcome.success === true) imported += 1 + else failures.push(outcome.error ?? 'unknown error') + } catch { + failures.push(`unparseable response line: ${line.slice(0, 80)}`) + } + } + + if (failures.length > 0) { + console.error(` ${failures.length} documents failed to index:`) + for (const failure of failures.slice(0, 5)) console.error(` - ${failure}`) + process.exit(1) + } + + console.log(` indexed ${imported} documents`) + + await ensureSearchOnlyKey(typesense, collectionName) + + console.log('\nDone. Try searching for "hary potr".') +} + +/** + * Makes sure the browser still has a working key, recreating it if it is gone. + * + * `docker compose down --volumes` deletes API keys along with the index, and + * Typesense only ever reveals a key's value at creation time — so a wiped key + * cannot be recovered, only replaced. Without this the app would come back with a + * 401 that no amount of reseeding fixed. + * + * Note what the key is allowed to do: search documents, in one collection. That is + * the only key the browser ever receives. + */ +async function ensureSearchOnlyKey(typesense, collectionName) { + const configured = process.env[SEARCH_KEY_VAR] ?? '' + + const { keys = [] } = JSON.parse(await typesense('GET', '/keys')) + const ours = keys.filter((key) => key.description === SEARCH_KEY_DESCRIPTION) + + // Typesense exposes only a prefix of an existing key, which is enough to tell + // whether the one in the env file is still the live one. + const stillValid = + configured !== '' && ours.some((key) => configured.startsWith(key.value_prefix)) + if (stillValid) return + + for (const key of ours) { + await typesense('DELETE', `/keys/${key.id}`) + } + + const created = JSON.parse( + await typesense( + 'POST', + '/keys', + JSON.stringify({ + description: SEARCH_KEY_DESCRIPTION, + actions: ['documents:search'], + collections: [collectionName], + }), + ), + ) + + if (typeof created.value !== 'string' || created.value === '') { + throw new Error('Typesense created a search-only key but returned no value for it.') + } + + const contents = await readFile(ENV_FILE, 'utf8').catch(() => '') + const line = `${SEARCH_KEY_VAR}=${created.value}` + const lines = contents === '' ? [] : contents.replace(/\n+$/, '').split('\n') + const index = lines.findIndex((existing) => existing.startsWith(`${SEARCH_KEY_VAR}=`)) + if (index === -1) lines.push(line) + else lines[index] = line + await writeFile(ENV_FILE, `${lines.join('\n')}\n`, 'utf8') + + console.log(` created a new search-only key and updated ${ENV_FILE}`) + console.log(' (restart the dev server so it picks up the new value)') +} + +main().catch((error) => { + console.error(error instanceof Error ? error.message : error) + process.exit(1) +}) diff --git a/templates/angular/files/src/app/app.html b/templates/angular/files/src/app/app.html new file mode 100644 index 0000000..3b1d8f6 --- /dev/null +++ b/templates/angular/files/src/app/app.html @@ -0,0 +1,127 @@ +
    +
    + + + + +
    + +
    +
    +

    {{ title }}

    +

    Misspell it on purpose. Typesense corrects typos as you type.

    +
    + + + + @if (error(); as message) { + + } + + @if (page.collection; as collection) { + @if (page.showBack) { + ← All collections + } +
    + @if (collection.search.facets.length > 0) { + + } + +
    +

    {{ stats() }}

    +
      + @for (hit of hits(); track hit.objectID) { +
    1. + } +
    +
    +
    + } @else { + @for (collection of collections; track collection.name) { +
    +
    +

    {{ collection.name }}

    + Show all in {{ collection.name }} +
    + @if (sections()[collection.name]; as hits) { + @if (hits.length === 0) { +

    No results in {{ collection.name }}.

    + } @else { +
      + @for (hit of hits; track hit.objectID) { +
    1. + } +
    + } + } +
    + } + } +
    +
    + + +
    + @if (image(hit, search); as src) { + + } +
    +

    + @if (highlighted(hit, search); as html) { + + } @else { + {{ format(hit[search.title]) }} + } +

    +
    + @for (detail of details(hit, search); track detail[0]) { +
    +
    {{ label(detail[0]) }}
    +
    {{ detail[1] }}
    +
    + } +
    +
    +
    +
    diff --git a/templates/angular/files/src/app/app.ts b/templates/angular/files/src/app/app.ts new file mode 100644 index 0000000..eaf15f6 --- /dev/null +++ b/templates/angular/files/src/app/app.ts @@ -0,0 +1,161 @@ +import { NgTemplateOutlet } from '@angular/common' +import { afterNextRender, Component, type OnDestroy, signal } from '@angular/core' +import instantsearch from 'instantsearch.js/es' +import type { Hit } from 'instantsearch.js' +import { + connectHits, + connectRefinementList, + connectSearchBox, + connectStats, +} from 'instantsearch.js/es/connectors' +import { configure, index } from 'instantsearch.js/es/widgets' +import { type Collection, collections, type SearchConfig, searchClient } from '../typesense' + +/** + * Every field name below comes from typesense.config.json, so this page works for + * any collection. Change what it shows there, not here. + * + * InstantSearch's connectors hand back state instead of rendering, and the state + * goes straight into signals that the template reads. + */ +type Document = Record + +interface Facet { + items: { label: string; value: string; count: number; isRefined: boolean }[] + refine: (value: string) => void + searchForItems: (query: string) => void +} + +export function label(field: string): string { + const words = field.replace(/[_-]+/g, ' ') + return words.charAt(0).toUpperCase() + words.slice(1) +} + +export function format(value: unknown): string { + if (Array.isArray(value)) return value.join(', ') + // Not toLocaleString: it would print a year as "2,008". + return value === null || value === undefined ? '' : String(value) +} + +/** The page to show: ?collection= is "Show all in "; one collection needs no choice. */ +function pick(params: URLSearchParams): { collection?: Collection; showBack: boolean } { + const [only] = collections + if (collections.length === 1) return { collection: only, showBack: false } + const collection = collections.find((entry) => entry.name === params.get('collection')) + return { collection, showBack: collection !== undefined } +} + +@Component({ + imports: [NgTemplateOutlet], + selector: 'app-root', + templateUrl: './app.html', +}) +export class App implements OnDestroy { + protected readonly label = label + protected readonly format = format + + private readonly params = new URLSearchParams(window.location.search) + protected readonly page = pick(this.params) + protected readonly collections = collections + protected readonly title = this.page.collection ? `Search ${this.page.collection.name}` : 'Search' + + protected readonly query = signal('') + protected readonly error = signal(undefined) + protected readonly stats = signal('') + protected readonly hits = signal[]>([]) + protected readonly facets = signal>({}) + /** Federated page: each collection's top hits, undefined until its first results. */ + protected readonly sections = signal[] | undefined>>({}) + + private refineQuery: (query: string) => void = () => {} + + // The root index carries the query; on the federated page every section is an index of its own. + private readonly search = instantsearch({ + searchClient, + indexName: this.page.collection?.name ?? collections[0]?.name ?? '', + initialUiState: this.page.collection && { + [this.page.collection.name]: { query: this.params.get('q') ?? '' }, + }, + future: { preserveSharedStateOnUnmount: true }, + }) + + constructor() { + document.title = `${this.title} | Typesense` + // Not the autofocus attribute: a browser applies it only to markup present at page load. + afterNextRender(() => document.querySelector('input.input')?.focus()) + // InstantSearch turns a failed request into zero hits; say what went wrong instead. + this.search.on('error', ({ error }: { error: Error }) => this.error.set(error.message)) + + this.search.addWidgets([ + connectSearchBox(({ query, refine }) => { + this.query.set(query) + this.refineQuery = refine + })({}), + ]) + + const { collection } = this.page + if (collection === undefined) { + this.search.addWidgets( + collections.map(({ name }) => + index({ indexName: name, indexId: `section-${name}` }).addWidgets([ + configure({ hitsPerPage: 5 }), + connectHits(({ hits, results }) => { + this.sections.update((all) => ({ ...all, [name]: results ? hits : undefined })) + })({}), + ]), + ), + ) + } else { + this.search.addWidgets([ + connectStats(({ nbHits, processingTimeMS }) => { + this.stats.set(`${nbHits} results found in ${processingTimeMS}ms`) + })({}), + connectHits(({ hits }) => this.hits.set(hits))({}), + ...collection.search.facets.map((field) => + connectRefinementList(({ items, refine, searchForItems }) => { + this.facets.update((all) => ({ ...all, [field]: { items, refine, searchForItems } })) + })({ attribute: field, limit: 8 }), + ), + ]) + } + + this.search.start() + } + + ngOnDestroy(): void { + this.search.dispose() + } + + protected onInput(event: Event): void { + this.error.set(undefined) + this.refineQuery((event.target as HTMLInputElement).value) + } + + protected showAll(name: string): string { + const query = this.query() + return `?collection=${encodeURIComponent(name)}${query === '' ? '' : `&q=${encodeURIComponent(query)}`}` + } + + /** The title with the query's matches marked; InstantSearch has escaped the rest. */ + protected highlighted(hit: Hit, search: SearchConfig): string | undefined { + const value = (hit._highlightResult as Record | undefined)?.[ + search.title + ]?.value + return typeof value === 'string' ? value : undefined + } + + protected image(hit: Hit, search: SearchConfig): string { + return search.image === null ? '' : format(hit[search.image]) + } + + protected details(hit: Hit, search: SearchConfig): (readonly [string, string])[] { + return search.display + .map((field) => [field, format(hit[field])] as const) + .filter(([, value]) => value !== '') + } + + // Real data has dead image URLs; a broken-image icon helps nobody. + protected hide(event: Event): void { + ;(event.target as HTMLElement).style.display = 'none' + } +} diff --git a/templates/angular/files/src/env.d.ts b/templates/angular/files/src/env.d.ts new file mode 100644 index 0000000..4008006 --- /dev/null +++ b/templates/angular/files/src/env.d.ts @@ -0,0 +1,4 @@ +/** Inlined at build time by builders/env.js: only the NG_APP_ variables from .env. */ +interface ImportMeta { + readonly env: Record +} diff --git a/templates/angular/files/src/index.html b/templates/angular/files/src/index.html new file mode 100644 index 0000000..21e3937 --- /dev/null +++ b/templates/angular/files/src/index.html @@ -0,0 +1,17 @@ + + + + + Search | Typesense + + + + + + + + + + + + diff --git a/templates/angular/files/src/styles.css b/templates/angular/files/src/styles.css new file mode 100644 index 0000000..df91fdb --- /dev/null +++ b/templates/angular/files/src/styles.css @@ -0,0 +1,380 @@ +/* The search page, with the tokens of cloud.typesense.org. Global, not per + component: the app is this one page. */ + +*, +*::before, +*::after { + box-sizing: border-box; +} + +body { + margin: 0; + -webkit-font-smoothing: antialiased; +} + +/* The fonts load from Google Fonts in index.html. */ +.page { + --font-body: "Palanquin"; + --font-heading: "Catamaran"; + --ts-page: #fefefe; + --ts-panel: #f7f7fa; + --ts-border: #e6e6ee; + --ts-border-strong: #c9cad6; + --ts-text: #303138; + --ts-muted: #6f7082; + --ts-indigo: #3943b7; + --ts-pink: #ed0e73; + --ts-pink-tint: #fde7f1; + --ts-checkbox-border: #9495a6; + + min-height: 100vh; + background: var(--ts-page); + color: var(--ts-text); + font-family: var(--font-body), system-ui, sans-serif; + /* Above Cloud's .95rem: Palanquin's small x-height reads too small on large monitors. */ + font-size: 1.0625rem; + line-height: 1.6; +} + +.topbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 1rem 1.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.logo { + display: block; + height: 2rem; + width: auto; +} + +.nav { + display: flex; + gap: 1.25rem; + font-size: 1rem; +} + +.nav a { + color: var(--ts-muted); + text-decoration: none; +} + +.nav a:hover { + color: var(--ts-pink); +} + +.content { + max-width: 72rem; + margin: 0 auto; + padding: 2.5rem 1.5rem 6rem; +} + +.header { + margin-bottom: 1.5rem; +} + +.heading { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 2.25rem; + font-weight: 600; + line-height: 1.2; + color: var(--ts-indigo); + margin: 0 0 0.35rem; +} + +.subheading { + margin: 0; + color: var(--ts-muted); +} + +.input { + margin-bottom: 2rem; + width: 100%; + padding: 0.8rem 1rem; + font: inherit; + font-size: 1.2rem; + color: inherit; + background: var(--ts-page); + border: 1px solid var(--ts-border-strong); + border-radius: 0.375rem; +} + +.input:focus { + outline: none; + border-color: var(--ts-pink); + box-shadow: 0 0 0 3px var(--ts-pink-tint); +} + +/* The browser's own clear button is blue and ignores the palette. */ +.input::-webkit-search-cancel-button { + appearance: none; +} + +.layout { + display: grid; + /* + * minmax(0, 1fr), not 1fr: `1fr` means `minmax(auto, 1fr)`, whose floor is + * the column's min-content width, so one long title would squeeze the facets. + */ + grid-template-columns: 16.5rem minmax(0, 1fr); + gap: 2.5rem; + align-items: start; +} + +@media (max-width: 44rem) { + .layout { + grid-template-columns: minmax(0, 1fr); + gap: 1.5rem; + } +} + +.sidebar { + position: sticky; + top: 1.5rem; + display: flex; + flex-direction: column; + gap: 1.5rem; + padding: 1.25rem; + background: var(--ts-page); + border: 1px solid var(--ts-border); + border-radius: 0.5rem; +} + +.facet-heading { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.125rem; + font-weight: 600; + color: var(--ts-text); + margin: 0 0 0.6rem; +} + +.facet-list { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 0.5rem; + font-size: 1rem; +} + +.facet-label { + display: flex; + align-items: center; + gap: 0.5rem; + cursor: pointer; +} + +/* The Typesense Cloud checkbox: Bootstrap's custom checkbox, with its sizes, + colors and check mark. */ +.facet-checkbox { + appearance: none; + flex-shrink: 0; + width: 1.35rem; + height: 1.35rem; + margin: 0; + border: 1px solid var(--ts-checkbox-border); + border-radius: 0.375rem; + background: var(--ts-page) 50% / 50% 50% no-repeat; + cursor: pointer; + transition: + background-color 0.15s ease-in-out, + border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out; +} + +.facet-checkbox:checked { + background-color: var(--ts-pink); + border-color: var(--ts-pink); + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23fefefe' d='m6.564.75-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3E%3C/svg%3E"); +} + +.facet-checkbox:focus-visible { + outline: none; + box-shadow: 0 0 0 0.2rem rgba(237, 14, 115, 0.14); +} + +.facet-checkbox:focus-visible:not(:checked) { + border-color: rgba(237, 14, 115, 0.55); +} + +.facet-checkbox:active:not(:checked) { + background-color: #fbb3d3; + border-color: #fbb3d3; +} + +@media (prefers-reduced-motion: reduce) { + .facet-checkbox { + transition: none; + } +} + +.facet-count { + margin-left: auto; + padding: 0 0.45rem; + font-size: 0.875rem; + color: var(--ts-muted); + background: var(--ts-panel); + border-radius: 1rem; + font-variant-numeric: tabular-nums; +} + +.facet-search { + margin-bottom: 0.6rem; +} + +.facet-search button { + display: none; +} + +.facet-search input { + width: 100%; + padding: 0.4rem 0.6rem; + font: inherit; + font-size: 0.95rem; + color: inherit; + background: var(--ts-panel); + border: 1px solid var(--ts-border); + border-radius: 0.375rem; +} + +.facet-search input:focus { + outline: none; + border-color: var(--ts-pink); +} + +.stats { + font-size: 0.95rem; + color: var(--ts-muted); + margin: 0 0 0.5rem; +} + +.hit-list { + list-style: none; + margin: 0; + padding: 0; +} + +.hit-list > li + li { + border-top: 1px solid var(--ts-border); +} + +.hit { + display: flex; + gap: 1rem; + padding: 1rem 0; + align-items: flex-start; +} + +.cover { + width: 3.75rem; + height: 5.5rem; + object-fit: cover; + border-radius: 0.25rem; + background: var(--ts-panel); + flex-shrink: 0; +} + +/* Flex items refuse to shrink below their content by default; without this a long + title pushes the cover out of the row instead of wrapping. */ +.hit-body { + min-width: 0; +} + +.title { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.25rem; + font-weight: 600; + line-height: 1.3; + margin: 0 0 0.35rem; + overflow-wrap: break-word; +} + +/* The typo correction is the point of the demo, so the matched words carry the accent. */ +.title mark { + color: var(--ts-pink); + background: var(--ts-pink-tint); + border-radius: 0.2rem; + padding: 0 0.1rem; +} + +.fields { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 1.25rem; + margin: 0; + font-size: 1rem; +} + +.field { + display: flex; +} + +.field dt { + color: var(--ts-muted); + margin-right: 0.35rem; +} + +.field dd { + margin: 0; + font-variant-numeric: tabular-nums; +} + +.error { + margin: 0 0 1.5rem; + padding: 0.75rem 1rem; + border: 1px solid var(--ts-pink); + border-radius: 0.375rem; + background: var(--ts-pink-tint); + font-size: 1rem; +} + +.empty { + margin: 0; + padding: 1rem 0; + color: var(--ts-muted); +} + +.section + .section { + margin-top: 2.5rem; +} + +.section-header { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 1rem; + padding-bottom: 0.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.section-title { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.5rem; + font-weight: 600; + color: var(--ts-indigo); + margin: 0; +} + +.link { + color: var(--ts-pink); + font-size: 1rem; + text-decoration: none; +} + +.link:hover { + text-decoration: underline; +} + +.back { + display: inline-block; + margin-bottom: 1.25rem; +} + +.page a:focus-visible { + outline: 2px solid var(--ts-pink); + outline-offset: 2px; +} diff --git a/templates/angular/files/src/typesense.ts b/templates/angular/files/src/typesense.ts new file mode 100644 index 0000000..4f1124a --- /dev/null +++ b/templates/angular/files/src/typesense.ts @@ -0,0 +1,74 @@ +import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter' +import config from '../typesense.config.json' + +/** + * Connects the browser to Typesense. + * + * Every value here is read from an NG_APP_ variable, which means it ships to the + * browser. That is fine — and deliberate — because the only key in this file is + * the search-only key: it can search the collections in typesense.config.json and + * nothing else. It cannot add documents, drop a collection, or create keys. + * + * The admin key lives in the same .env file WITHOUT the NG_APP_ prefix, so + * builders/env.js never inlines it. Only scripts/seed.js reads it. + */ +function required(name: string): string { + const value = import.meta.env[name] + if (value === undefined || value === '') { + throw new Error( + `Missing ${name}. It should be in .env — re-run create-typesense-app if the file is gone, and restart the dev server.`, + ) + } + return value +} + +/** What the UI searches, facets and shows. Written by create-typesense-app; edit freely. */ +export interface SearchConfig { + queryBy: string[] + facets: string[] + title: string + image: string | null + display: string[] +} + +export interface Collection { + /** The collection or alias to search. */ + name: string + search: SearchConfig +} + +export const collections: Collection[] = config.collections.map(({ name, search }) => ({ + name, + search, +})) +const [first] = collections +if (first === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') +} + +const adapter = new TypesenseInstantSearchAdapter({ + server: { + apiKey: required('NG_APP_TYPESENSE_SEARCH_ONLY_API_KEY'), + nodes: [ + { + host: required('NG_APP_TYPESENSE_HOST'), + port: Number(required('NG_APP_TYPESENSE_PORT')), + protocol: required('NG_APP_TYPESENSE_PROTOCOL'), + }, + ], + // Results are cached briefly so typing does not re-fetch the same query. + cacheSearchResultsForSeconds: 2 * 60, + }, + /** + * Which fields a query is matched against, per collection, from + * typesense.config.json. Ranking ties are broken by each schema's + * `default_sorting_field`, which is why "hary potr" puts the best-known Harry + * Potter book first. + */ + additionalSearchParameters: { query_by: first.search.queryBy.join(',') }, + collectionSpecificSearchParameters: Object.fromEntries( + collections.map(({ name, search }) => [name, { query_by: search.queryBy.join(',') }]), + ), +}) + +export const searchClient = adapter.searchClient diff --git a/templates/angular/template.config.js b/templates/angular/template.config.js new file mode 100644 index 0000000..7e73c24 --- /dev/null +++ b/templates/angular/template.config.js @@ -0,0 +1,40 @@ +/** + * Angular + instantsearch.js connectors, bundled by the Angular CLI. + * Every field is documented in ../README.md — the template contract. + */ +export default { + id: 'angular', + name: 'Angular + instantsearch.js', + + // No SSR: the search runs in the browser, and a server render would only show + // an empty page before it. --routing false: one page reads ?collection= instead. + scaffold: + 'npx --yes @angular/cli@latest new {{dir}} --defaults --skip-install --skip-git --no-ssr --style css --routing false --ai-config none --interactive false', + + // angular-instantsearch is deprecated; the plain library's connectors feed signals. + deps: ['typesense', 'typesense-instantsearch-adapter', 'instantsearch.js'], + // Nothing extra: the seed script is plain JS, so Node runs it directly. It is + // .mjs because the Angular starter's package.json is not "type": "module". + devDeps: [], + + env: { + file: '.env', + /** + * Angular reads no env file by itself. The overlay's builders/ wraps the + * Angular builders and inlines only NG_APP_ variables from .env into the + * bundle, so the unprefixed admin key is never read into it. + */ + publicPrefix: 'NG_APP_', + }, + + seedCommand: 'node scripts/seed.mjs', + + files: 'files/', + // The starter is a landing page. Our App replaces it, and its spec tests that + // page; the styles move to src/styles.css. public/favicon.ico goes because the + // overlay's public/favicon.png is the Typesense favicon. + remove: ['public/favicon.ico', 'src/app/app.css', 'src/app/app.spec.ts'], + + devCommand: 'npm start', + devUrl: 'http://localhost:4200', +} diff --git a/templates/react/files/index.html b/templates/react/files/index.html new file mode 100644 index 0000000..d719f34 --- /dev/null +++ b/templates/react/files/index.html @@ -0,0 +1,20 @@ + + + + + + + + + + + Search | Typesense + + +
    + + + diff --git a/templates/react/files/public/favicon.png b/templates/react/files/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..dca9badb45ef5b832e682e4bca90c77c1fc8d671 GIT binary patch literal 34884 zcmXt9by!s2(_f^)1!)24PDNNyx|Z(lZWa{jMmhvUx?z!SSVB^el3rrz5Rep5Qu@7q zf6w~|56?aKp0ji2&V1&~XXeIesL6xzsPI4_5Li(`Rtp4r1pD`gg9VI8rarI$|8UUYvUP@I81gcNOzqP~!fua@^WucLKqGg`b9MYB1r3DGFdNN$L?d38*ATa#mBX^ryLsPs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Aa5|FAIk0TTHBLV$$G}O#dFXO?A6~c)ifwuGu0qjlt zb{tEm&D*clB_M&?_hCdf?Xjnx7x}UwTy&6EF`RS;(IoJ>b+EG*>wE@m?7g3~pf|bkP*eNzCi~gl>|_U2!hB%oo_9dXZ&Oz`aZXZZZVo^Uy&;VSW&6 zh6c)HevAQH5|~Vz^;_>|F@FMg8fnRu<0XW)2Ad>`zoHiaBgRymn7JRbk7Q4@$ zDhJuRbwpV(optn1%v5{oxXCN}>>82yw4~@wriC0V7G82fcG{EC=5%+Rjfu(;V530im`sXtEw$;Akj*FAsvLJf+bp5D zQ%q(`QTYqx`rp3&U*Emj|2tcKyMMD=8YHJlN6z4@&b(geF;U zMpnc(Z$2Xie;>3%c*n~kS&F0o7h4xt7z~tc0!@MM zV=}XcGP&jIA~8bj(6_kvJ`_6w>_=oQQdpA5g+382$g+CSQVDk-r=rHJxR4`gf~;6C zP|!#4YS-a;YHs6w1+OG%lc(iub)NLHlHOq!q$9Gd0&O1zM4fqO@NnFCDt7W1=5bmd zWR2LN$C4MtomnD#K$4ZjZ43@BkIMrZb?-r`QyvrMZPT{s$KbSPgms`VV;NP8nbT~F zx*^oDTFZ1<@ZJ~`2OJ;#U=2v0hghx9zWuF|JGv@$c%ckTc+R$TIKyBhGRK6tt(76m zIwf+t8g+Q(MwDk{PM|%oAmQd>zHeV&r_Nf5zJhy!Utt-2K6gEfA7g>swKgbJA11lfU6uCiE7DE)r!k3G|v z)&jS|m%m}C`d!#&8OMG7k08)}ekt=U^>%$JEcx?zUEBHXl4_ErPwJUlD}9+gb>;)B P3I+yGS3j3^P6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/react/files/scripts/seed.ts b/templates/react/files/scripts/seed.ts new file mode 100644 index 0000000..e06b6f3 --- /dev/null +++ b/templates/react/files/scripts/seed.ts @@ -0,0 +1,205 @@ +/** + * Rebuilds the collection from data/books.jsonl. + * + * Idempotent: it drops the collection, recreates it from the schema in + * typesense.config.json, and re-imports every document. Run it after editing the + * schema or the data. + * + * npm run seed + * + * This is the only file that uses the admin key. Note the variable it reads — + * TYPESENSE_API_KEY, with no VITE_ prefix — so Vite never bundles it + * into anything the browser downloads. + */ +import { readFile, writeFile } from 'node:fs/promises' +import path from 'node:path' + +/** + * Tags the browser-safe key so this script can find its own and avoid piling up a + * new one on every run. Must match what create-typesense-app uses. + */ +const SEARCH_KEY_DESCRIPTION = 'create-typesense-app search-only key' +const ENV_FILE = '.env' +const SEARCH_KEY_VAR = 'VITE_TYPESENSE_SEARCH_ONLY_API_KEY' + +/** + * Reads .env into process.env. + * + * Hand-rolled rather than using a library or Node's --env-file so this script + * runs the same way on every Node version the project might be on. + */ +async function loadEnv(file: string): Promise { + const contents = await readFile(file, 'utf8').catch(() => '') + for (const line of contents.split('\n')) { + const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.exec(line) + if (match === null) continue + const [, name, rawValue = ''] = match + if (name !== undefined && process.env[name] === undefined) { + process.env[name] = rawValue.trim() + } + } +} + +async function main(): Promise { + await loadEnv('.env') + + const config = JSON.parse(await readFile('typesense.config.json', 'utf8')) as { + collections: { name: string; schema: { name: string } }[] + } + const collection = config.collections[0] + if (collection === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') + } + const collectionName = collection.name + + // Coalesced rather than checked for undefined so the type stays `string` inside + // the request helper below. + const adminApiKey = process.env.TYPESENSE_API_KEY ?? '' + if (adminApiKey === '') { + throw new Error( + 'TYPESENSE_API_KEY is missing from .env. It is the admin key, and only this script uses it.', + ) + } + + const host = process.env.VITE_TYPESENSE_HOST ?? 'localhost' + const port = process.env.VITE_TYPESENSE_PORT ?? '8108' + const protocol = process.env.VITE_TYPESENSE_PROTOCOL ?? 'http' + const baseUrl = `${protocol}://${host}:${port}` + + async function typesense( + method: string, + endpoint: string, + body?: string, + contentType = 'application/json', + ): Promise { + const response = await fetch(`${baseUrl}${endpoint}`, { + method, + headers: { 'X-TYPESENSE-API-KEY': adminApiKey, 'Content-Type': contentType }, + body, + }) + const text = await response.text() + // 404 is fine: dropping a collection that is not there yet. + if (!response.ok && response.status !== 404) { + throw new Error(`Typesense replied ${response.status} to ${method} ${endpoint}: ${text}`) + } + return text + } + + const datasetPath = path.join('data', 'books.jsonl') + const jsonl = await readFile(datasetPath, 'utf8').catch(() => { + throw new Error( + `${datasetPath} is missing. Download it with:\n` + + ' curl -L https://dl.typesense.org/datasets/books.jsonl.gz | gunzip > data/books.jsonl', + ) + }) + + console.log(`Rebuilding "${collectionName}" at ${baseUrl}`) + + // Drop first: Typesense will not retrofit an existing collection to a new schema. + await typesense('DELETE', `/collections/${collectionName}`) + await typesense('POST', '/collections', JSON.stringify(collection.schema)) + console.log(' created the collection from typesense.config.json') + + const result = await typesense( + 'POST', + `/collections/${collectionName}/documents/import?action=upsert`, + jsonl, + 'text/plain', + ) + + // The import replies with one JSON object per line: a 200 does not mean success. + let imported = 0 + const failures: string[] = [] + for (const line of result.split('\n')) { + if (line.trim() === '') continue + try { + const outcome = JSON.parse(line) as { success?: boolean; error?: string } + if (outcome.success === true) imported += 1 + else failures.push(outcome.error ?? 'unknown error') + } catch { + failures.push(`unparseable response line: ${line.slice(0, 80)}`) + } + } + + if (failures.length > 0) { + console.error(` ${failures.length} documents failed to index:`) + for (const failure of failures.slice(0, 5)) console.error(` - ${failure}`) + process.exit(1) + } + + console.log(` indexed ${imported} documents`) + + await ensureSearchOnlyKey(typesense, collectionName) + + console.log('\nDone. Try searching for "hary potr".') +} + +/** + * Makes sure the browser still has a working key, recreating it if it is gone. + * + * `docker compose down --volumes` deletes API keys along with the index, and + * Typesense only ever reveals a key's value at creation time — so a wiped key + * cannot be recovered, only replaced. Without this the app would come back with a + * 401 that no amount of reseeding fixed. + * + * Note what the key is allowed to do: search documents, in one collection. That is + * the only key the browser ever receives. + */ +async function ensureSearchOnlyKey( + typesense: ( + method: string, + endpoint: string, + body?: string, + contentType?: string, + ) => Promise, + collectionName: string, +): Promise { + const configured = process.env[SEARCH_KEY_VAR] ?? '' + + const { keys = [] } = JSON.parse(await typesense('GET', '/keys')) as { + keys?: { id: number; description: string; value_prefix: string }[] + } + const ours = keys.filter((key) => key.description === SEARCH_KEY_DESCRIPTION) + + // Typesense exposes only a prefix of an existing key, which is enough to tell + // whether the one in the env file is still the live one. + const stillValid = + configured !== '' && ours.some((key) => configured.startsWith(key.value_prefix)) + if (stillValid) return + + for (const key of ours) { + await typesense('DELETE', `/keys/${key.id}`) + } + + const created = JSON.parse( + await typesense( + 'POST', + '/keys', + JSON.stringify({ + description: SEARCH_KEY_DESCRIPTION, + actions: ['documents:search'], + collections: [collectionName], + }), + ), + ) as { value?: string } + + if (created.value === undefined || created.value === '') { + throw new Error('Typesense created a search-only key but returned no value for it.') + } + + const contents = await readFile(ENV_FILE, 'utf8').catch(() => '') + const line = `${SEARCH_KEY_VAR}=${created.value}` + const lines = contents === '' ? [] : contents.replace(/\n+$/, '').split('\n') + const index = lines.findIndex((existing) => existing.startsWith(`${SEARCH_KEY_VAR}=`)) + if (index === -1) lines.push(line) + else lines[index] = line + await writeFile(ENV_FILE, `${lines.join('\n')}\n`, 'utf8') + + console.log(` created a new search-only key and updated ${ENV_FILE}`) + console.log(' (restart the dev server so it picks up the new value)') +} + +main().catch((error: unknown) => { + console.error(error instanceof Error ? error.message : error) + process.exit(1) +}) diff --git a/templates/react/files/src/App.tsx b/templates/react/files/src/App.tsx new file mode 100644 index 0000000..9eee8cc --- /dev/null +++ b/templates/react/files/src/App.tsx @@ -0,0 +1,42 @@ +import { collections } from './typesense' +import { CollectionPage, FederatedPage } from './search' + +/** + * One selected collection gets its full page here; several get one section each. + * "Show all in " links back to this page with ?collection=&q=, + * so the app needs no router. + */ +export default function App() { + const params = new URLSearchParams(window.location.search) + const name = params.get('collection') + const query = params.get('q') ?? undefined + const [only] = collections + // The "Show all" page and a single-collection home page name their collection. + const titled = name ?? (collections.length === 1 ? only?.name : undefined) + document.title = titled === undefined ? 'Search | Typesense' : `Search ${titled} | Typesense` + + if (name !== null) { + const collection = collections.find((entry) => entry.name === name) + if (collection === undefined) { + return ( +
    +

    + No collection named {name} in typesense.config.json. All collections +

    +
    + ) + } + return ( + 1} + /> + ) + } + return collections.length === 1 && only !== undefined ? ( + + ) : ( + + ) +} diff --git a/templates/react/files/src/main.tsx b/templates/react/files/src/main.tsx new file mode 100644 index 0000000..56ebd5e --- /dev/null +++ b/templates/react/files/src/main.tsx @@ -0,0 +1,11 @@ +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import App from './App.tsx' + +// No index.css: the starter's stylesheet pins #root to a fixed-width centred column. +// biome-ignore lint/style/noNonNullAssertion: index.html always has #root. +createRoot(document.getElementById('root')!).render( + + + , +) diff --git a/templates/react/files/src/search.module.css b/templates/react/files/src/search.module.css new file mode 100644 index 0000000..683e5a9 --- /dev/null +++ b/templates/react/files/src/search.module.css @@ -0,0 +1,390 @@ +/* Scoped to the search pages. The starter's index.css and App.css are removed: + their fixed-width, centred #root would resize the layout as results change. + The tokens follow cloud.typesense.org. */ + +/* The starter's index.css reset is gone; these two rules are what the layout needs of it. */ +:global(body) { + margin: 0; +} + +.page * { + box-sizing: border-box; +} + +.page { + --ts-page: #fefefe; + --ts-panel: #f7f7fa; + --ts-border: #e6e6ee; + --ts-border-strong: #c9cad6; + --ts-text: #303138; + --ts-muted: #6f7082; + --ts-indigo: #3943b7; + --ts-pink: #ed0e73; + --ts-pink-tint: #fde7f1; + --ts-checkbox-border: #9495a6; + + /* index.html loads both from Google Fonts. */ + --font-body: "Palanquin"; + --font-heading: "Catamaran"; + + /* An explicit width, so the page never sizes itself from the current results. */ + width: 100%; + min-height: 100vh; + background: var(--ts-page); + color: var(--ts-text); + font-family: var(--font-body), system-ui, sans-serif; + /* Above Cloud's .95rem: Palanquin's small x-height reads too small on large monitors. */ + font-size: 1.0625rem; + line-height: 1.6; +} + +.topbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 1rem 1.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.logo { + display: block; + height: 2rem; + width: auto; +} + +.nav { + display: flex; + gap: 1.25rem; + font-size: 1rem; +} + +.nav a { + color: var(--ts-muted); + text-decoration: none; +} + +.nav a:hover { + color: var(--ts-pink); +} + +.content { + max-width: 72rem; + margin: 0 auto; + padding: 2.5rem 1.5rem 6rem; +} + +.header { + margin-bottom: 1.5rem; +} + +.heading { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 2.25rem; + font-weight: 600; + line-height: 1.2; + color: var(--ts-indigo); + margin: 0 0 0.35rem; +} + +.subheading { + margin: 0; + color: var(--ts-muted); +} + +.searchRoot { + margin-bottom: 2rem; +} + +.input { + width: 100%; + padding: 0.8rem 1rem; + font: inherit; + font-size: 1.2rem; + color: inherit; + background: var(--ts-page); + border: 1px solid var(--ts-border-strong); + border-radius: 0.375rem; +} + +.input:focus { + outline: none; + border-color: var(--ts-pink); + box-shadow: 0 0 0 3px var(--ts-pink-tint); +} + +/* The browser's own clear button is blue and ignores the palette. */ +.input::-webkit-search-cancel-button { + appearance: none; +} + +/* InstantSearch renders submit and reset buttons; the search box does not need them. */ +.hiddenButton { + display: none; +} + +.layout { + display: grid; + /* + * minmax(0, 1fr), not 1fr: `1fr` means `minmax(auto, 1fr)`, whose floor is + * the column's min-content width, so one long title would squeeze the facets. + */ + grid-template-columns: 16.5rem minmax(0, 1fr); + gap: 2.5rem; + align-items: start; +} + +@media (max-width: 44rem) { + .layout { + grid-template-columns: minmax(0, 1fr); + gap: 1.5rem; + } +} + +.sidebar { + position: sticky; + top: 1.5rem; + display: flex; + flex-direction: column; + gap: 1.5rem; + padding: 1.25rem; + background: var(--ts-page); + border: 1px solid var(--ts-border); + border-radius: 0.5rem; +} + +.facetHeading { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.125rem; + font-weight: 600; + color: var(--ts-text); + margin: 0 0 0.6rem; +} + +.facetList { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 0.5rem; + font-size: 1rem; +} + +.facetLabel { + display: flex; + align-items: center; + gap: 0.5rem; + cursor: pointer; +} + +/* The Typesense Cloud checkbox: Bootstrap's custom checkbox, with its sizes, + colors and check mark. */ +.facetCheckbox { + appearance: none; + flex-shrink: 0; + width: 1.35rem; + height: 1.35rem; + margin: 0; + border: 1px solid var(--ts-checkbox-border); + border-radius: 0.375rem; + background: var(--ts-page) 50% / 50% 50% no-repeat; + cursor: pointer; + transition: + background-color 0.15s ease-in-out, + border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out; +} + +.facetCheckbox:checked { + background-color: var(--ts-pink); + border-color: var(--ts-pink); + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23fefefe' d='m6.564.75-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3E%3C/svg%3E"); +} + +.facetCheckbox:focus-visible { + outline: none; + box-shadow: 0 0 0 0.2rem rgba(237, 14, 115, 0.14); +} + +.facetCheckbox:focus-visible:not(:checked) { + border-color: rgba(237, 14, 115, 0.55); +} + +.facetCheckbox:active:not(:checked) { + background-color: #fbb3d3; + border-color: #fbb3d3; +} + +@media (prefers-reduced-motion: reduce) { + .facetCheckbox { + transition: none; + } +} + +.facetCount { + margin-left: auto; + padding: 0 0.45rem; + font-size: 0.875rem; + color: var(--ts-muted); + background: var(--ts-panel); + border-radius: 1rem; + font-variant-numeric: tabular-nums; +} + +.facetSearch { + margin-bottom: 0.6rem; +} + +.facetSearch button { + display: none; +} + +.facetSearch input { + width: 100%; + padding: 0.4rem 0.6rem; + font: inherit; + font-size: 0.95rem; + color: inherit; + background: var(--ts-panel); + border: 1px solid var(--ts-border); + border-radius: 0.375rem; +} + +.facetSearch input:focus { + outline: none; + border-color: var(--ts-pink); +} + +.stats { + font-size: 0.95rem; + color: var(--ts-muted); + margin-bottom: 0.5rem; +} + +.hitList { + list-style: none; + margin: 0; + padding: 0; +} + +.hitList > li + li { + border-top: 1px solid var(--ts-border); +} + +.hit { + display: flex; + gap: 1rem; + padding: 1rem 0; + align-items: flex-start; +} + +.cover { + width: 3.75rem; + height: 5.5rem; + object-fit: cover; + border-radius: 0.25rem; + background: var(--ts-panel); + flex-shrink: 0; +} + +/* Flex items refuse to shrink below their content by default; without this a long + title pushes the cover out of the row instead of wrapping. */ +.hitBody { + min-width: 0; +} + +.title { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.25rem; + font-weight: 600; + line-height: 1.3; + margin: 0 0 0.35rem; + overflow-wrap: break-word; +} + +/* The typo correction is the point of the demo, so the matched words carry the accent. */ +.title mark { + color: var(--ts-pink); + background: var(--ts-pink-tint); + border-radius: 0.2rem; + padding: 0 0.1rem; +} + +.fields { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 1.25rem; + margin: 0; + font-size: 1rem; +} + +.field { + display: flex; +} + +.field dt { + color: var(--ts-muted); + margin-right: 0.35rem; +} + +.field dd { + margin: 0; + font-variant-numeric: tabular-nums; +} + +.error { + margin: 0 0 1.5rem; + padding: 0.75rem 1rem; + border: 1px solid var(--ts-pink); + border-radius: 0.375rem; + background: var(--ts-pink-tint); + font-size: 1rem; +} + +.empty { + margin: 0; + padding: 1rem 0; + color: var(--ts-muted); +} + +.section + .section { + margin-top: 2.5rem; +} + +.sectionHeader { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 1rem; + padding-bottom: 0.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.sectionTitle { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.5rem; + font-weight: 600; + color: var(--ts-indigo); + margin: 0; +} + +.link { + color: var(--ts-pink); + font-size: 1rem; + text-decoration: none; +} + +.link:hover { + text-decoration: underline; +} + +.back { + display: inline-block; + margin-bottom: 1.25rem; +} + +.page a:focus-visible { + outline: 2px solid var(--ts-pink); + outline-offset: 2px; +} diff --git a/templates/react/files/src/search.tsx b/templates/react/files/src/search.tsx new file mode 100644 index 0000000..88c84fd --- /dev/null +++ b/templates/react/files/src/search.tsx @@ -0,0 +1,245 @@ +import type { ReactNode } from 'react' +import { + Configure, + Highlight, + Hits, + Index, + InstantSearch, + RefinementList, + SearchBox, + Stats, + useInstantSearch, +} from 'react-instantsearch' +import type { Hit } from 'instantsearch.js' +import { collections, searchClient, type Collection, type SearchConfig } from './typesense' +import styles from './search.module.css' + +/** + * Every field name below comes from typesense.config.json, so these pages work + * for any collection. Change what they show there, not here. + */ +type Document = Record + +function label(field: string): string { + const words = field.replace(/[_-]+/g, ' ') + return words.charAt(0).toUpperCase() + words.slice(1) +} + +function format(value: unknown): string { + if (Array.isArray(value)) return value.join(', ') + // Not toLocaleString: it would print a year as "2,008". + return value === null || value === undefined ? '' : String(value) +} + +function DocumentHit({ hit, search }: { hit: Hit; search: SearchConfig }) { + const image = search.image === null ? '' : format(hit[search.image]) + const details = search.display + .map((field) => [field, format(hit[field])] as const) + .filter(([, value]) => value !== '') + + return ( +
    + {image !== '' && ( + (event.currentTarget.style.display = 'none')} + /> + )} +
    +

    + +

    +
    + {details.map(([field, value]) => ( +
    +
    {label(field)}
    +
    {value}
    +
    + ))} +
    +
    +
    + ) +} + +// Made once per collection: an inline component would remount every hit on each render. +const hitComponents = Object.fromEntries( + collections.map(({ name, search }) => [ + name, + function CollectionHit({ hit }: { hit: Hit }) { + return + }, + ]), +) + +/** InstantSearch turns a failed request into zero hits; say what went wrong instead. */ +function SearchError() { + const { error } = useInstantSearch({ catchError: true }) + if (error === undefined) return null + return ( +

    + Search failed: {error.message} Check the field names in typesense.config.json. +

    + ) +} + +function Shell({ + heading, + indexName, + initialQuery, + children, +}: { + heading: string + indexName: string + initialQuery?: string + children: ReactNode +}) { + return ( +
    +
    + + Typesense + + +
    +
    +
    +

    {heading}

    +

    + Misspell it on purpose. Typesense corrects typos as you type. +

    +
    + + + + + {children} + +
    +
    + ) +} + +/** One collection with its own facets: the home page when only one is selected. */ +export function CollectionPage({ + collection, + initialQuery, + showBack = false, +}: { + collection: Collection + initialQuery?: string + showBack?: boolean +}) { + const { name, search } = collection + const facets = search.facets.length > 0 + + return ( + + {showBack && ( + + ← All collections + + )} +
    + {facets && ( + + )} + +
    + + + hitComponent={hitComponents[name]} + classNames={{ list: styles.hitList }} + /> +
    +
    +
    + ) +} + +/** The top 5 hits of one collection, inside an , with a link to all of them. */ +function Section({ collection, rootIndex }: { collection: Collection; rootIndex: string }) { + const { results, uiState } = useInstantSearch() + const query = uiState[rootIndex]?.query ?? '' + const href = `?${new URLSearchParams({ collection: collection.name, q: query })}` + + return ( +
    +
    +

    {collection.name}

    + + Show all in {collection.name} + +
    + {results.nbHits === 0 ? ( +

    No results in {collection.name}.

    + ) : ( + + hitComponent={hitComponents[collection.name]} + classNames={{ list: styles.hitList }} + /> + )} +
    + ) +} + +/** One query, every selected collection: each in its own section. */ +export function FederatedPage() { + // The root index carries the query; every section, its own included, is an . + const rootIndex = collections[0]?.name ?? '' + return ( + + {collections.map((collection) => ( + + +
    + + ))} + + ) +} diff --git a/templates/react/files/src/typesense.ts b/templates/react/files/src/typesense.ts new file mode 100644 index 0000000..b0c3c80 --- /dev/null +++ b/templates/react/files/src/typesense.ts @@ -0,0 +1,76 @@ +import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter' +import config from '../typesense.config.json' + +/** + * Connects the browser to Typesense. + * + * Every value here is read from a VITE_ variable, which means it ships to + * the browser. That is fine — and deliberate — because the only key in this file + * is the search-only key: it can search the collections in typesense.config.json + * and nothing else. It cannot add documents, drop a collection, or create keys. + * + * The admin key lives in the same .env file WITHOUT the VITE_ prefix, so Vite + * never exposes it. Only scripts/seed.ts reads it. + */ +function required(name: string, value: string | undefined): string { + if (value === undefined || value === '') { + throw new Error( + `Missing ${name}. It should be in .env — re-run create-typesense-app if the file is gone.`, + ) + } + return value +} + +/** What the UI searches, facets and shows. Written by create-typesense-app; edit freely. */ +export interface SearchConfig { + queryBy: string[] + facets: string[] + title: string + image: string | null + display: string[] +} + +export interface Collection { + /** The collection or alias to search. */ + name: string + search: SearchConfig +} + +export const collections: Collection[] = config.collections.map(({ name, search }) => ({ + name, + search, +})) +const [first] = collections +if (first === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') +} + +const adapter = new TypesenseInstantSearchAdapter({ + server: { + apiKey: required( + 'VITE_TYPESENSE_SEARCH_ONLY_API_KEY', + import.meta.env.VITE_TYPESENSE_SEARCH_ONLY_API_KEY, + ), + nodes: [ + { + host: required('VITE_TYPESENSE_HOST', import.meta.env.VITE_TYPESENSE_HOST), + port: Number(required('VITE_TYPESENSE_PORT', import.meta.env.VITE_TYPESENSE_PORT)), + protocol: required('VITE_TYPESENSE_PROTOCOL', import.meta.env.VITE_TYPESENSE_PROTOCOL), + }, + ], + // Results are cached briefly so typing does not re-fetch the same query. + cacheSearchResultsForSeconds: 2 * 60, + }, + /** + * Which fields a query is matched against, per collection, from + * typesense.config.json. Ranking ties are broken by each schema's + * `default_sorting_field`, which is why "hary potr" puts the best-known Harry + * Potter book first. + */ + additionalSearchParameters: { query_by: first.search.queryBy.join(',') }, + collectionSpecificSearchParameters: Object.fromEntries( + collections.map(({ name, search }) => [name, { query_by: search.queryBy.join(',') }]), + ), +}) + +export const searchClient = adapter.searchClient diff --git a/templates/react/template.config.js b/templates/react/template.config.js new file mode 100644 index 0000000..21bccd8 --- /dev/null +++ b/templates/react/template.config.js @@ -0,0 +1,37 @@ +/** + * React + react-instantsearch, bundled by Vite. + * Every field is documented in ../README.md — the template contract. + */ +export default { + id: 'react', + name: 'React + react-instantsearch, bundled by Vite', + + // create-vite does not install dependencies, so there is no flag to skip: + // the dependency step is the only install. + scaffold: 'npm create vite@latest {{dir}} -- --template react-ts', + + deps: ['typesense', 'typesense-instantsearch-adapter', 'react-instantsearch'], + // Runs scripts/seed.ts. Node's own TypeScript support is too new to rely on + // across the Node versions this package supports. + devDeps: ['tsx'], + + env: { + file: '.env', + /** + * Vite refuses to expose any variable without this prefix to client code, so + * the admin key cannot reach the browser even by mistake. + */ + publicPrefix: 'VITE_', + }, + + seedCommand: 'tsx scripts/seed.ts', + + files: 'files/', + // The React starter is a landing page. Our App replaces it, which would + // otherwise leave its stylesheets and artwork behind as unreferenced files. + // public/favicon.svg goes because index.html points at the overlay's favicon.png. + remove: ['src/App.css', 'src/index.css', 'src/assets', 'public/icons.svg', 'public/favicon.svg'], + + devCommand: 'npm run dev', + devUrl: 'http://localhost:5173', +} diff --git a/templates/sveltekit/files/scripts/seed.ts b/templates/sveltekit/files/scripts/seed.ts new file mode 100644 index 0000000..46146b9 --- /dev/null +++ b/templates/sveltekit/files/scripts/seed.ts @@ -0,0 +1,205 @@ +/** + * Rebuilds the collection from data/books.jsonl. + * + * Idempotent: it drops the collection, recreates it from the schema in + * typesense.config.json, and re-imports every document. Run it after editing the + * schema or the data. + * + * npm run seed + * + * This is the only file that uses the admin key. Note the variable it reads — + * TYPESENSE_API_KEY, with no PUBLIC_ prefix — so SvelteKit never bundles it + * into anything the browser downloads. + */ +import { readFile, writeFile } from 'node:fs/promises' +import path from 'node:path' + +/** + * Tags the browser-safe key so this script can find its own and avoid piling up a + * new one on every run. Must match what create-typesense-app uses. + */ +const SEARCH_KEY_DESCRIPTION = 'create-typesense-app search-only key' +const ENV_FILE = '.env' +const SEARCH_KEY_VAR = 'PUBLIC_TYPESENSE_SEARCH_ONLY_API_KEY' + +/** + * Reads .env into process.env. + * + * Hand-rolled rather than using a library or Node's --env-file so this script + * runs the same way on every Node version the project might be on. + */ +async function loadEnv(file: string): Promise { + const contents = await readFile(file, 'utf8').catch(() => '') + for (const line of contents.split('\n')) { + const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.exec(line) + if (match === null) continue + const [, name, rawValue = ''] = match + if (name !== undefined && process.env[name] === undefined) { + process.env[name] = rawValue.trim() + } + } +} + +async function main(): Promise { + await loadEnv('.env') + + const config = JSON.parse(await readFile('typesense.config.json', 'utf8')) as { + collections: { name: string; schema: { name: string } }[] + } + const collection = config.collections[0] + if (collection === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') + } + const collectionName = collection.name + + // Coalesced rather than checked for undefined so the type stays `string` inside + // the request helper below. + const adminApiKey = process.env.TYPESENSE_API_KEY ?? '' + if (adminApiKey === '') { + throw new Error( + 'TYPESENSE_API_KEY is missing from .env. It is the admin key, and only this script uses it.', + ) + } + + const host = process.env.PUBLIC_TYPESENSE_HOST ?? 'localhost' + const port = process.env.PUBLIC_TYPESENSE_PORT ?? '8108' + const protocol = process.env.PUBLIC_TYPESENSE_PROTOCOL ?? 'http' + const baseUrl = `${protocol}://${host}:${port}` + + async function typesense( + method: string, + endpoint: string, + body?: string, + contentType = 'application/json', + ): Promise { + const response = await fetch(`${baseUrl}${endpoint}`, { + method, + headers: { 'X-TYPESENSE-API-KEY': adminApiKey, 'Content-Type': contentType }, + body, + }) + const text = await response.text() + // 404 is fine: dropping a collection that is not there yet. + if (!response.ok && response.status !== 404) { + throw new Error(`Typesense replied ${response.status} to ${method} ${endpoint}: ${text}`) + } + return text + } + + const datasetPath = path.join('data', 'books.jsonl') + const jsonl = await readFile(datasetPath, 'utf8').catch(() => { + throw new Error( + `${datasetPath} is missing. Download it with:\n` + + ' curl -L https://dl.typesense.org/datasets/books.jsonl.gz | gunzip > data/books.jsonl', + ) + }) + + console.log(`Rebuilding "${collectionName}" at ${baseUrl}`) + + // Drop first: Typesense will not retrofit an existing collection to a new schema. + await typesense('DELETE', `/collections/${collectionName}`) + await typesense('POST', '/collections', JSON.stringify(collection.schema)) + console.log(' created the collection from typesense.config.json') + + const result = await typesense( + 'POST', + `/collections/${collectionName}/documents/import?action=upsert`, + jsonl, + 'text/plain', + ) + + // The import replies with one JSON object per line: a 200 does not mean success. + let imported = 0 + const failures: string[] = [] + for (const line of result.split('\n')) { + if (line.trim() === '') continue + try { + const outcome = JSON.parse(line) as { success?: boolean; error?: string } + if (outcome.success === true) imported += 1 + else failures.push(outcome.error ?? 'unknown error') + } catch { + failures.push(`unparseable response line: ${line.slice(0, 80)}`) + } + } + + if (failures.length > 0) { + console.error(` ${failures.length} documents failed to index:`) + for (const failure of failures.slice(0, 5)) console.error(` - ${failure}`) + process.exit(1) + } + + console.log(` indexed ${imported} documents`) + + await ensureSearchOnlyKey(typesense, collectionName) + + console.log('\nDone. Try searching for "hary potr".') +} + +/** + * Makes sure the browser still has a working key, recreating it if it is gone. + * + * `docker compose down --volumes` deletes API keys along with the index, and + * Typesense only ever reveals a key's value at creation time — so a wiped key + * cannot be recovered, only replaced. Without this the app would come back with a + * 401 that no amount of reseeding fixed. + * + * Note what the key is allowed to do: search documents, in one collection. That is + * the only key the browser ever receives. + */ +async function ensureSearchOnlyKey( + typesense: ( + method: string, + endpoint: string, + body?: string, + contentType?: string, + ) => Promise, + collectionName: string, +): Promise { + const configured = process.env[SEARCH_KEY_VAR] ?? '' + + const { keys = [] } = JSON.parse(await typesense('GET', '/keys')) as { + keys?: { id: number; description: string; value_prefix: string }[] + } + const ours = keys.filter((key) => key.description === SEARCH_KEY_DESCRIPTION) + + // Typesense exposes only a prefix of an existing key, which is enough to tell + // whether the one in the env file is still the live one. + const stillValid = + configured !== '' && ours.some((key) => configured.startsWith(key.value_prefix)) + if (stillValid) return + + for (const key of ours) { + await typesense('DELETE', `/keys/${key.id}`) + } + + const created = JSON.parse( + await typesense( + 'POST', + '/keys', + JSON.stringify({ + description: SEARCH_KEY_DESCRIPTION, + actions: ['documents:search'], + collections: [collectionName], + }), + ), + ) as { value?: string } + + if (created.value === undefined || created.value === '') { + throw new Error('Typesense created a search-only key but returned no value for it.') + } + + const contents = await readFile(ENV_FILE, 'utf8').catch(() => '') + const line = `${SEARCH_KEY_VAR}=${created.value}` + const lines = contents === '' ? [] : contents.replace(/\n+$/, '').split('\n') + const index = lines.findIndex((existing) => existing.startsWith(`${SEARCH_KEY_VAR}=`)) + if (index === -1) lines.push(line) + else lines[index] = line + await writeFile(ENV_FILE, `${lines.join('\n')}\n`, 'utf8') + + console.log(` created a new search-only key and updated ${ENV_FILE}`) + console.log(' (restart the dev server so it picks up the new value)') +} + +main().catch((error: unknown) => { + console.error(error instanceof Error ? error.message : error) + process.exit(1) +}) diff --git a/templates/sveltekit/files/src/env.ts b/templates/sveltekit/files/src/env.ts new file mode 100644 index 0000000..386e9c5 --- /dev/null +++ b/templates/sveltekit/files/src/env.ts @@ -0,0 +1,25 @@ +import { defineEnvVars } from '@sveltejs/kit/env' + +/** + * The variables the browser may see, read from .env at build time. + * + * SvelteKit exposes only what is listed here with `public: true`, through + * $app/env/public. The admin key, TYPESENSE_API_KEY, is deliberately absent, so + * no client code can import it. Only scripts/seed.ts reads it. + */ +function required(value: string | undefined): string { + if (value === undefined || value === '') { + throw new Error('It should be in .env — re-run create-typesense-app if the file is gone.') + } + return value +} + +const browser = { public: true, static: true, schema: required } + +export const variables = defineEnvVars({ + PUBLIC_TYPESENSE_HOST: browser, + PUBLIC_TYPESENSE_PORT: browser, + PUBLIC_TYPESENSE_PROTOCOL: browser, + // Search-only: it can search the collections in typesense.config.json and nothing else. + PUBLIC_TYPESENSE_SEARCH_ONLY_API_KEY: browser, +}) diff --git a/templates/sveltekit/files/src/lib/Search.svelte b/templates/sveltekit/files/src/lib/Search.svelte new file mode 100644 index 0000000..46c64c8 --- /dev/null +++ b/templates/sveltekit/files/src/lib/Search.svelte @@ -0,0 +1,217 @@ + + + + {collection === undefined ? 'Search' : `Search ${collection.name}`} | Typesense + + +
    +
    + + + + +
    +
    +
    +

    {collection === undefined ? 'Search' : `Search ${collection.name}`}

    +

    Misspell it on purpose. Typesense corrects typos as you type.

    +
    + + + {#if error !== ''} + + {/if} + + {#if collection === undefined} + {#each collections as { name }, i (name)} +
    +
    +

    {name}

    + Show all in {name} +
    +
    +
    + {/each} + {:else} + {#if showBack} + ← All collections + {/if} +
    0 ? 'layout' : undefined}> + {#if collection.search.facets.length > 0} + + {/if} +
    +
    +
    +
    +
    + {/if} +
    +
    diff --git a/templates/sveltekit/files/src/lib/search.css b/templates/sveltekit/files/src/lib/search.css new file mode 100644 index 0000000..f6fcdda --- /dev/null +++ b/templates/sveltekit/files/src/lib/search.css @@ -0,0 +1,392 @@ +/* The search page's styles. InstantSearch renders its own markup, which Svelte + scoped styles cannot reach, so these classes are global. The tokens follow + cloud.typesense.org. */ + +/* The minimal scaffold has no global stylesheet: no reset, so the browser's body + margin and content-box sizing would apply. */ +body { + margin: 0; + -webkit-font-smoothing: antialiased; +} + +.page *, +.page *::before, +.page *::after { + box-sizing: border-box; +} + +.page { + --ts-page: #fefefe; + --ts-panel: #f7f7fa; + --ts-border: #e6e6ee; + --ts-border-strong: #c9cad6; + --ts-text: #303138; + --ts-muted: #6f7082; + --ts-indigo: #3943b7; + --ts-pink: #ed0e73; + --ts-pink-tint: #fde7f1; + --ts-checkbox-border: #9495a6; + /* The Typesense Cloud dashboard's typefaces, loaded in +layout.svelte. */ + --font-body: "Palanquin"; + --font-heading: "Catamaran"; + + width: 100%; + min-height: 100vh; + background: var(--ts-page); + color: var(--ts-text); + font-family: var(--font-body), system-ui, sans-serif; + /* Above Cloud's .95rem: Palanquin's small x-height reads too small on large monitors. */ + font-size: 1.0625rem; + line-height: 1.6; +} + +.topbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 1rem 1.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.logo { + display: block; + height: 2rem; + width: auto; +} + +.nav { + display: flex; + gap: 1.25rem; + font-size: 1rem; +} + +.nav a { + color: var(--ts-muted); + text-decoration: none; +} + +.nav a:hover { + color: var(--ts-pink); +} + +.content { + max-width: 72rem; + margin: 0 auto; + padding: 2.5rem 1.5rem 6rem; +} + +.header { + margin-bottom: 1.5rem; +} + +.heading { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 2.25rem; + font-weight: 600; + line-height: 1.2; + color: var(--ts-indigo); + margin: 0 0 0.35rem; +} + +.subheading { + margin: 0; + color: var(--ts-muted); +} + +.searchRoot { + margin-bottom: 2rem; +} + +.input { + width: 100%; + padding: 0.8rem 1rem; + font: inherit; + font-size: 1.2rem; + color: inherit; + background: var(--ts-page); + border: 1px solid var(--ts-border-strong); + border-radius: 0.375rem; +} + +.input:focus { + outline: none; + border-color: var(--ts-pink); + box-shadow: 0 0 0 3px var(--ts-pink-tint); +} + +/* The browser's own clear button is blue and ignores the palette. */ +.input::-webkit-search-cancel-button { + appearance: none; +} + +/* InstantSearch renders submit and reset buttons; the search box does not need them. */ +.hiddenButton { + display: none; +} + +.layout { + display: grid; + /* + * minmax(0, 1fr), not 1fr: `1fr` means `minmax(auto, 1fr)`, whose floor is + * the column's min-content width, so one long title would squeeze the facets. + */ + grid-template-columns: 16.5rem minmax(0, 1fr); + gap: 2.5rem; + align-items: start; +} + +@media (max-width: 44rem) { + .layout { + grid-template-columns: minmax(0, 1fr); + gap: 1.5rem; + } +} + +.sidebar { + position: sticky; + top: 1.5rem; + display: flex; + flex-direction: column; + gap: 1.5rem; + padding: 1.25rem; + background: var(--ts-page); + border: 1px solid var(--ts-border); + border-radius: 0.5rem; +} + +.facetHeading { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.125rem; + font-weight: 600; + color: var(--ts-text); + margin: 0 0 0.6rem; +} + +.facetList { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 0.5rem; + font-size: 1rem; +} + +.facetLabel { + display: flex; + align-items: center; + gap: 0.5rem; + cursor: pointer; +} + +/* The Typesense Cloud checkbox: Bootstrap's custom checkbox, with its sizes, + colors and check mark. */ +.facetCheckbox { + appearance: none; + flex-shrink: 0; + width: 1.35rem; + height: 1.35rem; + margin: 0; + border: 1px solid var(--ts-checkbox-border); + border-radius: 0.375rem; + background: var(--ts-page) 50% / 50% 50% no-repeat; + cursor: pointer; + transition: + background-color 0.15s ease-in-out, + border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out; +} + +.facetCheckbox:checked { + background-color: var(--ts-pink); + border-color: var(--ts-pink); + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23fefefe' d='m6.564.75-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3E%3C/svg%3E"); +} + +.facetCheckbox:focus-visible { + outline: none; + box-shadow: 0 0 0 0.2rem rgba(237, 14, 115, 0.14); +} + +.facetCheckbox:focus-visible:not(:checked) { + border-color: rgba(237, 14, 115, 0.55); +} + +.facetCheckbox:active:not(:checked) { + background-color: #fbb3d3; + border-color: #fbb3d3; +} + +@media (prefers-reduced-motion: reduce) { + .facetCheckbox { + transition: none; + } +} + +.facetCount { + margin-left: auto; + padding: 0 0.45rem; + font-size: 0.875rem; + color: var(--ts-muted); + background: var(--ts-panel); + border-radius: 1rem; + font-variant-numeric: tabular-nums; +} + +.facetSearch { + margin-bottom: 0.6rem; +} + +.facetSearch button { + display: none; +} + +.facetSearch input { + width: 100%; + padding: 0.4rem 0.6rem; + font: inherit; + font-size: 0.95rem; + color: inherit; + background: var(--ts-panel); + border: 1px solid var(--ts-border); + border-radius: 0.375rem; +} + +.facetSearch input:focus { + outline: none; + border-color: var(--ts-pink); +} + +.stats { + font-size: 0.95rem; + color: var(--ts-muted); + margin-bottom: 0.5rem; +} + +.hitList { + list-style: none; + margin: 0; + padding: 0; +} + +.hitList > li + li { + border-top: 1px solid var(--ts-border); +} + +.hit { + display: flex; + gap: 1rem; + padding: 1rem 0; + align-items: flex-start; +} + +.cover { + width: 3.75rem; + height: 5.5rem; + object-fit: cover; + border-radius: 0.25rem; + background: var(--ts-panel); + flex-shrink: 0; +} + +/* Flex items refuse to shrink below their content by default; without this a long + title pushes the cover out of the row instead of wrapping. */ +.hitBody { + min-width: 0; +} + +.title { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.25rem; + font-weight: 600; + line-height: 1.3; + margin: 0 0 0.35rem; + overflow-wrap: break-word; +} + +/* The typo correction is the point of the demo, so the matched words carry the accent. */ +.title mark { + color: var(--ts-pink); + background: var(--ts-pink-tint); + border-radius: 0.2rem; + padding: 0 0.1rem; +} + +.fields { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 1.25rem; + margin: 0; + font-size: 1rem; +} + +.field { + display: flex; +} + +.field dt { + color: var(--ts-muted); + margin-right: 0.35rem; +} + +.field dd { + margin: 0; + font-variant-numeric: tabular-nums; +} + +.error { + margin: 0 0 1.5rem; + padding: 0.75rem 1rem; + border: 1px solid var(--ts-pink); + border-radius: 0.375rem; + background: var(--ts-pink-tint); + font-size: 1rem; +} + +.empty { + margin: 0; + padding: 1rem 0; + color: var(--ts-muted); +} + +.section + .section { + margin-top: 2.5rem; +} + +.sectionHeader { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 1rem; + padding-bottom: 0.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.sectionTitle { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.5rem; + font-weight: 600; + color: var(--ts-indigo); + margin: 0; +} + +.link { + color: var(--ts-pink); + font-size: 1rem; + text-decoration: none; +} + +.link:hover { + text-decoration: underline; +} + +.back { + display: inline-block; + margin-bottom: 1.25rem; +} + +.page a:focus-visible { + outline: 2px solid var(--ts-pink); + outline-offset: 2px; +} diff --git a/templates/sveltekit/files/src/lib/typesense.ts b/templates/sveltekit/files/src/lib/typesense.ts new file mode 100644 index 0000000..b54ffa4 --- /dev/null +++ b/templates/sveltekit/files/src/lib/typesense.ts @@ -0,0 +1,66 @@ +import { + PUBLIC_TYPESENSE_HOST, + PUBLIC_TYPESENSE_PORT, + PUBLIC_TYPESENSE_PROTOCOL, + PUBLIC_TYPESENSE_SEARCH_ONLY_API_KEY, +} from '$app/env/public' +import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter' +import config from '../../typesense.config.json' + +/** What the UI searches, facets and shows. Written by create-typesense-app; edit freely. */ +export interface SearchConfig { + queryBy: string[] + facets: string[] + title: string + image: string | null + display: string[] +} + +export interface Collection { + /** The collection or alias to search. */ + name: string + search: SearchConfig +} + +export const collections: Collection[] = config.collections.map(({ name, search }) => ({ + name, + search, +})) +const [first] = collections +if (first === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') +} + +/** + * Connects the browser to Typesense. + * + * Every value here ships to the browser. That is fine — and deliberate — because + * the only key is the search-only key. src/env.ts lists what may be public; the + * admin key is not on that list. + */ +const adapter = new TypesenseInstantSearchAdapter({ + server: { + apiKey: PUBLIC_TYPESENSE_SEARCH_ONLY_API_KEY, + nodes: [ + { + host: PUBLIC_TYPESENSE_HOST, + port: Number(PUBLIC_TYPESENSE_PORT), + protocol: PUBLIC_TYPESENSE_PROTOCOL, + }, + ], + // Results are cached briefly so typing does not re-fetch the same query. + cacheSearchResultsForSeconds: 2 * 60, + }, + /** + * Which fields a query is matched against, per collection, from + * typesense.config.json. Ranking ties are broken by each schema's + * `default_sorting_field`, which is why "hary potr" puts the best-known Harry + * Potter book first. + */ + additionalSearchParameters: { query_by: first.search.queryBy.join(',') }, + collectionSpecificSearchParameters: Object.fromEntries( + collections.map(({ name, search }) => [name, { query_by: search.queryBy.join(',') }]), + ), +}) + +export const searchClient = adapter.searchClient diff --git a/templates/sveltekit/files/src/routes/+layout.svelte b/templates/sveltekit/files/src/routes/+layout.svelte new file mode 100644 index 0000000..3ecd9ed --- /dev/null +++ b/templates/sveltekit/files/src/routes/+layout.svelte @@ -0,0 +1,18 @@ + + + + + + + + + + +{@render children()} diff --git a/templates/sveltekit/files/src/routes/+layout.ts b/templates/sveltekit/files/src/routes/+layout.ts new file mode 100644 index 0000000..5945316 --- /dev/null +++ b/templates/sveltekit/files/src/routes/+layout.ts @@ -0,0 +1,2 @@ +// InstantSearch runs in the browser against Typesense, so there is nothing to render on the server. +export const ssr = false diff --git a/templates/sveltekit/files/src/routes/+page.svelte b/templates/sveltekit/files/src/routes/+page.svelte new file mode 100644 index 0000000..cefcda1 --- /dev/null +++ b/templates/sveltekit/files/src/routes/+page.svelte @@ -0,0 +1,7 @@ + + + + diff --git a/templates/sveltekit/files/src/routes/collections/[name]/+page.svelte b/templates/sveltekit/files/src/routes/collections/[name]/+page.svelte new file mode 100644 index 0000000..7b152b2 --- /dev/null +++ b/templates/sveltekit/files/src/routes/collections/[name]/+page.svelte @@ -0,0 +1,11 @@ + + + +{#key data} + +{/key} diff --git a/templates/sveltekit/files/src/routes/collections/[name]/+page.ts b/templates/sveltekit/files/src/routes/collections/[name]/+page.ts new file mode 100644 index 0000000..0812372 --- /dev/null +++ b/templates/sveltekit/files/src/routes/collections/[name]/+page.ts @@ -0,0 +1,12 @@ +import { error } from '@sveltejs/kit' +import { collections } from '../../../lib/typesense' +import type { PageLoad } from './$types' + +/** "Show all in ": one collection with its facets, keeping the query. */ +export const load: PageLoad = ({ params, url }) => { + const collection = collections.find((entry) => entry.name === params.name) + if (collection === undefined) { + error(404, `No collection named "${params.name}" in typesense.config.json.`) + } + return { collection, query: url.searchParams.get('q') ?? '' } +} diff --git a/templates/sveltekit/files/static/favicon.png b/templates/sveltekit/files/static/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..dca9badb45ef5b832e682e4bca90c77c1fc8d671 GIT binary patch literal 34884 zcmXt9by!s2(_f^)1!)24PDNNyx|Z(lZWa{jMmhvUx?z!SSVB^el3rrz5Rep5Qu@7q zf6w~|56?aKp0ji2&V1&~XXeIesL6xzsPI4_5Li(`Rtp4r1pD`gg9VI8rarI$|8UUYvUP@I81gcNOzqP~!fua@^WucLKqGg`b9MYB1r3DGFdNN$L?d38*ATa#mBX^ryLsPsEDX@#4J2X4{ z=4Xz3e#?RITJ0D9Z=+)Tmm{y|u1p`&*SaSpg|I@Ga@GZHZ%-+~`RbJ26Dg4sXduwK ztekPcGTHJ4W{V4$t`HoE#Z7Dy#!75O=kWI#u%}olxQjq*pinC~d(*1sV#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`aZXZZZVo^Uy&;VSW&6 zh6c)HevAQH5|~Vz^;_>|F@FMg8fnRu<0XW)2Ad>`zoHiaBgRymn7JRbk7Q4@$ zDhJuRbwpV(optn1%v5{oxXCN}>>82yw4~@wriC0V7G82fcG{EC=5%+Rjfu(;V530im`sXtEw$;Akj*FAsvLJf+bp5D zQ%q(`QTYqx`rp3&U*Emj|2tcKyMMD=8YHJlN6z4@&b(geF;U zMpnc(Z$2Xie;>3%c*n~kS&F0o7h4xt7z~tc0!@MM zV=}XcGP&jIA~8bj(6_kvJ`_6w>_=oQQdpA5g+382$g+CSQVDk-r=rHJxR4`gf~;6C zP|!#4YS-a;YHs6w1+OG%lc(iub)NLHlHOq!q$9Gd0&O1zM4fqO@NnFCDt7W1=5bmd zWR2LN$C4MtomnD#K$4ZjZ43@BkIMrZb?-r`QyvrMZPT{s$KbSPgms`VV;NP8nbT~F zx*^oDTFZ1<@ZJ~`2OJ;#U=2v0hghx9zWuF|JGv@$c%ckTc+R$TIKyBhGRK6tt(76m zIwf+t8g+Q(MwDk{PM|%oAmQd>zHeV&r_Nf5zJhy!Utt-2K6gEfA7g>swKgbJA11lfU6uCiE7DE)r!k3G|v z)&jS|m%m}C`d!#&8OMG7k08)}ekt=U^>%$JEcx?zUEBHXl4_ErPwJUlD}9+gb>;)B P3I+yGS3j3^P6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/sveltekit/template.config.js b/templates/sveltekit/template.config.js new file mode 100644 index 0000000..0a01b32 --- /dev/null +++ b/templates/sveltekit/template.config.js @@ -0,0 +1,40 @@ +/** + * SvelteKit + instantsearch.js. + * Every field is documented in ../README.md — the template contract. + */ +export default { + id: 'sveltekit', + name: 'SvelteKit + instantsearch.js', + + // The official generator. These four flags are what it needs to skip every + // prompt; --no-install leaves the dependency step as the only install. + scaffold: + 'npx --yes sv@latest create {{dir}} --template minimal --types ts --no-add-ons --no-install', + + // There is no official Svelte binding for InstantSearch, so the widgets run in + // the browser and own their DOM, as in the qwik template. + deps: ['typesense', 'typesense-instantsearch-adapter', 'instantsearch.js'], + // Runs scripts/seed.ts. Node's own TypeScript support is too new to rely on + // across the Node versions this package supports. + devDeps: ['tsx'], + + env: { + file: '.env', + /** + * SvelteKit 3 no longer keys on a prefix: src/env.ts declares which variables + * the browser gets, and the admin key is not among them. PUBLIC_ is kept as + * the naming convention SvelteKit's docs and older projects use. + */ + publicPrefix: 'PUBLIC_', + }, + + seedCommand: 'tsx scripts/seed.ts', + + files: 'files/', + // The starter's favicon, which the overlay's +layout.svelte replaced with + // static/favicon.png. + remove: ['src/lib/assets'], + + devCommand: 'npm run dev', + devUrl: 'http://localhost:5173', +} diff --git a/templates/vue/files/index.html b/templates/vue/files/index.html new file mode 100644 index 0000000..4994f93 --- /dev/null +++ b/templates/vue/files/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + Search | Typesense + + +
    + + + diff --git a/templates/vue/files/public/favicon.png b/templates/vue/files/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..dca9badb45ef5b832e682e4bca90c77c1fc8d671 GIT binary patch literal 34884 zcmXt9by!s2(_f^)1!)24PDNNyx|Z(lZWa{jMmhvUx?z!SSVB^el3rrz5Rep5Qu@7q zf6w~|56?aKp0ji2&V1&~XXeIesL6xzsPI4_5Li(`Rtp4r1pD`gg9VI8rarI$|8UUYvUP@I81gcNOzqP~!fua@^WucLKqGg`b9MYB1r3DGFdNN$L?d38*ATa#mBX^ryLsPsEDX@#4J2X4{ z=4Xz3e#?RITJ0D9Z=+)Tmm{y|u1p`&*SaSpg|I@Ga@GZHZ%-+~`RbJ26Dg4sXduwK ztekPcGTHJ4W{V4$t`HoE#Z7Dy#!75O=kWI#u%}olxQjq*pinC~d(*1sV#csevA~pi znfz%VC7>DI1;HR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 zh6c)HevAQH5|~Vz^;_>|F@FMg8fnRu<0XW)2Ad>`zoHiaBgRymn7JRbk7Q4@$ zDhJuRbwpV(optn1%v5{oxXCN}>>82yw4~@wriC0V7G82fcG{EC=5%+Rjfu(;V530im`sXtEw$;Akj*FAsvLJf+bp5D zQ%q(`QTYqx`rp3&U*Emj|2tcKyMMD=8YHJlN6z4@&b(geF;U zMpnc(Z$2Xie;>3%c*n~kS&F0o7h4xt7z~tc0!@MM zV=}XcGP&jIA~8bj(6_kvJ`_6w>_=oQQdpA5g+382$g+CSQVDk-r=rHJxR4`gf~;6C zP|!#4YS-a;YHs6w1+OG%lc(iub)NLHlHOq!q$9Gd0&O1zM4fqO@NnFCDt7W1=5bmd zWR2LN$C4MtomnD#K$4ZjZ43@BkIMrZb?-r`QyvrMZPT{s$KbSPgms`VV;NP8nbT~F zx*^oDTFZ1<@ZJ~`2OJ;#U=2v0hghx9zWuF|JGv@$c%ckTc+R$TIKyBhGRK6tt(76m zIwf+t8g+Q(MwDk{PM|%oAmQd>zHeV&r_Nf5zJhy!Utt-2K6gEfA7g>swKgbJA11lfU6uCiE7DE)r!k3G|v z)&jS|m%m}C`d!#&8OMG7k08)}ekt=U^>%$JEcx?zUEBHXl4_ErPwJUlD}9+gb>;)B P3I+yGS3j3^P6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/vue/files/scripts/seed.js b/templates/vue/files/scripts/seed.js new file mode 100644 index 0000000..3f6de2f --- /dev/null +++ b/templates/vue/files/scripts/seed.js @@ -0,0 +1,186 @@ +/** + * Rebuilds the collection from data/books.jsonl. + * + * Idempotent: it drops the collection, recreates it from the schema in + * typesense.config.json, and re-imports every document. Run it after editing the + * schema or the data. + * + * npm run seed + * + * This is the only file that uses the admin key. Note the variable it reads — + * TYPESENSE_API_KEY, with no VITE_ prefix — which is exactly why Vite will not + * expose it to anything the browser downloads. + */ +import { readFile, writeFile } from 'node:fs/promises' +import path from 'node:path' + +/** + * Tags the browser-safe key so this script can find its own and avoid piling up a + * new one on every run. Must match what create-typesense-app uses. + */ +const SEARCH_KEY_DESCRIPTION = 'create-typesense-app search-only key' +const ENV_FILE = '.env' +const SEARCH_KEY_VAR = 'VITE_TYPESENSE_SEARCH_ONLY_API_KEY' + +/** + * Reads .env into process.env. + * + * Hand-rolled rather than using a library or Node's --env-file so this script + * runs the same way on every Node version the project might be on. + */ +async function loadEnv(file) { + const contents = await readFile(file, 'utf8').catch(() => '') + for (const line of contents.split('\n')) { + const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.exec(line) + if (match === null) continue + const [, name, rawValue = ''] = match + if (name !== undefined && process.env[name] === undefined) { + process.env[name] = rawValue.trim() + } + } +} + +async function main() { + await loadEnv(ENV_FILE) + + const config = JSON.parse(await readFile('typesense.config.json', 'utf8')) + const collection = config.collections[0] + if (collection === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') + } + const collectionName = collection.name + + const adminApiKey = process.env.TYPESENSE_API_KEY ?? '' + if (adminApiKey === '') { + throw new Error( + 'TYPESENSE_API_KEY is missing from .env. It is the admin key, and only this script uses it.', + ) + } + + const host = process.env.VITE_TYPESENSE_HOST ?? 'localhost' + const port = process.env.VITE_TYPESENSE_PORT ?? '8108' + const protocol = process.env.VITE_TYPESENSE_PROTOCOL ?? 'http' + const baseUrl = `${protocol}://${host}:${port}` + + async function typesense(method, endpoint, body, contentType = 'application/json') { + const response = await fetch(`${baseUrl}${endpoint}`, { + method, + headers: { 'X-TYPESENSE-API-KEY': adminApiKey, 'Content-Type': contentType }, + body, + }) + const text = await response.text() + // 404 is fine: dropping a collection that is not there yet. + if (!response.ok && response.status !== 404) { + throw new Error(`Typesense replied ${response.status} to ${method} ${endpoint}: ${text}`) + } + return text + } + + const datasetPath = path.join('data', 'books.jsonl') + const jsonl = await readFile(datasetPath, 'utf8').catch(() => { + throw new Error( + `${datasetPath} is missing. Download it with:\n` + + ' curl -L https://dl.typesense.org/datasets/books.jsonl.gz | gunzip > data/books.jsonl', + ) + }) + + console.log(`Rebuilding "${collectionName}" at ${baseUrl}`) + + // Drop first: Typesense will not retrofit an existing collection to a new schema. + await typesense('DELETE', `/collections/${collectionName}`) + await typesense('POST', '/collections', JSON.stringify(collection.schema)) + console.log(' created the collection from typesense.config.json') + + const result = await typesense( + 'POST', + `/collections/${collectionName}/documents/import?action=upsert`, + jsonl, + 'text/plain', + ) + + // The import replies with one JSON object per line: a 200 does not mean success. + let imported = 0 + const failures = [] + for (const line of result.split('\n')) { + if (line.trim() === '') continue + try { + const outcome = JSON.parse(line) + if (outcome.success === true) imported += 1 + else failures.push(outcome.error ?? 'unknown error') + } catch { + failures.push(`unparseable response line: ${line.slice(0, 80)}`) + } + } + + if (failures.length > 0) { + console.error(` ${failures.length} documents failed to index:`) + for (const failure of failures.slice(0, 5)) console.error(` - ${failure}`) + process.exit(1) + } + + console.log(` indexed ${imported} documents`) + + await ensureSearchOnlyKey(typesense, collectionName) + + console.log('\nDone. Try searching for "hary potr".') +} + +/** + * Makes sure the browser still has a working key, recreating it if it is gone. + * + * `docker compose down --volumes` deletes API keys along with the index, and + * Typesense only ever reveals a key's value at creation time — so a wiped key + * cannot be recovered, only replaced. Without this the app would come back with a + * 401 that no amount of reseeding fixed. + * + * Note what the key is allowed to do: search documents, in one collection. That is + * the only key the browser ever receives. + */ +async function ensureSearchOnlyKey(typesense, collectionName) { + const configured = process.env[SEARCH_KEY_VAR] ?? '' + + const { keys = [] } = JSON.parse(await typesense('GET', '/keys')) + const ours = keys.filter((key) => key.description === SEARCH_KEY_DESCRIPTION) + + // Typesense exposes only a prefix of an existing key, which is enough to tell + // whether the one in the env file is still the live one. + const stillValid = + configured !== '' && ours.some((key) => configured.startsWith(key.value_prefix)) + if (stillValid) return + + for (const key of ours) { + await typesense('DELETE', `/keys/${key.id}`) + } + + const created = JSON.parse( + await typesense( + 'POST', + '/keys', + JSON.stringify({ + description: SEARCH_KEY_DESCRIPTION, + actions: ['documents:search'], + collections: [collectionName], + }), + ), + ) + + if (typeof created.value !== 'string' || created.value === '') { + throw new Error('Typesense created a search-only key but returned no value for it.') + } + + const contents = await readFile(ENV_FILE, 'utf8').catch(() => '') + const line = `${SEARCH_KEY_VAR}=${created.value}` + const lines = contents === '' ? [] : contents.replace(/\n+$/, '').split('\n') + const index = lines.findIndex((existing) => existing.startsWith(`${SEARCH_KEY_VAR}=`)) + if (index === -1) lines.push(line) + else lines[index] = line + await writeFile(ENV_FILE, `${lines.join('\n')}\n`, 'utf8') + + console.log(` created a new search-only key and updated ${ENV_FILE}`) + console.log(' (restart the dev server so it picks up the new value)') +} + +main().catch((error) => { + console.error(error instanceof Error ? error.message : error) + process.exit(1) +}) diff --git a/templates/vue/files/src/App.vue b/templates/vue/files/src/App.vue new file mode 100644 index 0000000..f7a150d --- /dev/null +++ b/templates/vue/files/src/App.vue @@ -0,0 +1,84 @@ + + + diff --git a/templates/vue/files/src/components/CollectionPage.vue b/templates/vue/files/src/components/CollectionPage.vue new file mode 100644 index 0000000..348191a --- /dev/null +++ b/templates/vue/files/src/components/CollectionPage.vue @@ -0,0 +1,38 @@ + + + diff --git a/templates/vue/files/src/components/DocumentHit.vue b/templates/vue/files/src/components/DocumentHit.vue new file mode 100644 index 0000000..38fd09b --- /dev/null +++ b/templates/vue/files/src/components/DocumentHit.vue @@ -0,0 +1,36 @@ + + + diff --git a/templates/vue/files/src/components/FederatedPage.vue b/templates/vue/files/src/components/FederatedPage.vue new file mode 100644 index 0000000..7d6cd56 --- /dev/null +++ b/templates/vue/files/src/components/FederatedPage.vue @@ -0,0 +1,44 @@ + + + diff --git a/templates/vue/files/src/style.css b/templates/vue/files/src/style.css new file mode 100644 index 0000000..bda3944 --- /dev/null +++ b/templates/vue/files/src/style.css @@ -0,0 +1,387 @@ +/* Replaces the Vite starter's stylesheet, which pins #app to a fixed-width, + centred column styled for its landing page. The tokens follow + cloud.typesense.org; the fonts load in index.html. */ + +:root { + --ts-page: #fefefe; + --ts-panel: #f7f7fa; + --ts-border: #e6e6ee; + --ts-border-strong: #c9cad6; + --ts-text: #303138; + --ts-muted: #6f7082; + --ts-indigo: #3943b7; + --ts-pink: #ed0e73; + --ts-pink-tint: #fde7f1; + --ts-checkbox-border: #9495a6; + /* The Typesense Cloud dashboard's typefaces: Palanquin for text, Catamaran for headings. */ + --font-body: "Palanquin"; + --font-heading: "Catamaran"; +} + +*, +*::before, +*::after { + box-sizing: border-box; +} + +body { + margin: 0; + background: var(--ts-page); + -webkit-font-smoothing: antialiased; +} + +.page { + min-height: 100vh; + background: var(--ts-page); + color: var(--ts-text); + font-family: var(--font-body), system-ui, sans-serif; + /* Above Cloud's .95rem: Palanquin's small x-height reads too small on large monitors. */ + font-size: 1.0625rem; + line-height: 1.6; +} + +.topbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 1rem 1.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.logo { + display: block; + height: 2rem; + width: auto; +} + +.nav { + display: flex; + gap: 1.25rem; + font-size: 1rem; +} + +.nav a { + color: var(--ts-muted); + text-decoration: none; +} + +.nav a:hover { + color: var(--ts-pink); +} + +.content { + max-width: 72rem; + margin: 0 auto; + padding: 2.5rem 1.5rem 6rem; +} + +.header { + margin-bottom: 1.5rem; +} + +.heading { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 2.25rem; + font-weight: 600; + line-height: 1.2; + color: var(--ts-indigo); + margin: 0 0 0.35rem; +} + +.subheading { + margin: 0; + color: var(--ts-muted); +} + +.content > .ais-InstantSearch > .ais-SearchBox { + margin-bottom: 2rem; +} + +.ais-SearchBox-input { + width: 100%; + padding: 0.8rem 1rem; + font: inherit; + font-size: 1.2rem; + color: inherit; + background: var(--ts-page); + border: 1px solid var(--ts-border-strong); + border-radius: 0.375rem; +} + +.ais-SearchBox-input:focus { + outline: none; + border-color: var(--ts-pink); + box-shadow: 0 0 0 3px var(--ts-pink-tint); +} + +/* The browser's own clear button is blue and ignores the palette. */ +.ais-SearchBox-input::-webkit-search-cancel-button { + appearance: none; +} + +/* InstantSearch renders submit, reset and loading buttons; the search box and + the facet search boxes do not need them. */ +.ais-SearchBox-submit, +.ais-SearchBox-reset, +.ais-SearchBox-loadingIndicator { + display: none; +} + +.layout { + display: grid; + /* + * minmax(0, 1fr), not 1fr: `1fr` means `minmax(auto, 1fr)`, whose floor is + * the column's min-content width, so one long title would squeeze the facets. + */ + grid-template-columns: 16.5rem minmax(0, 1fr); + gap: 2.5rem; + align-items: start; +} + +@media (max-width: 44rem) { + .layout { + grid-template-columns: minmax(0, 1fr); + gap: 1.5rem; + } +} + +.sidebar { + position: sticky; + top: 1.5rem; + display: flex; + flex-direction: column; + gap: 1.5rem; + padding: 1.25rem; + background: var(--ts-page); + border: 1px solid var(--ts-border); + border-radius: 0.5rem; +} + +.facet-heading { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.125rem; + font-weight: 600; + color: var(--ts-text); + margin: 0 0 0.6rem; +} + +.ais-RefinementList-list { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 0.5rem; + font-size: 1rem; +} + +.ais-RefinementList-label { + display: flex; + align-items: center; + gap: 0.5rem; + cursor: pointer; +} + +/* The Typesense Cloud checkbox: Bootstrap's custom checkbox, with its sizes, + colors and check mark. */ +.ais-RefinementList-checkbox { + appearance: none; + flex-shrink: 0; + width: 1.35rem; + height: 1.35rem; + margin: 0; + border: 1px solid var(--ts-checkbox-border); + border-radius: 0.375rem; + background: var(--ts-page) 50% / 50% 50% no-repeat; + cursor: pointer; + transition: + background-color 0.15s ease-in-out, + border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out; +} + +.ais-RefinementList-checkbox:checked { + background-color: var(--ts-pink); + border-color: var(--ts-pink); + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23fefefe' d='m6.564.75-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3E%3C/svg%3E"); +} + +.ais-RefinementList-checkbox:focus-visible { + outline: none; + box-shadow: 0 0 0 0.2rem rgba(237, 14, 115, 0.14); +} + +.ais-RefinementList-checkbox:focus-visible:not(:checked) { + border-color: rgba(237, 14, 115, 0.55); +} + +.ais-RefinementList-checkbox:active:not(:checked) { + background-color: #fbb3d3; + border-color: #fbb3d3; +} + +@media (prefers-reduced-motion: reduce) { + .ais-RefinementList-checkbox { + transition: none; + } +} + +.ais-RefinementList-count { + margin-left: auto; + padding: 0 0.45rem; + font-size: 0.875rem; + color: var(--ts-muted); + background: var(--ts-panel); + border-radius: 1rem; + font-variant-numeric: tabular-nums; +} + +.ais-RefinementList-searchBox { + margin-bottom: 0.6rem; +} + +.ais-RefinementList-searchBox .ais-SearchBox-input { + padding: 0.4rem 0.6rem; + font-size: 0.95rem; + background: var(--ts-panel); + border: 1px solid var(--ts-border); +} + +.ais-RefinementList-searchBox .ais-SearchBox-input:focus { + border-color: var(--ts-pink); + box-shadow: none; +} + +.ais-Stats { + font-size: 0.95rem; + color: var(--ts-muted); + margin-bottom: 0.5rem; +} + +.hit-list { + list-style: none; + margin: 0; + padding: 0; +} + +.hit-list > li + li { + border-top: 1px solid var(--ts-border); +} + +.hit { + display: flex; + gap: 1rem; + padding: 1rem 0; + align-items: flex-start; +} + +.cover { + width: 3.75rem; + height: 5.5rem; + object-fit: cover; + border-radius: 0.25rem; + background: var(--ts-panel); + flex-shrink: 0; +} + +/* Flex items refuse to shrink below their content by default; without this a long + title pushes the cover out of the row instead of wrapping. */ +.hit-body { + min-width: 0; +} + +.title { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.25rem; + font-weight: 600; + line-height: 1.3; + margin: 0 0 0.35rem; + overflow-wrap: break-word; +} + +/* The typo correction is the point of the demo, so the matched words carry the accent. */ +.title mark { + color: var(--ts-pink); + background: var(--ts-pink-tint); + border-radius: 0.2rem; + padding: 0 0.1rem; +} + +.fields { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 1.25rem; + margin: 0; + font-size: 1rem; +} + +.field { + display: flex; +} + +.field dt { + color: var(--ts-muted); + margin-right: 0.35rem; +} + +.field dd { + margin: 0; + font-variant-numeric: tabular-nums; +} + +.error { + margin: 0 0 1.5rem; + padding: 0.75rem 1rem; + border: 1px solid var(--ts-pink); + border-radius: 0.375rem; + background: var(--ts-pink-tint); + font-size: 1rem; +} + +.empty { + margin: 0; + padding: 1rem 0; + color: var(--ts-muted); +} + +.section + .section { + margin-top: 2.5rem; +} + +.section-header { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 1rem; + padding-bottom: 0.5rem; + border-bottom: 1px solid var(--ts-border); +} + +.section-title { + font-family: var(--font-heading), system-ui, sans-serif; + font-size: 1.5rem; + font-weight: 600; + color: var(--ts-indigo); + margin: 0; +} + +.link { + color: var(--ts-pink); + font-size: 1rem; + text-decoration: none; +} + +.link:hover { + text-decoration: underline; +} + +.back { + display: inline-block; + margin-bottom: 1.25rem; +} + +.page a:focus-visible { + outline: 2px solid var(--ts-pink); + outline-offset: 2px; +} diff --git a/templates/vue/files/src/typesense.ts b/templates/vue/files/src/typesense.ts new file mode 100644 index 0000000..c4f0a94 --- /dev/null +++ b/templates/vue/files/src/typesense.ts @@ -0,0 +1,86 @@ +import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter' +import config from '../typesense.config.json' + +/** + * Connects the browser to Typesense. + * + * Everything here is read from a VITE_ variable, which means it ships to the + * browser. That is deliberate: the only key in this file is the search-only key, + * which can search the collections in typesense.config.json and nothing else. It + * cannot add documents, drop a collection, or create further keys. + * + * The admin key sits in the same .env file WITHOUT the VITE_ prefix, and Vite + * refuses to expose unprefixed variables to client code. Only scripts/seed.js + * reads it. + */ +function required(name: string): string { + const value: string | undefined = import.meta.env[name] + if (value === undefined || value === '') { + throw new Error( + `Missing ${name}. It should be in .env — re-run create-typesense-app if the file is gone.`, + ) + } + return value +} + +/** What the UI searches, facets and shows. Written by create-typesense-app; edit freely. */ +export interface SearchConfig { + queryBy: string[] + facets: string[] + title: string + image: string | null + display: string[] +} + +export interface Collection { + /** The collection or alias to search. */ + name: string + search: SearchConfig +} + +export const collections: Collection[] = config.collections.map(({ name, search }) => ({ + name, + search, +})) +const [first] = collections +if (first === undefined) { + throw new Error('typesense.config.json lists no collections. Re-run create-typesense-app.') +} + +const adapter = new TypesenseInstantSearchAdapter({ + server: { + apiKey: required('VITE_TYPESENSE_SEARCH_ONLY_API_KEY'), + nodes: [ + { + host: required('VITE_TYPESENSE_HOST'), + port: Number(required('VITE_TYPESENSE_PORT')), + protocol: required('VITE_TYPESENSE_PROTOCOL'), + }, + ], + // Results are cached briefly so typing does not re-fetch the same query. + cacheSearchResultsForSeconds: 2 * 60, + }, + /** + * Which fields a query is matched against, per collection, from + * typesense.config.json. Ranking ties are broken by each schema's + * `default_sorting_field`, which is why "hary potr" puts the best-known Harry + * Potter book first. + */ + additionalSearchParameters: { query_by: first.search.queryBy.join(',') }, + collectionSpecificSearchParameters: Object.fromEntries( + collections.map(({ name, search }) => [name, { query_by: search.queryBy.join(',') }]), + ), +}) + +export const searchClient = adapter.searchClient + +export function label(field: string): string { + const words = field.replace(/[_-]+/g, ' ') + return words.charAt(0).toUpperCase() + words.slice(1) +} + +export function format(value: unknown): string { + if (Array.isArray(value)) return value.join(', ') + // Not toLocaleString: it would print a year as "2,008". + return value === null || value === undefined ? '' : String(value) +} diff --git a/templates/vue/files/src/vue-instantsearch.d.ts b/templates/vue/files/src/vue-instantsearch.d.ts new file mode 100644 index 0000000..156e1dd --- /dev/null +++ b/templates/vue/files/src/vue-instantsearch.d.ts @@ -0,0 +1,12 @@ +// vue-instantsearch ships no type declarations; its components are typed loosely here. +declare module 'vue-instantsearch/vue3/es' { + import type { Component } from 'vue' + export const AisConfigure: Component + export const AisHighlight: Component + export const AisHits: Component + export const AisIndex: Component + export const AisInstantSearch: Component + export const AisRefinementList: Component + export const AisSearchBox: Component + export const AisStats: Component +} diff --git a/templates/vue/template.config.js b/templates/vue/template.config.js new file mode 100644 index 0000000..4e1a577 --- /dev/null +++ b/templates/vue/template.config.js @@ -0,0 +1,38 @@ +/** + * Vue 3 + vue-instantsearch, bundled by Vite. + * Every field is documented in ../README.md — the template contract. + */ +export default { + id: 'vue', + name: 'Vue + vue-instantsearch', + + // create-vite does not install dependencies, so there is no flag to skip: + // the dependency step is the only install. + scaffold: 'npm create vite@latest {{dir}} -- --template vue-ts', + + // vue-instantsearch brings instantsearch.js itself; it is listed because + // src/App.vue imports its types, which should not rely on hoisting. + deps: ['typesense', 'typesense-instantsearch-adapter', 'vue-instantsearch', 'instantsearch.js'], + // Nothing extra: the seed script is plain JS, so Node runs it directly. + devDeps: [], + + env: { + file: '.env', + /** + * Vite refuses to expose any variable without this prefix to client code, so + * the admin key cannot reach the browser even by mistake. + */ + publicPrefix: 'VITE_', + }, + + seedCommand: 'node scripts/seed.js', + + files: 'files/', + // The Vue starter is a landing page. Our App replaces it, which would otherwise + // leave its demo component and artwork behind as unreferenced files. + // public/favicon.svg goes because the overlay's public/favicon.png is the Typesense favicon. + remove: ['src/components/HelloWorld.vue', 'src/assets', 'public/icons.svg', 'public/favicon.svg'], + + devCommand: 'npm run dev', + devUrl: 'http://localhost:5173', +} From c15caed3b33aab190bfc121bd53c818100908fb9 Mon Sep 17 00:00:00 2001 From: Nikhil Adiga Date: Mon, 23 Nov 2026 17:21:59 +0530 Subject: [PATCH 04/16] Add an end-to-end check for each template --- package-lock.json | 30 +++++ package.json | 4 +- scripts/e2e.mjs | 242 ++++++++++++++++++++++++++++++++++++++ test/fixtures/movies.json | 62 ++++++++++ 4 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 scripts/e2e.mjs create mode 100644 test/fixtures/movies.json diff --git a/package-lock.json b/package-lock.json index 48d1593..a8f64c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ }, "devDependencies": { "@types/node": "^26.1.2", + "playwright": "^1.64.1", "typescript": "^7.0.2", "vitest": "^4.1.10" }, @@ -1421,6 +1422,35 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/playwright": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.1.tgz", + "integrity": "sha512-HCrVhHr5QQuwYoswEUGTb7gGp522yflbv/ST8nF4sFWGuLjQCt17Q/EubpGGSNKYn1tsTCPZxqHhHCfVURu7UA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/playwright-core": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.1.tgz", + "integrity": "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/postcss": { "version": "8.5.25", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.25.tgz", diff --git a/package.json b/package.json index cedbf98..fd31445 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "typecheck": "tsc --noEmit && tsc -p tsconfig.test.json", "test": "vitest run", "test:watch": "vitest", - "prepublishOnly": "npm run typecheck && npm run test && npm run build" + "prepublishOnly": "npm run typecheck && npm run test && npm run build", + "e2e": "node scripts/e2e.mjs" }, "dependencies": { "@clack/prompts": "^1.7.0", @@ -43,6 +44,7 @@ }, "devDependencies": { "@types/node": "^26.1.2", + "playwright": "^1.64.1", "typescript": "^7.0.2", "vitest": "^4.1.10" } diff --git a/scripts/e2e.mjs b/scripts/e2e.mjs new file mode 100644 index 0000000..37662f9 --- /dev/null +++ b/scripts/e2e.mjs @@ -0,0 +1,242 @@ +#!/usr/bin/env node +/** + * Proves one template works for a real user: scaffold it with the built CLI, + * build it, start its dev server, then check in a headless browser that the page + * opens with results and that a misspelling finds its document. + * + * npm run build && npm run e2e -- nextjs # local server, books + * npm run build && npm run e2e -- nextjs --existing # existing server, movies + * + * --existing starts its own Typesense, loads test/fixtures/movies.json (no field + * in common with books) and runs the CLI against it with a search key, the way a + * developer with their own server would. + * + * Skips (exit 0) when Docker is unavailable. Never prints a key: the CLI's own + * output names the key variables but not their values. + */ +import { spawn } from 'node:child_process' +import { randomBytes } from 'node:crypto' +import { mkdtempSync, readdirSync, readFileSync } from 'node:fs' +import { tmpdir } from 'node:os' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import { execa } from 'execa' +import { chromium } from 'playwright' + +const root = path.dirname(path.dirname(fileURLToPath(import.meta.url))) +const [id, mode] = process.argv.slice(2) +const existing = mode === '--existing' +if (id === undefined) { + console.error('Usage: npm run e2e --