{"id":13479130,"url":"https://github.com/pavlovtech/NextBlog","last_synced_at":"2025-03-27T09:30:55.328Z","repository":{"id":166934689,"uuid":"639198081","full_name":"pavlovtech/NextBlog","owner":"pavlovtech","description":"Blog built with NextJs 13, Contentlayer, Giscus and NextAuth. It uses Github API for admin section that allows managing markdown files rendered with Codemirror.","archived":false,"fork":false,"pushed_at":"2024-01-08T16:53:54.000Z","size":18144,"stargazers_count":54,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-01T16:55:39.481Z","etag":null,"topics":["contentlayer","markdown","nextjs"],"latest_commit_sha":null,"homepage":"https://alexpavlov.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pavlovtech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-05-11T01:17:33.000Z","updated_at":"2024-06-04T08:41:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"3e6f5ecc-64f9-47fc-aa1d-58d5c1373470","html_url":"https://github.com/pavlovtech/NextBlog","commit_stats":null,"previous_names":["pavlovtech/nextblog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavlovtech%2FNextBlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavlovtech%2FNextBlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavlovtech%2FNextBlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavlovtech%2FNextBlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pavlovtech","download_url":"https://codeload.github.com/pavlovtech/NextBlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222222214,"owners_count":16951400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contentlayer","markdown","nextjs"],"created_at":"2024-07-31T16:02:10.066Z","updated_at":"2024-10-30T12:31:40.874Z","avatar_url":"https://github.com/pavlovtech.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\n# NextBlog\n\nMy personal blog built with NextJs 13, Contentlayer, Giscus and NextAuth. It uses Github API for admin section that allows managing markdown files rendered with Codemirror.\n\nDesign is based on https://github.com/pycoder2000/blog\n\n## Demo\n\nDemo: [alexpavlov.dev](https://alexpavlov.dev)\n\n# Motivation\n\nI wanted to build a blog based on markdown files with latest NextJS 13 with server components and host it on Vercel. Additionally, I needed a CMS functionality (CRUD for markdown files), but how do you create a CMS for statically generated web site when content stored only as static files inside the Github repository?\n\nThe idea is simple:\n\n1. Add an admin page with auth using NextAuth\n2. Use Vercel hosting with github integration for CI/CD\n3. Create an API using Github API for managing blog posts\n4. When the change to blog post files is made, it is pushed to github.\n5. Then Vercel automatically starts a new deployment\n6. Web site displayes updated statically generated content\n\nCurrently, the best solution for managing markdown files is [Contentlayer](https://www.contentlayer.dev/), so I wanted to use it as well.\n\nFor the lack of existing blog starters that with the mentioned functionality I desided to create it myself.\n\n## Architecture\n\n![image](https://github.com/pavlovtech/NextBlog/assets/6662454/9041cf18-535e-40e9-bc64-ee1430e411b0)\n\n### Home page\n\n![image](https://github.com/pavlovtech/NextBlog/assets/6662454/6207daa6-4c75-4180-8365-71b75360afe4)\n\n## 📚 Tech Stack\n\n| Name            | Link                                                      |\n| --------------- | --------------------------------------------------------- |\n| Framework       | [NextJS](https://nextjs.org/docs)                         |\n| Markdown        | [Contentlayer](https://www.contentlayer.dev/)             |\n| Authentication  | [NextAuth](https://next-auth.js.org/)                     |\n| Deployment      | [Vercel](https://vercel.com)                              |\n| Styling         | [Tailwindcss](https://tailwindcss.com/)                   |\n| Comments        | [Giscus](https://github.com/giscus/giscus)                |\n| Data access     | GitHub API                                                |\n| Markdown editor | [Codemirror](https://codemirror.net/)                     |\n\n\n## 🪜 Project structure\n\n```bash\n📦 root\n├── 🗂️ app                     # NextJs 13 app router directory\n│ ├── 🗂️ admin                 # Admin functionality for creating and editing blog posts\n│ ├── 🗂️ api                   # CRUD api blog posts (Github API is used)\n│ └── 🗂️ blog                  # Blog functionality\n│ └── 🗂️ components            # Blog UI components\n├── 🗂️ configs                 # Configs\n├── 🗂️ lib                     # Utilities\n├── 🗂️ posts                   # Blog posts in markdown\n├── 🗂️ public                  # Static files for images\n├── 🗂️ styles                  # CSS\n├── 📝 contentlayer.config.ts  # Contentlayer config\n└── 📝 next.config.js          # configuration related to Next.js\n```\n\n## Google Lighthouse performance statistics\n\n![image](https://github.com/pavlovtech/NextBlog/assets/6662454/9681f814-3b35-4ceb-9085-71e9fc46bbdb)\n\n## Admin page\n\n![image](https://github.com/pavlovtech/NextBlog/assets/6662454/d55dff86-f097-488b-8611-ee2c659cd3f5)\n\n## Admin page - editing\n\n![image](https://github.com/pavlovtech/NextBlog/assets/6662454/5452382f-7605-44b8-b80b-a55090f5c16b)\n\n\n## Environment Variables\n\nTo run this project, you will need to add the following environment variables to your .env file. They are needed for admin panel for editing your markdown files.\n\n```yaml\nGITHUB_TOKEN = token with access to the content of your blog's repository\nNEXTAUTH_SECRET = any secret \nNEXTAUTH_URL= your site's url\nADMIN_EMAIL = your email\nADMIN_PASSWORD= your password\n```\n## Features\n\n- Static content generation based on markdown files (./posts folder)\n- Comments with Giscus\n- Code hightlighting\n- Automatic table of content generation\n- Admin panel that works via Github API\n- Mobile-friendly view\n- Projects page\n- Frontmatter support\n\n\n## Quick Start Guide\n\n`npm i`\n\n`npm run dev`\n\n## TODO\n\n1. Image upload\n2. Draft support","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavlovtech%2FNextBlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpavlovtech%2FNextBlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavlovtech%2FNextBlog/lists"}