blog-system-ui
v0.1.12
Published
Blog UI copier (shadcn-style) with features, admin, Supabase hooks.
Maintainers
Readme
blog-system-ui
Shadcn-style copyable blog system (public blog + admin) for Next.js 13+ (App Router). You install the package, run one CLI command, and the full source (features, components, routes, styles, Supabase hooks) is copied into your own src/ so you fully own and customize it.
Single command workflow:
npx blog-system-ui init
Table of Contents
- Overview
- Features
- Quick Start
- Installation & Copy
- Directory Structure
- Environment Variables
- TypeScript Setup
- Styling & Tailwind
- Supabase Setup
- Using the CLI
- Customization Tips
- Updating the Package
- Troubleshooting
- FAQ
- License
Overview
Traditional component packages lock you into a black-box node_modules API. This package instead ships raw source code (like shadcn/ui): copy once, own forever. After running the CLI you can refactor, delete, rename, theme, or gradually merge pieces into an existing codebase.
Core ideas:
- Modern-only layout – Everything lives under
src/in the package (no legacy fallback). - No runtime coupling – You can uninstall the package after copying; your app keeps working.
- Supabase-ready – Hooks and service files assume a Supabase project with the provided schema.
- Composable features – Blog, posts, tags, categories, comments, admin dashboard, auth scaffolding.
Features
- Public Blog UI: Post list, featured list, detail page, related & recent logic, navigation, layout.
- Admin Dashboard: Post CRUD (create, delete, mark featured, image upload), categories, tags, comment hooks (with placeholder pages), simple metrics charts, user placeholders.
- Authentication Scaffolding:
LoginForm,ProtectedRoute, login hooks (you wire actual auth/redirect logic). - Data Layer (Supabase + TanStack Query): Hooks for posts, single post, related, recent, tags, categories, comments; mutation hooks with optimistic refresh patterns where appropriate.
- Form Handling:
react-hook-form+zodpatterns you can extend. - UI Building Blocks: Modal, Table, Sidebar, Menus, PopupConfirm, InputField, Loading, Empty, ComingSoon, layout components.
- Image Support: Remote pattern pre-configured for Supabase Storage bucket
blog-images. - Styling: Tailwind v4 tokens + utilities in
index.css(orsrc/app/index.css), merge-friendly theme approach. - Developer Experience: Single
initcommand, clear separation between features and components.
Quick Start
npm install blog-system-ui
npx blog-system-ui init
# start your dev server
npm run devOpen src/app/(root)/blog and /admin pages in your browser.
Installation & Copy
- Install the package (
npm install blog-system-ui). - Run
npx blog-system-ui init(ornode node_modules/blog-system-ui/bin/cli.mjs initif npx cannot resolve). - The CLI copies:
src/features/*src/components/*src/lib/*src/app/*(example routes/layouts/styles)public/*(images)index.css→src/index.cssif present (or keep usingsrc/app/index.cssdepending on version)
- Import Query Provider in your root layout and you're ready.
After copying you may uninstall the package if desired.
Directory Structure
After init you will have (simplified):
src/
app/
(auth)/login/page.jsx
(root)/layout.jsx
(root)/blog/page.jsx
(root)/blog/[blogId]/page.jsx
(dashboard)/admin/... (posts, categories, tags, comments, users)
layout.jsx (root html/body + QueryProvider)
index.css (theme + tailwind directives if shipped)
components/
NavBar.jsx, Modal.jsx, Table.jsx, etc.
features/
blog/ (BlogPostList, BlogDetailPage, hooks...)
admin/ (HomePage, charts, posts list...)
categories/
tags/
comment/
services/ (Supabase APIs, authApi, postApi, etc.)
users/
lib/
config.js, utils.js
index.css (optional root theme if provided separately)
public/
600x400.svg
admin-hero.jpgEnvironment Variables
Create .env.local:
NEXT_PUBLIC_SUPABASE_URL_ENDPOINT=https://YOUR-PROJECT.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_PUBLIC_ANON_KEYOptional (server-only privileged ops):
SUPABASE_SERVICE_ROLE_KEY=YOUR_SERVICE_ROLE_KEY # NEVER expose to client codeTypeScript Setup
If you use TS but the copied files are .js/.jsx, enable JS:
{
"compilerOptions": {
"allowJs": true,
"jsx": "react-jsx",
"baseUrl": ".",
"paths": { "@/*": ["src/*"] }
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
"exclude": ["node_modules"]
}NOTE: The
includearray MUST list both**/*.jsand**/*.jsx(alongside*.ts/*.tsx) or TypeScript will ignore the copied JavaScript source and you will see unresolved import / missing declaration errors. SettingallowJs: truealone is not enough—files still have to match theincludeglobs.
Update imports to use the alias, e.g. import BlogPostList from '@/features/blog/BlogPostList'.
Styling & Tailwind
Two approaches:
- Keep Provided Styles – Use the copied
src/app/index.css(orsrc/index.css). Import it insrc/app/layout.jsx. - Merge Into Existing – Copy the design tokens and
@tailwinddirectives into your existing global CSS.
Tailwind (with PostCSS) base content:
@tailwind base;
@tailwind components;
@tailwind utilities;Avoid import 'tailwindcss' in CSS when using PostCSS.
Supabase Setup
- Create a Supabase project (you can name it
blog). - Create a Storage bucket named
blog-images. - Run the schema from the repo's
sql/folder (enablepgcryptoif required for UUIDs). - Set RLS policies to allow public reads for published posts & active taxonomy; restrict writes to authenticated users or roles.
- Use the anon key on the client; service role key only in server code (API routes, server actions, or route handlers).
Supabase Client Separation (recommended):
supabaseClient(public) usesNEXT_PUBLIC_SUPABASE_*vars.supabaseAdmin(server) usesSUPABASE_SERVICE_ROLE_KEY(never imported in client components).
Using the CLI
Command:
npx blog-system-ui initFlags:
--dryShow what would copy without writing.--forceOverwrite existing files.
Example dry run:
npx blog-system-ui init --dryCustomization Tips
- Rename Folders: e.g. move
features/blogtomodules/blog; update imports with a project-wide search. - Swap Auth: Replace
LoginFormandProtectedRoutewith your own provider (Clerk/Auth.js/etc.). - Change Theme: Edit
index.css– update color variables, spacing scale, or typography. - Disable Features: Delete entire feature folders (e.g.,
comment/) and remove linked routes. - APIs: Point service files (
postApi,categoriesApi, etc.) to your own backend instead of Supabase.
Updating the Package
Since you own a local copy, updates are manual. To see what changed in a new release:
- Install the new version in a temporary folder.
- Run
npx blog-system-ui init --dryto see structure. - Diff the new
src/features/...against your local modifications and cherry-pick changes.
Troubleshooting
| Problem | Cause | Fix |
| ----------------------------- | -------------------------------- | ------------------------------------------------------------------- |
| supabaseKey is required | Missing env vars | Verify .env.local names & restart dev server |
| 404 on / | No app/page.jsx | Create a root page or redirect from / |
| Tailwind classes not applied | CSS not imported | Import index.css or your merged global file in root layout |
| Images blocked | Missing remote pattern | Ensure next.config.mjs sets Supabase storage hostname |
| CLI copies nothing | Package installed without src/ | Reinstall latest; confirm npm pack --dry-run lists src/features |
| Alias resolves to @/src/... | Wrong paths config | Set paths: { "@/*": ["src/*"] } |
FAQ
Can I remove the package after copying? Yes—after init all code is local.
Does this include database migrations? A schema SQL file is provided; apply it manually in Supabase.
Why a single CLI command? Simplicity. You can fork & extend if you prefer granular copy commands.
Will you publish React Server Components? Client components dominate here due to React Query/stateful interactions. You can refactor pieces to server components if needed.
Is there TypeScript support? Source is JS; enable allowJs or progressively migrate files to .ts/.tsx.
License
MIT. Use freely; attribution appreciated but not required.
Happy building! If you add cool extensions (theme packs, adapter for another backend, etc.), consider sharing them.
