create-lacspace-app 2.2.2 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -1
- package/dist/index.js +1631 -40
- package/dist/lib.cjs +1639 -39
- package/dist/lib.d.cts +65 -1
- package/dist/lib.d.ts +65 -1
- package/dist/lib.js +1638 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,10 +14,24 @@
|
|
|
14
14
|
npm create lacspace-app@latest my-app
|
|
15
15
|
# or pick a template up front
|
|
16
16
|
npx create-lacspace-app my-app --template saas
|
|
17
|
+
# or scaffold a full-stack app (frontend + real API)
|
|
18
|
+
npx create-lacspace-app my-app --template saas --fullstack
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
You choose the *kind* of site you're building. It writes a **real Next.js 15 + React 19 + Tailwind v4 app** — not a hello-world, but a genuinely **polished, modern site**: a fluid `clamp()` type scale, tight display headings, a refined light **and** dark palette, glass chrome, soft layered shadows, a smooth logo marquee, animated counters, scroll reveals and a shimmering primary CTA — every page filled in, an SEO stack wired end-to-end, and a **26-component UI kit** you can drop in anywhere.
|
|
20
22
|
|
|
23
|
+
> **New in v2.4 — static *or* full-stack.** Now the interactive prompt (after you pick a template) asks what *kind* of app you want:
|
|
24
|
+
> - **Static / frontend only** *(default)* — today's single Next.js app, unchanged.
|
|
25
|
+
> - **Dynamic / full-stack** (`--fullstack`) — an npm-workspaces **monorepo**: a `frontend/` Next.js app **+** a `backend/` **Node · Express · MongoDB · Redis · TypeScript** API **+** a shared `types/` package the two both import (so the API contract can't drift), plus a root `docker-compose.yml` (Mongo + Redis) and **one** `npm install` / `npm run dev` for the whole thing.
|
|
26
|
+
>
|
|
27
|
+
> The backend boots as a **real app**, not a stub: working **JWT auth** (`register` / `login` / `me`) and an example **CRUD** resource, all built on zero-dep `@lacspace/*` packages — passwords via `@lacspace/password`, tokens via `@lacspace/jwt`, request validation via `@lacspace/validate`, typed env via `@lacspace/env`, auth rate-limiting via `@lacspace/rate-limit`, and a **Redis cache that's optional** (no `REDIS_URL`? it falls back to an in-memory cache via `@lacspace/cache`, so it runs with zero infra). The frontend ships a typed API client + `/login`, `/register` and a protected `/account` page already wired to it. Every generated file carries `// how this works` teaching comments. **The static scaffold is byte-for-byte unchanged**, and the CLI stays **zero runtime dependencies** (all backend deps land in the *generated* app).
|
|
28
|
+
|
|
29
|
+
> **New in v2.3 — composable feature add-ons + flagship AI.** Layer optional, self-contained add-ons onto *any* template with `--with <a,b>` (or pick them in the interactive prompt, or `add` them later). Two ship today — both **free, keyless and local by default** (Ollama, no API key):
|
|
30
|
+
> - **`ai-chat`** — a streaming AI chat route (`/api/chat`) + a clean chat UI (`/chat`), guarded against prompt injection, built on the Lacspace AI Kit.
|
|
31
|
+
> - **`rag`** — "chat with your docs": index your markdown/text (`npm run rag:index`), then ask grounded, source-cited questions at `/ask`.
|
|
32
|
+
>
|
|
33
|
+
> Everything stays **strictly additive** — a scaffold with no features is byte-for-byte the same as before, and the CLI remains **zero runtime dependencies**.
|
|
34
|
+
|
|
21
35
|
> **New in v2.1 — a design-quality pass.** Every template was rebuilt around a real design system: cohesive tokens (`--accent`, surfaces, hairlines, shadows), reusable utilities (`.glass`, `.card`, `.gradient-text`, `.grid-bg`/`.dot-bg`, `.shimmer`), a sticky glass header that shrinks on scroll, a richer multi-column footer with a newsletter island, a soft gradient-mesh backdrop, and confident, specific copy per template — all `prefers-reduced-motion`-aware. The signature sites ship as **LSFolio · LSStudio · LSStore · LSCloud · LSBlogs · LSDocs · LSAdmin · LSResto · LSBazaar**.
|
|
22
36
|
|
|
23
37
|
---
|
|
@@ -81,6 +95,44 @@ import { PricingSection } from "@/components/sections/pricing";
|
|
|
81
95
|
|
|
82
96
|
**Available sections:** `hero` · `features` · `pricing` · `faq` · `testimonials` · `team` · `stats` · `timeline` · `gallery` · `logos` · `cta` · `bento` · `steps` · `feature-split` · `banner`. Run `add` with no arguments to list them.
|
|
83
97
|
|
|
98
|
+
`add` also accepts a **feature add-on** key (below) — it drops the feature's files into your project (skipping any that already exist) and prints the exact deps, env vars and next-steps to wire up:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npx create-lacspace-app add ai-chat # drops app/api/chat/route.ts + app/chat/page.tsx
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## 🤖 Feature add-ons — `--with`
|
|
105
|
+
|
|
106
|
+
Feature add-ons are optional, self-contained bundles you can layer onto **any** template: they contribute their own files (namespaced under their own routes), dependencies, `package.json` scripts, `.env.example` entries and an onboarding checklist (`LEARN.md`). They **compose** (order-independent, no collisions) and are **strictly additive** — leave them off and you get today's scaffold, unchanged.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# scaffold with one or both, free & keyless (local Ollama by default)
|
|
110
|
+
npx create-lacspace-app my-app --template saas --with ai-chat
|
|
111
|
+
npx create-lacspace-app my-app --template saas --with ai-chat,rag # (alias: --features)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
In the interactive flow, after you pick a template you're offered the same list as a numbered picker — enter comma-separated numbers, or press Enter for none. (Non-TTY or `--yes` → uses your flags/defaults, no prompt.)
|
|
115
|
+
|
|
116
|
+
| Feature | What it adds | Packages (keyless) |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| **`ai-chat`** | A streaming chat route `app/api/chat/route.ts` + a chat UI `app/chat/page.tsx`. Reads provider config from env, runs input through a prompt-injection guard, and streams the reply. | `@lacspace/ai` `@lacspace/prompt` `@lacspace/stream` `@lacspace/providers` `@lacspace/memory` `@lacspace/moderation` |
|
|
119
|
+
| **`rag`** | "Chat with your docs": `content/welcome.md`, an indexer `scripts/index-content.mjs` (+ `rag:index` script), a retrieval+rerank answer route `app/api/ask/route.ts`, and an ask UI `app/ask/page.tsx`. | `@lacspace/rag` `@lacspace/embeddings` `@lacspace/vector` `@lacspace/chunk` `@lacspace/rerank` `@lacspace/providers` `@lacspace/ai` |
|
|
120
|
+
|
|
121
|
+
### 🆓 Free & local by default — no API key
|
|
122
|
+
|
|
123
|
+
Both AI add-ons default to **[Ollama](https://ollama.com)**, so they run **entirely on your machine — free, offline and keyless**. One-time setup:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# ai-chat
|
|
127
|
+
ollama pull llama3.2 && npm run dev # then open /chat
|
|
128
|
+
|
|
129
|
+
# rag (adds an embedding model)
|
|
130
|
+
ollama pull nomic-embed-text && ollama pull llama3.2
|
|
131
|
+
npm run rag:index && npm run dev # then open /ask
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Prefer a hosted model? Set `LACSPACE_AI_*` in `.env` (e.g. `LACSPACE_AI_PROVIDER=groq` + `LACSPACE_AI_API_KEY=…`) — the same code path works against any OpenAI-compatible provider. The generated `LEARN.md` walks you through every step.
|
|
135
|
+
|
|
84
136
|
## Templates
|
|
85
137
|
|
|
86
138
|
| Key | Ships as | What you get |
|
|
@@ -102,6 +154,7 @@ Every template is Next.js 15 App Router + React 19 + Tailwind v4 — dark, moder
|
|
|
102
154
|
| Flag | Meaning |
|
|
103
155
|
| --- | --- |
|
|
104
156
|
| `-t, --template <key>` | `personal` · `business` · `ecommerce` · `saas` · `blog` · `docs` · `dashboard` · `restaurant` · `marketplace` |
|
|
157
|
+
| `--with <a,b>` | feature add-ons, comma-separated — `ai-chat` · `rag` (alias `--features`) |
|
|
105
158
|
| `--theme <name\|hex>` | accent gradient — a preset, a `"#hex"`, or `"from,to"` (see below) |
|
|
106
159
|
| `--pm <npm\|pnpm\|yarn\|bun>` | package manager (default `npm`) |
|
|
107
160
|
| `--no-install` | skip installing dependencies |
|
|
@@ -130,10 +183,15 @@ import {
|
|
|
130
183
|
scaffold, // Node: writes a project to disk
|
|
131
184
|
listTemplates, // the 9 templates + their metadata
|
|
132
185
|
listSections, // the 15 prebuilt sections
|
|
186
|
+
listFeatures, // the composable feature add-ons (ai-chat, rag)
|
|
133
187
|
} from "create-lacspace-app";
|
|
134
188
|
|
|
135
189
|
// 1. Pure — get the whole project as { "path": "contents" }. Runs anywhere.
|
|
136
190
|
const files = generateProject({ name: "acme", template: "saas", theme: "#ff6a00" });
|
|
191
|
+
|
|
192
|
+
// Layer feature add-ons on — strictly additive, order-independent.
|
|
193
|
+
const ai = generateProject({ name: "acme", template: "saas", features: ["ai-chat", "rag"] });
|
|
194
|
+
ai["app/api/chat/route.ts"]; // → the streaming chat route source
|
|
137
195
|
files["app/page.tsx"]; // → the generated home page source
|
|
138
196
|
Object.keys(files).length; // → ~70 files
|
|
139
197
|
|
|
@@ -151,9 +209,10 @@ console.log(`Scaffolded ${written.length} files → ${dir}`);
|
|
|
151
209
|
| `listTemplates()` / `templates` | The built-in templates with metadata (`key`, `label`, `description`, `accent`, defaults). |
|
|
152
210
|
| `getTemplate(key)` | One template's metadata, or `undefined`. |
|
|
153
211
|
| `listSections()` / `getSection(name)` | The prebuilt section names, and one section's source. |
|
|
212
|
+
| `listFeatures()` / `getFeature(key)` | The composable feature add-ons (`FeatureDef[]`), and one feature's definition. |
|
|
154
213
|
| `templateKeys` | Every valid `template` key. |
|
|
155
214
|
|
|
156
|
-
`options`: `{ name?, template?, theme? }` — the same choices as the CLI flags above.
|
|
215
|
+
`options`: `{ name?, template?, theme?, features? }` — the same choices as the CLI flags above (`features` mirrors `--with`; unknown keys are ignored, duplicates de-duped).
|
|
157
216
|
|
|
158
217
|
## ❓ FAQ
|
|
159
218
|
|