JianWei-0510 / gitpost

使用 Github REST API 串接,將此專案的 issues 作為文章
https://gitpost.up.railway.app
0 stars 0 forks source link

Opengraph Image Demo (The site may crush due to deployment service or database sleeping, if you encounter any problem in demo website, feel free to contact me)

Introduction

This Dcard 2024 Frontend Intern Homework, whose goal is to connect with GitHub OAuth API to implement login, and user can create open issue as their blog post, close issue as deleting post. Author can "read", "create", "edit", "delete" their post and comment, and others can only "read" post and comment.

Tack Stack

Getting Started

First, set environment variable:

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

SECRET_KEY=

TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=

BASE_URL=

Second, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

How It Works

flowchart LR
    lp[Landing Page] --> haveLogin{Login with
     GitHub?}
    haveLogin -- yes --> haveRepo{Have a repository as blog?}
    haveLogin -- no --> login[Request
    user login] --> haveRepo{Have a repository
    as blog?}
    haveRepo -- yes --> userPage["User Page /[username]"]
    haveRepo -- no --> chooseRepo[Request user choose a
existing repository as blog] --> userPage

Route

The following routes have layout which contains a sidebar (or header for small screen size) to let user create post, redirect to their blog page, or logout