@infuro/cms-core 1.0.6 → 1.0.8

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 CHANGED
@@ -4,56 +4,40 @@ A headless CMS framework built on Next.js and TypeORM. It provides a ready-to-us
4
4
 
5
5
  ## Overview
6
6
 
7
- **What you need to set up a new site:**
7
+ You don't set up or clone core in each website. Install the published package and run the init command to scaffold a new site.
8
8
 
9
- - Next.js 14+ app with TypeScript and Tailwind
10
- - PostgreSQL and env vars: `DATABASE_URL`, `NEXTAUTH_SECRET`, `NEXTAUTH_URL`
11
- - A few files in your app: **data-source** (TypeORM), **auth-helpers**, **cms** (plugins), **API catch-all route**, **NextAuth route**, **admin layout + catch-all page**, **middleware**, **providers** (Session + Theme + Toaster)
12
- - Tailwind config that includes the package in `content` and extends theme (shadcn-style colors)
13
- - Optional: custom admin nav, custom CRUD configs, custom admin pages, plugins
9
+ **Typical workflow for a new site:**
14
10
 
15
- **Install from npm:**
11
+ 1. Create a Next.js app (TypeScript, Tailwind, App Router, `src` directory):
12
+ `npx create-next-app@latest my-site --typescript --tailwind --app --src-dir`
13
+ 2. From the project root, run:
14
+ `npx @infuro/cms-core init`
15
+ 3. Copy `.env.example` to `.env`, set `DATABASE_URL`, `NEXTAUTH_SECRET`, `NEXTAUTH_URL`, then run `npm run seed` (or migrations) and `npm run dev`.
16
16
 
17
- ```bash
18
- npm install @infuro/cms-core typeorm reflect-metadata bcryptjs next-auth next-themes sonner
19
- npm install -D @types/node
20
- ```
17
+ Init creates all required files (data-source, auth-helpers, cms, API routes, admin layout and page, middleware, providers, seed, migration runner, default theme, basic home and contact pages), and can patch `next.config`, `tailwind.config`, layout, and `package.json` and install dependencies. Use `--force` to overwrite existing files, `--dry-run` to see what would be created, `--no-deps` to skip npm install, `--no-patch-config` to skip config changes.
21
18
 
22
- For local development with the core package in a sibling folder:
19
+ **Manual setup (if you prefer not to use init):** Install from npm (`npm install @infuro/cms-core typeorm reflect-metadata bcryptjs next-auth next-themes sonner` and `npm install -D @types/node`), then follow the step-by-step setup below. For local development of core itself, use `"@infuro/cms-core": "file:../core"` in the site's package.json.
23
20
 
24
- ```json
25
- "@infuro/cms-core": "file:../core"
26
- ```
27
-
28
- Then follow the setup steps below.
29
-
30
- ## Architecture
21
+ ## Project structure (your site after setup)
31
22
 
32
23
  ```
33
- core/ # This package
34
- ├── src/
35
- │ ├── entities/ # TypeORM entities (User, Blog, Form, etc.)
36
- │ ├── api/ # API handlers (CRUD, auth, CMS-specific)
37
- │ ├── auth/ # NextAuth config, middleware, helpers
38
- │ ├── admin/ # Admin panel (layout, pages, page resolver)
39
- │ ├── plugins/ # Plugin system (email, storage, analytics, ERP, etc.)
40
- │ ├── components/ # Shared UI (shadcn/ui + Admin components)
41
- │ ├── hooks/ # React hooks (analytics, mobile, plugin)
42
- │ └── lib/ # Utilities (cn, etc.)
43
-
44
- your-website/ # Your Next.js app
24
+ your-website/
45
25
  ├── src/
46
26
  │ ├── app/
47
- │ │ ├── admin/ # 2 files: layout.tsx + [[...slug]]/page.tsx
27
+ │ │ ├── admin/ # layout.tsx + [[...slug]]/page.tsx
48
28
  │ │ └── api/
49
29
  │ │ ├── auth/ # NextAuth route
50
- │ │ └── [[...path]]/ # Single catch-all mounting core's API
30
+ │ │ └── [[...path]]/ # Catch-all for CMS API
51
31
  │ ├── lib/
52
- │ │ ├── data-source.ts # TypeORM DataSource init
53
- │ │ ├── auth-helpers.ts # Wire core auth to NextResponse
54
- │ │ └── cms.ts # CmsApp init with plugins
55
- │ ├── middleware.ts # Wire core middleware to Next.js
56
- │ └── ... # Your custom pages, components, etc.
32
+ │ │ ├── data-source.ts
33
+ │ │ ├── auth-helpers.ts
34
+ │ │ ├── cms.ts
35
+ ├── theme-registry.ts
36
+ └── seed.ts
37
+ │ ├── themes/ # Optional: default theme from init
38
+ │ ├── migrations/
39
+ │ ├── middleware.ts
40
+ │ └── ... # Your pages, components, etc.
57
41
  ```
58
42
 
59
43
  ## Getting Started
@@ -65,7 +49,7 @@ npx create-next-app@latest my-website --typescript --tailwind --app --src-dir
65
49
  cd my-website
66
50
  ```
67
51
 
68
- ### 2. Install core
52
+ ### 2. Install the package
69
53
 
70
54
  ```bash
71
55
  npm install @infuro/cms-core typeorm reflect-metadata bcryptjs next-auth next-themes sonner
@@ -346,7 +330,7 @@ export default async function AdminPage({ params }: { params: Promise<{ slug?: s
346
330
  }
347
331
  ```
348
332
 
349
- The admin at `/admin` is rendered by core (layout, sidebar, header, built-in pages). Pass `customNavSections` and `customCrudConfigs` to add your own sidebar links and CRUD list pages (see [Adding custom pages and admin nav](#adding-custom-pages-and-admin-nav)).
333
+ The admin at `/admin` is rendered by the package (layout, sidebar, header, built-in pages). Pass `customNavSections` and `customCrudConfigs` to add your own sidebar links and CRUD list pages (see [Adding custom pages and admin nav](#adding-custom-pages-and-admin-nav)).
350
334
 
351
335
  ### 10. Configure Tailwind
352
336
 
@@ -633,13 +617,13 @@ createCmsMiddleware({
633
617
 
634
618
  ## Tailwind Config
635
619
 
636
- Core's admin panel and UI components use shadcn/ui which requires CSS variable-based color mappings. Your `tailwind.config.js` needs these in `theme.extend.colors`:
620
+ The admin panel and UI components use shadcn/ui and require CSS variable-based color mappings. Your `tailwind.config.js` needs these in `theme.extend.colors`:
637
621
 
638
622
  ```js
639
623
  module.exports = {
640
624
  content: [
641
625
  "./src/**/*.{js,ts,jsx,tsx,mdx}",
642
- "../core/src/**/*.{js,ts,jsx,tsx}",
626
+ "./node_modules/@infuro/cms-core/dist/**/*.{js,cjs}",
643
627
  ],
644
628
  darkMode: "class",
645
629
  theme: {
@@ -679,7 +663,7 @@ module.exports = {
679
663
  };
680
664
  ```
681
665
 
682
- The CSS variables themselves are injected by core's AdminLayout at runtime. Your website's own CSS can also define them in `:root` if your public pages use shadcn/ui components.
666
+ The CSS variables are injected by the admin layout at runtime. Your website's own CSS can also define them in `:root` if your public pages use shadcn/ui components.
683
667
 
684
668
  ## Environment Variables
685
669