Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ node_modules
.gitignore
*.md
dist
.next
media
.env
2 changes: 1 addition & 1 deletion .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 24
cache: 'pnpm'
- name: Install Node Dependencies
run: pnpm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 24
cache: 'pnpm'
- name: Install Node Dependencies
run: pnpm install
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
build
dist
/.next/
/next-env.d.ts
/tsconfig.tsbuildinfo
/media
/src/payload-types.ts
/src/generated-schema.graphql
node_modules
.DS_Store
.env
src/uploads
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- BEGIN:nextjs-agent-rules -->

# This is NOT the Next.js you know

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.

This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.

<!-- END:nextjs-agent-rules -->
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
62 changes: 44 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,55 @@
FROM node:21-alpine3.18 as base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
# Requires `output: 'standalone'` in next.config.ts
# Based on https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile

COPY ./package.json ./pnpm-lock.yaml /app/
FROM node:22-alpine AS base

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN corepack enable pnpm && pnpm i --frozen-lockfile

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY . /app
RUN pnpm run build
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

FROM base as runtime
RUN corepack enable pnpm && pnpm run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js

COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist
COPY --from=build /app/build /app/build
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next

# Payload stores uploaded media here (staticDir of the media collection)
RUN mkdir /app/media
RUN chown nextjs:nodejs /app/media

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Sample images used by the seed script
COPY --from=builder /app/src/seed ./src/seed

USER nextjs

EXPOSE 3000

ENTRYPOINT ["pnpm"]
CMD ["pnpm", "serve"]
ENV PORT=3000

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD HOSTNAME="0.0.0.0" node server.js
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

<!-- ALL-CONTRIBUTORS-BADGE:END -->

This is the content management system (CMS) for [youngvision.org](https://www.youngvision.org/) ([repository](https://github.com/YoungVision-eV/website)), built using [Payload CMS](https://payloadcms.com/). It is currently used to create and manage the events displayed on our website.
This is the content management system (CMS) for [youngvision.org](https://www.youngvision.org/) ([repository](https://github.com/YoungVision-eV/website)), built using [Payload CMS](https://payloadcms.com/) 3 (on top of [Next.js](https://nextjs.org/)). It is currently used to create and manage the events displayed on our website.

## 📦 Prerequisites

Before you begin, ensure you have the following installed:

- Node.js (v16 or higher)
- Node.js (^22.23.4 or >=24.22.1)
- pnpm
- docker / podman

Expand Down Expand Up @@ -59,22 +59,25 @@ Before you begin, ensure you have the following installed:

1. **Start Production Server**
```bash
pnpm serve
pnpm start
```

## 📂 Folder Structure

- `src/app/` - Next.js app serving the admin panel and API routes
- `src/collections/` - Collection definitions
- `src/components/` - Custom admin components
- `src/migrations/` - Database migrations
- `src/seed/` - Script and media for seeding sample data
- `src/payload.config.ts` - Payload configuration
- `src/server.ts` - Express server

## 📜 Scripts

- `pnpm dev` - Start development server
- `pnpm build` - Build for production
- `pnpm serve` - Start production server
- `pnpm start` - Start production server
- `pnpm generate:types` - Generate TypeScript types (which are used in the [Frontend](https://github.com/YoungVision-eV/website/blob/main/src/data/payload-types.ts))
- `pnpm payload` - Payload CLI (e.g. `pnpm payload migrate` to run database migrations)

## ✨ Contributors

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- PAYLOAD_SECRET
- DATABASE_URI=mongodb://mongo:27017/website
volumes:
- 'payload-uploads:/app/dist/uploads'
- 'payload-uploads:/app/media'
env_file:
- path: '.env'
required: false
Expand Down
40 changes: 40 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { withPayload } from '@payloadcms/next/withPayload';
import type { NextConfig } from 'next';
import path from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(__filename);

const nextConfig: NextConfig = {
output: 'standalone',
images: {
localPatterns: [
{
pathname: '/api/media/file/**',
},
],
},
// Redirect root to Admin panel
redirects: async () => [
{
source: '/',
destination: '/admin',
permanent: false,
},
],
webpack: (webpackConfig) => {
webpackConfig.resolve.extensionAlias = {
'.cjs': ['.cts', '.cjs'],
'.js': ['.ts', '.tsx', '.js', '.jsx'],
'.mjs': ['.mts', '.mjs'],
};

return webpackConfig;
},
turbopack: {
root: path.resolve(dirname),
},
};

export default withPayload(nextConfig, { devBundleServerPackages: false });
6 changes: 0 additions & 6 deletions nodemon.json

This file was deleted.

58 changes: 27 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,43 @@
"name": "website-cms",
"description": "A blank template to get started with Payload",
"version": "1.0.0",
"main": "dist/server.js",
"license": "MIT",
"packageManager": "pnpm@10.4.1",
"type": "module",
"packageManager": "pnpm@12.16.1",
"engines": {
"node": "^22.23.4 || >=24.22.1"
},
"scripts": {
"dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon",
"build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
"build:server": "tsc",
"build": "pnpm run copyfiles && pnpm run /build:.*/",
"serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/",
"generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types",
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema",
"payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload",
"build": "cross-env NODE_OPTIONS=--no-deprecation next build",
"dev": "cross-env NODE_OPTIONS=--no-deprecation next dev",
"devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
"generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap",
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
"generate:graphQLSchema": "cross-env NODE_OPTIONS=--no-deprecation payload generate:graphQLSchema",
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
"format": "prettier --write ."
},
"dependencies": {
"@payloadcms/bundler-webpack": "^1.0.0",
"@payloadcms/db-mongodb": "^1.0.0",
"@payloadcms/plugin-cloud": "^3.0.0",
"@payloadcms/richtext-lexical": "^0.11.0",
"@payloadcms/richtext-slate": "^1.0.0",
"@payloadcms/db-mongodb": "^3.92.1",
"@payloadcms/next": "^3.92.1",
"@payloadcms/payload-cloud": "^3.92.1",
"@payloadcms/richtext-lexical": "^3.92.1",
"@payloadcms/ui": "^3.92.1",
"cross-env": "^7.0.3",
"dotenv": "^16.0.0",
"express": "^4.19.2",
"payload": "^2.0.0"
"graphql": "^16.8.1",
"next": "16.3.3",
"payload": "^3.92.1",
"react": "19.2.6",
"react-dom": "19.2.6",
"sharp": "0.35.4"
},
"devDependencies": {
"@types/express": "^4.17.9",
"copyfiles": "^2.4.1",
"nodemon": "^3.0.0",
"@types/node": "22.19.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"prettier": "^3.5.1",
"ts-node": "^10.0.0",
"typescript": "^5.0.0"
},
"pnpm": {
"ignoredBuiltDependencies": [
"@swc/core",
"es5-ext"
],
"onlyBuiltDependencies": [
"sharp"
]
}
}
Loading
Loading