This guide is designed for beginners. You don't need complex configurations to deploy your website.
-
Build your project
First, ensure you have the correct Node.js version installed.
- Download & Install: Go to https://nodejs.org/en/download and install Node.js manually.
- Better not to use the system's default Node.js as it might be outdated.
Open your terminal in the project folder and run:
npm install npm run build
This will create a folder named
outin your project directory. This folder contains your generated website. -
Create a GitHub Repository
- Log in to GitHub.
- Create a new Public repository.
- Name it
username.github.io(replaceusernamewith your actual GitHub username).
-
Upload Files
- Upload all the files inside the
outfolder to your new repository. - You can do this by clicking "Upload files" on the GitHub repository page and dragging everything from the
outfolder. - Alternatively, if you know Git, you can push the contents of
outto the repository.
- Upload all the files inside the
-
Add .nojekyll file
- In your GitHub repository, click "Add file" -> "Create new file".
- Name the file
.nojekyll(start with a dot, all lowercase). - Leave the content empty and click "Commit changes".
- This is important! It tells GitHub to allow folders starting with
_(like_next).
-
Configure Pages
- Go to your repository Settings.
- Click on Pages in the left sidebar.
- Under Build and deployment, ensure "Deploy from a branch" is selected.
- Select your branch (usually
main) and click Save.
-
Done! Visit
https://username.github.ioto see your website.
PRISM also supports automatic deployment to GitHub Pages using GitHub Actions.
This method is recommended if you want your site to update automatically whenever you push changes.
This repository includes an optional workflow located at:
.github/workflows/deploy.yml
For template users, GitHub disables workflows by default.
To enable deployment:
-
Go to Settings > Pages, and under Build and deployment > Source, choose GitHub Actions.
-
Go to Actions Tab, and select "Deploy PRISM to GitHub Pages".
-
Click "Enable workflow".
-
Run manually using Run workflow.
-
(Optional) To enable automatic deployment on push:
Edit.github/workflows/deploy.ymland uncomment:on: push: branches: - main - ci
Once enabled, GitHub Actions will:
- Build your site (
npm install && npm run build) - Export static files into
out/ - Deploy automatically to GitHub Pages
Your site will be available at https://<username>.github.io
If you are using a repository other than username.github.io, your site will be at https://<username>.github.io/<repository>/.
In this case, make sure to set the basePath and assetPrefix in next.config.ts accordingly to add path prefixes to your assets:
// next.config.ts
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: 'export',
trailingSlash: true,
// Add these two lines
basePath: "/my-repo",
assetPrefix: "/my-repo",
images: {
unoptimized: true,
},
/* config options here */
webpack: (config) => {
config.module.rules.push({
test: /\.bib$/,
type: 'asset/source',
});
return config;
},
};
export default nextConfig;
-
Build your project Run
npm run buildto generate theoutfolder. -
Create Application
- Log in to the Cloudflare Dashboard.
- Go to Workers & Pages -> Create Application.
- Select the Pages tab.
- Click Drag and drop your files.
-
Upload
- Enter a Project name (this will be your subdomain, e.g.,
my-site). - Click Create project.
- Drag and drop your
outfolder (or a zip archive of it) into the upload area. - Click Deploy.
- Enter a Project name (this will be your subdomain, e.g.,
-
Done! You will see your site live at
https://<project-name>.pages.dev.