Turn your GitHub repo into a beautiful blog in literally 3 lines of code.
Yeah. Three lines. Watch:
import { renderMadeaBlog, renderPage } from 'madea-blog-core';
export default async function Page() {
const config = createConfig('your-github-username');
const result = await renderMadeaBlog(config, '/');
return renderPage(result);
}That's it. You now have a blog that reads markdown files directly from your GitHub repo. No build step. No static generation. Just pure, simple, GitHub-powered blogging.
Because setting up a blog shouldn't require a PhD in web development. You already write markdown. You already use GitHub. Why not just... use them?
madea-blog-core is a tiny, type-safe library that:
- Fetches markdown files from your GitHub repo
- Renders them beautifully with syntax highlighting
- Handles metadata, SEO, and all that boring stuff
- Provides flexibility for custom styling and components
- Works with Next.js 14+ and React 18+
Here's a slightly more realistic example:
import { renderMadeaBlog, renderPage, GitHubDataProvider } from 'madea-blog-core';
import { MarkdownView } from './components/markdown-view';
import { FileBrowser } from './components/file-browser';
export default async function Page() {
const config = {
username: 'your-github-username',
dataProvider: new GitHubDataProvider({
username: 'your-github-username',
repo: 'your-blog-repo',
token: process.env.GITHUB_TOKEN,
}),
articleView: MarkdownView, // Your custom article component
fileBrowserView: FileBrowser, // Your custom file browser
};
const result = await renderMadeaBlog(config, '/');
return renderPage(result);
}That's still like 15 lines. And you get:
- Full control over how articles render
- Automatic file listing and navigation
- Git commit metadata for publish dates
- Article excerpts for previews
- Type-safe everything
renderMadeaBlog()- Main rendering functionrenderPage()- Converts render result to React componentsgenerateMetadata()- Next.js metadata generation- Utilities for extracting titles, descriptions, etc.
- GitHubDataProvider - Fetches from GitHub (with smart caching)
- LocalFsDataProvider - Local filesystem for development
Bring your own components or use the defaults:
ArticleView- How individual articles renderFileBrowserView- How the file list displaysNoRepoFoundView- Error statesLandingView- Landing page for multi-tenant setups
pnpm add madea-blog-core
# or
npm install madea-blog-core- Create a GitHub repo with some markdown files
- Get a GitHub token (Settings > Developer settings > Personal access tokens)
- Add to your Next.js app:
// app/page.tsx
import { renderMadeaBlog, renderPage, GitHubDataProvider } from 'madea-blog-core';
const config = {
username: 'yourusername',
dataProvider: new GitHubDataProvider({
username: 'yourusername',
repo: 'blog',
token: process.env.GITHUB_TOKEN,
}),
};
export default async function Page() {
const result = await renderMadeaBlog(config, '/');
return renderPage(result);
}- Set
GITHUB_TOKENin your.env.local - Run
pnpm dev - Write markdown in your repo, push, refresh. Done.
This is a monorepo with:
- packages/madea-blog-core - The core library
- apps/madea-blog-consumer - Example multi-tenant blog platform
- apps/blog.pond.audio - Real-world example
- apps/golf-blog - Another real-world example
Check the apps/ directory for complete working examples.
- Server Components first (Next.js 14+)
- Smart caching with configurable revalidation
- GitHub Flavored Markdown support
- Syntax highlighting
- Automatic SEO metadata
- RSS/Sitemap generation helpers
- TypeScript all the way down
- Dependency injection for full control
Want to test locally before pushing to GitHub?
import { LocalFsDataProvider } from 'madea-blog-core/providers/local-fs';
const config = {
username: 'local',
dataProvider: new LocalFsDataProvider({
contentDir: './blog-posts',
authorName: 'Your Name',
}),
};Write markdown files in ./blog-posts, and they'll render instantly. No git required.
Check out the working examples in this repo:
apps/madea-blog-consumer- Full-featured multi-tenant platformapps/blog.pond.audio- Personal blog blog exampleapps/golf-blog- Code-golfed madea.blog
MIT