This repository contains the source code for the All Things Linux website (allthingslinux.org).
This is a Next.js application (using the App Router) built with Tailwind CSS for styling and Contentlayer for managing MDX blog content. It is deployed to Cloudflare Workers using the OpenNext adapter (@opennextjs/cloudflare). The project also utilizes Trigger.dev for background jobs.
Deployments are automated via Cloudflare's Git integration, deploying the main branch to production and the dev branch to a development/preview environment.
- Framework: Next.js (v15+)
- Styling: Tailwind CSS
- Content: Contentlayer (MDX)
- Deployment: Cloudflare Workers
- Adapter: OpenNext (
@opennextjs/cloudflare) - Background Jobs: Trigger.dev
- Package Manager: pnpm
- Node Version: Defined in
package.json(enginesfield)
- Node.js (version specified in
package.json) - pnpm (install with
npm install -g pnpmor follow installation guide) - Access to Cloudflare account (for viewing deployments and managing secrets)
- Trigger.dev account for background/async task management
- Clone the repository:
git clone https://github.com/allthingslinux/allthingslinux.git cd allthingslinux - Install dependencies:
pnpm install
-
Secrets (
.dev.vars):- Create a
.dev.varsfile in the project root. This file is ignored by Git (.gitignore). - Add the required environment variables and secrets needed for local development (e.g.,
GITHUB_TOKEN,MONDAY_API_KEY,MONDAY_BOARD_ID,DISCORD_WEBHOOK_URL,TRIGGER_SECRET_KEY). Use the formatKEY=VALUE, one per line. - Refer to
wrangler.local.jsonc(varssection) for the expected variable names.
- Create a
-
Run Development Servers:
- To start all necessary development servers (Next.js, Wrangler, Trigger.dev) concurrently, run:
pnpm run dev:all
- This will typically make:
- The Next.js app available at
http://localhost:3000. - The Wrangler dev server (simulating Cloudflare) available at
http://localhost:8788.
- The Next.js app available at
- To start all necessary development servers (Next.js, Wrangler, Trigger.dev) concurrently, run:
-
Accessing the App: Use
http://localhost:3000for standard development with Hot Module Replacement (HMR). Usehttp://localhost:8788to interact with the app as it would run within the Wrangler environment (useful for testing Cloudflare-specific bindings or logic).
The project uses separate wrangler configuration files for different environments:
wrangler.local.jsonc: Used bypnpm run dev:wranglerandpnpm run dev:all. Reads secrets from.dev.vars.wrangler.dev.jsonc: Used for deployments to the development environment (via Cloudflare Git integration on thedevbranch).wrangler.production.jsonc: Used for deployments to the production environment (via Cloudflare Git integration on themainbranch).wrangler.jsonc: Minimal file required only for the@opennextjs/cloudflare buildstep (due to the specific package version). Not used for deployment targeting.
To perform a full production build, including adapting the Next.js output for Cloudflare Workers via OpenNext, run:
pnpm run buildThis executes the full build chain defined in package.json. The output suitable for Cloudflare deployment will be placed in the .open-next directory.
Deployments are typically automated via Cloudflare's Git integration connected to the allthingslinux-development and allthingslinux-production Worker services.
- Push to
devbranch: Triggers a build and deployment to the development environment. - Push to
mainbranch: Triggers a build and deployment to the production environment.
Manual deployments can be triggered using:
pnpm run deploy:dev(Builds and deploys to development)pnpm run deploy:prod(Builds and deploys to production)pnpm run deploy(Alias fordeploy:prod)
Refer to the Cloudflare Worker settings for the exact build/deploy commands used by the automated process.
- Local: Use the
.dev.varsfile (ensure it's in.gitignore). - Development: Manage secrets via the Cloudflare dashboard for the
allthingslinux-developmentWorker or usingwrangler secret put <KEY> --env development. - Production: Manage secrets via the Cloudflare dashboard for the
allthingslinux-productionWorker or usingwrangler secret put <KEY>.
For a detailed explanation of all available pnpm scripts, please refer to the PNPM_SCRIPTS.md file in the repository root.