This project uses Vite + React for the frontend, Decap CMS for content management, and is configured to deploy the public site to GitHub Pages while handling authentication securely via Vercel Serverless Functions.
If you want to use this template, follow these exact steps to connect it to your own GitHub account and Vercel deployment.
- Click the Fork button at the top right of this repository to create a copy in your GitHub account.
- Clone your forked repository to your local machine:
git clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git cd YOUR_REPO_NAME npm install
You must point the configuration files to your new repository, otherwise, the code will try to save changes to the original author's repository.
-
Update Vite Base Path
Open
vite.config.jsand update the base path to match your new repository name:// Change "/academic-portfolio/" to your exact repository name base: process.env.GITHUB_ACTIONS ? "/YOUR_REPO_NAME/" : "/",
-
Update CMS Configuration
Open
public/admin/config.ymland update the following fields:backend: name: github // MUST CHANGE to your username and repo repo: YOUR_USERNAME/YOUR_REPO_NAME branch: main auth_scope: repo // This will be your Vercel URL (e.g., (https://my-portfolio.vercel.app)) base_url: https://YOUR_VERCEL_APP_URL.vercel.app auth_endpoint: api/auth // Update to your final public Vercel or GitHub Pages URL site_url: https://YOUR_USERNAME.github.io/YOUR_REPO_NAME/
To log into the /admin dashboard securely, you need to create a GitHub OAuth application.
- Go to your GitHub Settings -> Developer settings -> OAuth Apps -> New OAuth App.
- Application name: Your Portfolio CMS
- Homepage URL:
https://YOUR_VERCEL_APP_URL.vercel.app - Authorization callback URL:
https://YOUR_VERCEL_APP_URL.vercel.app/api/callback - Click Register application and then Generate a new client secret. Keep this tab open for the next step.
Vercel is required to run the serverless backend (/api/auth and /api/callback) that handles the GitHub login handshake.
- Go to Vercel and import your forked repository.
- Before clicking Deploy (or immediately after in the project Settings -> Environment Variables), you MUST add these exactly as written:
OAUTH_CLIENT_ID: (Paste your Client ID from GitHub)OAUTH_CLIENT_SECRET: (Paste your Client Secret from GitHub)COMPLETE_URL:https://YOUR_VERCEL_APP_URL.vercel.app/api/callbackORIGIN:https://YOUR_VERCEL_APP_URL.vercel.app
- If you added these after deploying, go to the Deployments tab and manually trigger a Redeploy.
If you want your public site hosted at github.io (while keeping Vercel strictly for the Admin CMS):
- Go to your GitHub repository Settings -> Pages.
- Under Build and deployment, change the Source dropdown to GitHub Actions.
- Push any change to your
mainbranch. The pre-configured.github/workflows/deploy.ymlfile will automatically build and publish your site!
Once everything is deployed, visit https://YOUR_VERCEL_APP_URL.vercel.app/admin/ to log in with GitHub and start adding your publications, news, and projects!