Skip to content

Commit ed69ebe

Browse files
committed
V2 Init
0 parents  commit ed69ebe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+12295
-0
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DATABASE_URI=mongodb://127.0.0.1/your-database-name
2+
PAYLOAD_SECRET=YOUR_SECRET_HERE

.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
/.idea/*
10+
!/.idea/runConfigurations
11+
12+
# testing
13+
/coverage
14+
15+
# next.js
16+
/.next/
17+
/out/
18+
19+
# production
20+
/build
21+
22+
# misc
23+
.DS_Store
24+
*.pem
25+
26+
# debug
27+
npm-debug.log*
28+
yarn-debug.log*
29+
yarn-error.log*
30+
31+
# local env files
32+
.env*.local
33+
34+
# vercel
35+
.vercel
36+
37+
# typescript
38+
*.tsbuildinfo
39+
next-env.d.ts
40+
41+
.env
42+
43+
/media
44+
45+
# Playwright
46+
node_modules/
47+
/test-results/
48+
/playwright-report/
49+
/blob-report/
50+
/playwright/.cache/
51+
temp

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

.prettierrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 100,
5+
"semi": false
6+
}

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
3+
}

.vscode/launch.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Next.js: debug full stack",
9+
"type": "node",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/node_modules/next/dist/bin/next",
12+
"runtimeArgs": ["--inspect"],
13+
"skipFiles": ["<node_internals>/**"],
14+
"serverReadyAction": {
15+
"action": "debugWithChrome",
16+
"killOnServerStop": true,
17+
"pattern": "- Local:.+(https?://.+)",
18+
"uriFormat": "%s",
19+
"webRoot": "${workspaceFolder}"
20+
},
21+
"cwd": "${workspaceFolder}"
22+
}
23+
]
24+
}

.vscode/settings.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"npm.packageManager": "pnpm",
3+
"editor.defaultFormatter": "esbenp.prettier-vscode",
4+
"[typescript]": {
5+
"editor.defaultFormatter": "esbenp.prettier-vscode",
6+
"editor.formatOnSave": true,
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll.eslint": "explicit"
9+
}
10+
},
11+
"[typescriptreact]": {
12+
"editor.defaultFormatter": "esbenp.prettier-vscode",
13+
"editor.formatOnSave": true,
14+
"editor.codeActionsOnSave": {
15+
"source.fixAll.eslint": "explicit"
16+
}
17+
},
18+
"[javascript]": {
19+
"editor.defaultFormatter": "esbenp.prettier-vscode",
20+
"editor.formatOnSave": true,
21+
"editor.codeActionsOnSave": {
22+
"source.fixAll.eslint": "explicit"
23+
}
24+
},
25+
"[json]": {
26+
"editor.defaultFormatter": "esbenp.prettier-vscode",
27+
"editor.formatOnSave": true
28+
},
29+
"[jsonc]": {
30+
"editor.defaultFormatter": "esbenp.prettier-vscode",
31+
"editor.formatOnSave": true
32+
},
33+
"editor.formatOnSaveMode": "file",
34+
"typescript.tsdk": "node_modules/typescript/lib",
35+
"[javascript][typescript][typescriptreact]": {
36+
"editor.codeActionsOnSave": {
37+
"source.fixAll.eslint": "explicit"
38+
}
39+
}
40+
}

.yarnrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--install.ignore-engines true

Dockerfile

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# To use this Dockerfile, you have to set `output: 'standalone'` in your next.config.mjs file.
2+
# From https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
3+
4+
FROM node:22.12.0-alpine AS base
5+
6+
# Install dependencies only when needed
7+
FROM base AS deps
8+
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
9+
RUN apk add --no-cache libc6-compat
10+
WORKDIR /app
11+
12+
# Install dependencies based on the preferred package manager
13+
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
14+
RUN \
15+
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
16+
elif [ -f package-lock.json ]; then npm ci; \
17+
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
18+
else echo "Lockfile not found." && exit 1; \
19+
fi
20+
21+
22+
# Rebuild the source code only when needed
23+
FROM base AS builder
24+
WORKDIR /app
25+
COPY --from=deps /app/node_modules ./node_modules
26+
COPY . .
27+
28+
# Next.js collects completely anonymous telemetry data about general usage.
29+
# Learn more here: https://nextjs.org/telemetry
30+
# Uncomment the following line in case you want to disable telemetry during the build.
31+
# ENV NEXT_TELEMETRY_DISABLED 1
32+
33+
RUN \
34+
if [ -f yarn.lock ]; then yarn run build; \
35+
elif [ -f package-lock.json ]; then npm run build; \
36+
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
37+
else echo "Lockfile not found." && exit 1; \
38+
fi
39+
40+
# Production image, copy all the files and run next
41+
FROM base AS runner
42+
WORKDIR /app
43+
44+
ENV NODE_ENV production
45+
# Uncomment the following line in case you want to disable telemetry during runtime.
46+
# ENV NEXT_TELEMETRY_DISABLED 1
47+
48+
RUN addgroup --system --gid 1001 nodejs
49+
RUN adduser --system --uid 1001 nextjs
50+
51+
# Remove this line if you do not have this folder
52+
COPY --from=builder /app/public ./public
53+
54+
# Set the correct permission for prerender cache
55+
RUN mkdir .next
56+
RUN chown nextjs:nodejs .next
57+
58+
# Automatically leverage output traces to reduce image size
59+
# https://nextjs.org/docs/advanced-features/output-file-tracing
60+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
61+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
62+
63+
USER nextjs
64+
65+
EXPOSE 3000
66+
67+
ENV PORT 3000
68+
69+
# server.js is created by next build from the standalone output
70+
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
71+
CMD HOSTNAME="0.0.0.0" node server.js

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Payload Blank Template
2+
3+
This template comes configured with the bare minimum to get started on anything you need.
4+
5+
## Quick start
6+
7+
This template can be deployed directly from our Cloud hosting and it will setup MongoDB and cloud S3 object storage for media.
8+
9+
## Quick Start - local setup
10+
11+
To spin up this template locally, follow these steps:
12+
13+
### Clone
14+
15+
After you click the `Deploy` button above, you'll want to have standalone copy of this repo on your machine. If you've already cloned this repo, skip to [Development](#development).
16+
17+
### Development
18+
19+
1. First [clone the repo](#clone) if you have not done so already
20+
2. `cd my-project && cp .env.example .env` to copy the example environment variables. You'll need to add the `MONGODB_URI` from your Cloud project to your `.env` if you want to use S3 storage and the MongoDB database that was created for you.
21+
22+
3. `pnpm install && pnpm dev` to install dependencies and start the dev server
23+
4. open `http://localhost:3000` to open the app in your browser
24+
25+
That's it! Changes made in `./src` will be reflected in your app. Follow the on-screen instructions to login and create your first admin user. Then check out [Production](#production) once you're ready to build and serve your app, and [Deployment](#deployment) when you're ready to go live.
26+
27+
#### Docker (Optional)
28+
29+
If you prefer to use Docker for local development instead of a local MongoDB instance, the provided docker-compose.yml file can be used.
30+
31+
To do so, follow these steps:
32+
33+
- Modify the `MONGODB_URI` in your `.env` file to `mongodb://127.0.0.1/<dbname>`
34+
- Modify the `docker-compose.yml` file's `MONGODB_URI` to match the above `<dbname>`
35+
- Run `docker-compose up` to start the database, optionally pass `-d` to run in the background.
36+
37+
## How it works
38+
39+
The Payload config is tailored specifically to the needs of most websites. It is pre-configured in the following ways:
40+
41+
### Collections
42+
43+
See the [Collections](https://payloadcms.com/docs/configuration/collections) docs for details on how to extend this functionality.
44+
45+
- #### Users (Authentication)
46+
47+
Users are auth-enabled collections that have access to the admin panel.
48+
49+
For additional help, see the official [Auth Example](https://github.com/payloadcms/payload/tree/main/examples/auth) or the [Authentication](https://payloadcms.com/docs/authentication/overview#authentication-overview) docs.
50+
51+
- #### Media
52+
53+
This is the uploads enabled collection. It features pre-configured sizes, focal point and manual resizing to help you manage your pictures.
54+
55+
### Docker
56+
57+
Alternatively, you can use [Docker](https://www.docker.com) to spin up this template locally. To do so, follow these steps:
58+
59+
1. Follow [steps 1 and 2 from above](#development), the docker-compose file will automatically use the `.env` file in your project root
60+
1. Next run `docker-compose up`
61+
1. Follow [steps 4 and 5 from above](#development) to login and create your first admin user
62+
63+
That's it! The Docker instance will help you get up and running quickly while also standardizing the development environment across your teams.
64+
65+
## Questions
66+
67+
If you have any issues or questions, reach out to us on [Discord](https://discord.com/invite/payload) or start a [GitHub discussion](https://github.com/payloadcms/payload/discussions).

0 commit comments

Comments
 (0)