npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lastbrain/module-blog

v0.1.3

Published

> @lastbrain/module-blog

Readme

📦 Module Blog - LastBrain

@lastbrain/module-blog

Module réutilisable pour gérer différents types de contenus publics : blog, FAQ, aide, documentation et tutoriels.

🎯 Objectifs

Ce module permet de créer et gérer du contenu pour plusieurs types de pages publiques, compatible avec toutes les applications du monorepo LastBrain grâce au système de app_scope.

📋 Types de contenu supportés

  • Blog : Articles de blog classiques
  • FAQ : Questions fréquentes
  • Help : Pages d'aide et support
  • Docs : Documentation technique
  • Tutorial : Tutoriels et guides

🏗️ Architecture

Base de données

5 tables Supabase :

  1. content_category : Catégories de contenu
  2. content_post : Posts/Articles
  3. content_post_category : Table de liaison (many-to-many)
  4. content_post_stats : Statistiques (vues, likes)
  5. content_post_comment : Commentaires (optionnel)

Toutes les données sont multi-locales (FR/EN/ES) via des champs jsonb.

Sécurité (RLS)

  • Superadmin : Accès complet CRUD
  • Anon/Public : Lecture seule des contenus publiés
  • Authenticated : Peut créer des commentaires

📄 Pages Disponibles

Pages Publiques (SEO-friendly)

  • GET /blog - Hub Blog (liste catégories + derniers posts)
  • GET /faq - Hub FAQ
  • GET /help - Hub Aide
  • GET /docs - Hub Documentation
  • GET /tutorial - Hub Tutoriels

Pages dynamiques :

  • /[type]/c/[categorySlug] - Posts d'une catégorie
  • /[type]/[postSlug] - Détail d'un post

Toutes les pages incluent :

  • React Server Components
  • generateMetadata() pour le SEO
  • JSON-LD (BlogPosting, Article, BreadcrumbList)
  • Navigation précédent/suivant
  • Suggestions de posts similaires

Pages Admin (authentifiées)

  • GET /admin/categories - CRUD catégories
  • GET /admin/posts - CRUD posts avec traduction auto
  • GET /admin/stats - Statistiques (vues, likes)
  • GET /admin/comments - Modération commentaires
  • GET /admin/settings - Paramètres

🔌 API Routes

Publiques (anon)

/api/public/content_category

  • GET - Liste catégories actives

/api/public/content_post

  • GET - Liste posts publiés
  • POST - Incrémenter vues

Admin (authentifiées)

/api/admin/content_category

  • GET/POST/PUT/DELETE - CRUD catégories

/api/admin/content_post

  • GET/POST/PUT/DELETE - CRUD posts

/api/admin/translate

  • POST - Traduction automatique via module-ai

🚀 Utilisation

Installation

Le module est automatiquement disponible dans le monorepo :

pnpm install

Intégration dans une app

1. Page hub (liste)

// app/blog/page.tsx
import { TypeHubPage, generateTypeHubMetadata } from "@lastbrain/module-blog";

export async function generateMetadata() {
  return await generateTypeHubMetadata("blog", "fr");
}

export default function BlogPage() {
  return (
    <TypeHubPage
      type="blog"
      appScope="tools"
      lang="fr"
      baseUrl="/blog"
    />
  );
}

2. Page catégorie

// app/blog/c/[slug]/page.tsx
import { CategoryPage, generateCategoryMetadata } from "@lastbrain/module-blog";

export async function generateMetadata({ params }) {
  return await generateCategoryMetadata("blog", "tools", params.slug, "fr");
}

export default function BlogCategoryPage({ params }) {
  return (
    <CategoryPage
      type="blog"
      appScope="tools"
      categorySlug={params.slug}
      lang="fr"
      baseUrl="/blog"
    />
  );
}

3. Page post

// app/blog/[slug]/page.tsx
import { PostPage, generatePostMetadata } from "@lastbrain/module-blog";

export async function generateMetadata({ params }) {
  return await generatePostMetadata("blog", "tools", params.slug, "fr");
}

export default function BlogPostPage({ params }) {
  return (
    <PostPage
      type="blog"
      appScope="tools"
      postSlug={params.slug}
      lang="fr"
      baseUrl="/blog"
    />
  );
}

🌍 Multi-langue

Tous les champs texte sont stockés en JSONB :

{
  title: {
    fr: "Mon article",
    en: "My article",
    es: "Mi artículo"
  }
}

Utilisez les boutons Auto EN et Auto ES dans l'admin pour la traduction automatique.

🗄️ Base de Données

Tables

  • content_category : Catégories
  • content_post : Posts/Articles
  • content_post_category : Liaison posts-catégories
  • content_post_stats : Statistiques
  • content_post_comment : Commentaires

Migrations

  • 20260126085702_module-blog_init.sql
  • 20260126120000_blog_complete_structure.sql

Pour synchroniser :

pnpm db:sync-migrations

🎨 Composants réutilisables

import {
  CategoryCard,
  PostCard,
  MarkdownRenderer,
  PostNavigation,
  buildSEOMetadata,
  buildBlogPostingJSONLD,
  buildBreadcrumbJSONLD,
} from "@lastbrain/module-blog";

📝 TODO

  • [ ] Intégration complète module-ai pour traduction
  • [ ] Parser Markdown avancé (marked, remark)
  • [ ] Système de likes
  • [ ] Modération commentaires
  • [ ] Pages de statistiques
  • [ ] Recherche full-text
  • [ ] Pagination
  • [ ] Upload images (storage)

📦 Installation

pnpm lastbrain add-module blog
pnpm build:modules

Appliquer les migrations

cd apps/votre-app
supabase migration up

💡 Utilisation

Exemple d'utilisation

// Importez les composants depuis le module
import { BlogPage } from "@lastbrain/module-blog";

// Utilisez-les dans votre application
<BlogPage />;

Configuration

⚠️ Danger Zone

La suppression du module supprimera toutes les pages, routes API et migrations associées. Cette action est irréversible.

pnpm lastbrain remove-module blog
pnpm build:modules