church-website/README.md
2026-03-10 09:02:48 +01:00

105 lines
3.3 KiB
Markdown

# Heilige Drei Könige Website
This repository contains the source code for the Heilige Drei Könige Catholic Church website, built with:
- Next.js
- React
- Payload CMS v3
- PostgreSQL
## Quick start
1) Requirements
- Node.js 22+ (see `engines` in `package.json`)
- npm (or your preferred package manager)
- Database PostgreSQL with PostGIS extension
2) Install dependencies
```bash
npm install
```
3) Configure environment
```bash
cp .env.example .env
```
Then update the values as needed. Example keys from `.env.example`:
- `DATABASE_URI` — database connection string (Mongo example provided). For Postgres, use a URL like `postgres://user:password@host:5432/dbname`.
- `PAYLOAD_SECRET` — secret used by Payload
- `GOOGLE_BUCKET` — GCS bucket name (if using @payloadcms/storage-gcs)
- `RESEND_API_KEY` — API key for Resend (emails)
4) Run the development server
```bash
npm run dev
```
By default the app runs at http://localhost:3000
## Database options
### PostgreSQL + PostGIS
You can run a Postgres image with PostGIS locally:
```bash
docker pull postgis/postgis
```
Create and run a container, then set your `DATABASE_URI` to the Postgres URL. Ensure the PostGIS extension is enabled in your database.
Alternatively, you can enable the Postgres service in `docker-compose.yml` (currently commented out) and use that as your local DB.
## Google Cloud Storage
Media and document uploads use `@payloadcms/storage-gcs`. The plugin is always registered but conditionally enabled via the `GOOGLE_BUCKET` environment variable:
- **`GOOGLE_BUCKET` set** — files are uploaded to GCS and served from `https://storage.googleapis.com/<bucket>/`.
- **`GOOGLE_BUCKET` unset** — the plugin is disabled and Payload falls back to local file storage. The `alwaysInsertFields` flag keeps the schema identical in both cases, so `payload-types.ts` and `importMap.js` stay stable across environments.
No additional configuration is needed for local development — simply omit `GOOGLE_BUCKET` from your `.env`.
## Migrations (Payload)
Create a new migration:
```bash
npm run payload migrate:create --<name>
```
Apply pending migrations:
```bash
npm run payload migrate
```
Note: After deploying changes to production, ensure migrations are executed against the production database. (Todo: Integrate this step into Continuous Deployment.)
## Admin panel (Payload)
Once the server is running, open:
- http://localhost:3000/admin
## Scripts
Common scripts available in `package.json`:
- `npm run dev` — start Next.js dev server
- `npm run build` — build for production
- `npm start` — start the production server
- `npm test` — run tests (Vitest)
- `npm run storybook` — start Storybook on port 6006
## Storybook
Storybook lets you develop and preview UI components in isolation.
Start Storybook:
```bash
npm run storybook
```
Open http://localhost:6006
## Site Metadata
Site-wide metadata (title, description, keywords, OpenGraph) is configured in `src/config/site.ts`. Update that file to change SEO defaults used in the root layout.
## A note on updating dependencies
Payload CMS and Next.js are pinned to specific versions. From the Payload docs we currently have the following requirements (March 2026):
> Next.js (one of the following version ranges):
15.2.9 - 15.2.x
15.3.9 - 15.3.x
15.4.11 - 15.4.x
16.2.0-canary.10+