Skip to content

Commit

Permalink
Merging 5be33a4 into trunk-temp/pr-510/ce608c70-337a-4513-b766-a5578f…
Browse files Browse the repository at this point in the history
…597d7f
  • Loading branch information
trunk-io[bot] authored Apr 8, 2024
2 parents 4584fe4 + 5be33a4 commit f2e2ec7
Show file tree
Hide file tree
Showing 31 changed files with 5,818 additions and 51 deletions.
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,28 @@ updates:
- dependency-name: "@types/node"
versions: [">18.18"]

- package-ecosystem: npm
directory: /examples/nextjs-14-ip-details
schedule:
# Our dependencies should be checked daily
interval: daily
assignees:
- blaine-arcjet
reviewers:
- blaine-arcjet
commit-message:
prefix: deps(example)
prefix-development: deps(example)
groups:
dependencies:
patterns:
- "*"
ignore:
# Ignore updates to the @types/node package due to conflict between
# Headers in DOM.
- dependency-name: "@types/node"
versions: [">18.18"]

- package-ecosystem: npm
directory: /examples/nextjs-14-nextauth-4
schedule:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/reusable-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,48 @@ jobs:
working-directory: examples/nextjs-14-decorate
run: npm run build

nextjs-14-ip-details:
name: Next.js 14 + IP Details
runs-on: ubuntu-latest
permissions:
contents: read
steps:
# Environment security
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
fonts.googleapis.com:443
fonts.gstatic.com:443
github.com:443
registry.npmjs.org:443
# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/[email protected]
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-14-ip-details
run: npm ci

- name: Build
working-directory: examples/nextjs-14-ip-details
run: npm run build

nextjs-14-nextauth-4:
name: Next.js 14 + NextAuth 4
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions examples/nextjs-14-ip-details/.env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ARCJET_KEY=
3 changes: 3 additions & 0 deletions examples/nextjs-14-ip-details/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions examples/nextjs-14-ip-details/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
1 change: 1 addition & 0 deletions examples/nextjs-14-ip-details/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
omit=optional
36 changes: 36 additions & 0 deletions examples/nextjs-14-ip-details/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<a href="https://arcjet.com" target="_arcjet-home">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://arcjet.com/arcjet-logo-minimal-dark-mark-all.svg">
<img src="https://arcjet.com/arcjet-logo-minimal-light-mark-all.svg" alt="Arcjet Logo" height="128" width="auto">
</picture>
</a>

# Using the `ip` property on an ArcjetDecision with Next.js 14

This example shows how to use `decision.ip` in a Next.js [API
Route](https://nextjs.org/docs/pages/building-your-application/routing/api-routes).

## How to use

1. From the root of the project, install the SDK dependencies.

```bash
npm ci
```

2. Enter this directory and install the example's dependencies.

```bash
cd examples/nextjs-14-ip-details
npm ci
```

3. Rename `.env.local.example` to `.env.local` and add your Arcjet key.

4. Start the dev server.

```bash
npm run dev
```

5. Visit `http://localhost:3000/api/arcjet`.
6 changes: 6 additions & 0 deletions examples/nextjs-14-ip-details/cache/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"telemetry": {
"notifiedAt": "1709580281443",
"enabled": false
}
}
5 changes: 5 additions & 0 deletions examples/nextjs-14-ip-details/environment.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare namespace NodeJS {
export interface ProcessEnv {
readonly ARCJET_KEY: string;
}
}
6 changes: 6 additions & 0 deletions examples/nextjs-14-ip-details/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}

module.exports = nextConfig
Loading

0 comments on commit f2e2ec7

Please sign in to comment.