This is an extremely simple blogging platform I made for the argentinian magazine Reflexión en Música. It's A Next.Js blog with a password-protected dashboard where a blog owner can either upload an .md file, or write in a built in editor to create a new post. When a post is added or removed from the dashboard, an on-demand revalidation is triggered. The authentication is handled by next-auth. The front end has a dark theme I really like, it's done with the useTheme hook. The .md to html parse is made with remark, footnotes with remark-gfm and image captions with remark-captions. To try out a basic version of the dashboard, you can visit a live demo here. Thanks for reading!!!
-
Clone repo.
-
npm install
packages. -
Define .env variables:
-
Create an .env.local file, and replace "value" with your own values (mind "value_1" and "value_2" must match):
MONGODB_URI=value
MONGODB_DB=value
MONGODB_COLLECTION=valueNEXT_PUBLIC_SAVE_TOKEN=value_1
SAVE_TOKEN=value_1UPLOAD_PASSWORD=value_2
LOGIN_PASSWORD=value_2
NEXTAUTH_SECRET=value_2
REVALIDATE_TOKEN=value
USER_TOKEN=valueNEXT_PUBLIC_BASE_URL=http://localhost:3000/api
NEXTAUTH_URL=http://localhost:3000
BASE_URL=http://localhost:3000
NEXT_PUBLIC_URL=http://localhost:3000
-
-
Open /lib/data-template.js, add your own values and change file name to
data.js
. -
npm run dev
to run locally in dev mode, ornpm run build
andnpm start
to run a production build locally.