This project showcases a demo blog site developed with GraphQL. We use GraphCMS as the backend platform to manage the content. This website focuses on a gallery view of the posts available in the CMS environment, and dynamically generates pages for each post.
Details | |
---|---|
Tutorial | Dev Ed - Blog Site with GraphQL |
Code | developedbyed - Digital Scribbles |
Details | |
---|---|
Version | v1 |
------------ | ------------ |
Demo | Vercel |
CMS | GraphCMS |
Frameworks | GraphQL, NextJs |
- Setup the GraphCMS environment.
- Create a new Model called
Post
. Add the following items to it's definition.- Single Line Text -
Title
- Slug -
Slug
- Rich Text -
Content
- Asset Picker -
Cover Image
- Date -
Date Published
- Relationship -
Two Way Reference - Author (Model)
- Single Line Text -
- Create a new Model called
Author
. Add the following items to it's definition.- Single Line Text -
Name
- Asset Picker -
Avatar
- Relationship -
Two Way Reference - Post (Model)
- Single Line Text -
- Add in some dummy data for both of the models, so that it later shows up in our front end.
- Create a new Model called
- Create a next-js app using
npx create-next-app@latest app-name
- Implement the front end with the following objectives:
- Fetch the entries from graph-cms using graphql
- Showcase them as a gallery view on the landing page
- Generate pages per post, where the content for each post can be displayed
- Test these changes in the local environment (
npm run dev
) - Deploy the project to vercel.
- Clone the repository to your local system.
- Set the current working directory as
blog-demo
and then run the following command:npm run dev
. This will deploy the project on the localhost.
- Here onwards, we can add a more comprehensive client experience for the site. Here are some ideas to include:
- Add in NavBars
- Add metric features like number of visits, upvotes and downvotes
- Add in the feature to comment on the post
- Add in the facility to share the post
- Add in the facility to search for specific posts, based on genres and other filters
- Add a facility to submit a post from the portal instead of the updating entries in cms platform.
- This entire project can be considered as a step to having a personal portfolio and blog site.