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
(engines
field)
- Node.js (version specified in
package.json
) - pnpm (install with
npm install -g pnpm
or 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.vars
file 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
(vars
section) 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:3000
for standard development with Hot Module Replacement (HMR). Usehttp://localhost:8788
to 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:wrangler
andpnpm run dev:all
. Reads secrets from.dev.vars
.wrangler.dev.jsonc
: Used for deployments to the development environment (via Cloudflare Git integration on thedev
branch).wrangler.production.jsonc
: Used for deployments to the production environment (via Cloudflare Git integration on themain
branch).wrangler.jsonc
: Minimal file required only for the@opennextjs/cloudflare build
step (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 build
This 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
dev
branch: Triggers a build and deployment to the development environment. - Push to
main
branch: 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.vars
file (ensure it's in.gitignore
). - Development: Manage secrets via the Cloudflare dashboard for the
allthingslinux-development
Worker or usingwrangler secret put <KEY> --env development
. - Production: Manage secrets via the Cloudflare dashboard for the
allthingslinux-production
Worker 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.