Astro Hackathon Showcase

Poko Astro-Notion

# Digital garden
# Learn in Public

tl;dr

Astro + Notion + MDX = ❤️

If you are a human:

If you are a developer:

git clone https://github.com/m4rrc0/poko-notion.git
cd poko-notion
npm install

Rename or copy .env.dist file in .env and paste your API key as the NOTION_TOKEN and optionnaly the ID of the Notion page that is the root of your web project as NOTION_ROOT_ID.

Then the magic should operate with

npm run dev

If you are a writer:

Setup the project once

  1. Create free accounts: Github, Notion, A static host (see list bellow)
  2. Connect accounts as explained on the website

Publish content (as much as possible 😉)

  1. Write in Notion
  2. Hit ‘Publish’
  3. Share your brand new digital home! 🚀

Intro

This is an alpha release. I you like the idea, please share your thoughts to encourage our work.

This is a starter template for Astro.
Its goal is to make it unbearably easy to publish content on the web.
Its primary target user is ‘The Tech Savvy Writer’. It is making use of Notion as its CMS; Just write in Notion, click ‘Publish’ and 30 seconds later your site is online.
If you want extra functionnality you can even directly write MDX in Notion.

Why Astro

To me, Astro is one of the most exciting tech being built in the world of front-end web development. It is a complicated tool aimed at making things easy and performant for the end user (the developer in this case). It builds zero-JS websites by default with smart enhancement.

Why ‘Poko’

Poko is a project of the Supertera collective.

Supertera is:

An overground movement of independant minds aiming for collective growth through individual emancipation and shared knowledge.

‘Growth’ is defined as ‘becoming better and better humans’ and opposed to the traditionnal concept of ‘making profit’ above all.

Poko is meant to be an answer to ‘yes, I’d like to [write a blog] [publish my digital garden] [share what I am working on] […] but I need to create a website first…‘.
No more excuses. Be the master of your faith. Write, write, write and publish your content on your own terms.

As to why really the name ‘Poko’… That is a secret. Maybe if you go on reading you’ll find out…

Why Notion

It is free. It is easy. It is popular. It is more powerful than a cloud document. It is less complicated than a classic headless CMS. It has an (sometimes shity) API.
The goal is one day to support more sources, especialy more FOSS software. The front-end API would stay the same (somewhat opiniated) structure to allow easily building on that side too (components, themes, …).

‘Everything in the CMS’

Users do not write code.
For a lambda user, the maximum effort is a copy/paste. The tech-savvy user will happily copy/paste to achieve something cool but most won’t dive into the code.

With the approach we are taking, components, themes, and even complex functionnality are all a copy/paste away from one notion page to another.

NOTE: It also means that you need to be careful of the code you copy/paste. If you don’t understand what you are putting onto your site, at least make sure it comes from a reputable source!

Why MDX

In the current example, we use MDX to render the content. It is not mandatory though.
For now, (as far as I know) MDX allows more freedom and functionnality than the native Astro <Markdown /> component. But we definitely look forward to using more of Astro!

NOTE: The Astro <Markdown /> component should work just fine for simple content without variables, custom components, …

NOTE 2: We also envision a ‘markdownless’ version where we use structured data all the way to the HTML composition without resorting to markdown at all.

Any static host

A few static hosting providers:

What next: short and long term goals in random order

🧞 Commands

All commands are run from the root of the project, from a terminal:

CommandAction
npm installInstalls dependencies
npm run devStarts local dev server at localhost:3000
npm run buildBuild your production site to ./dist/
npm run previewPreview your build locally, before deploying

Deep dive

Before Astro’s build even starts

Notes about ‘fetching ahead’

NOTE: this part is currently handled by a minimal Astro integration I called fetch-ahead. The only role of this integration is to execute an async function before the actual build begins.

The goals of using this could be:

TODO: There is a potential for improving developer experience tenfold by running this in parallel to the dev server to live reload on changes in Notion.

The front-end mainly consists of