Skip to content

Commit

Permalink
Add NextJS example app (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-el committed Aug 13, 2024
1 parent d513728 commit 152e96f
Show file tree
Hide file tree
Showing 62 changed files with 12,747 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

- [Angular](angular/ngSnowplow)
- [React](react)
- [Next.js](nextjs)
6 changes: 6 additions & 0 deletions nextjs/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
NEXT_PUBLIC_SNOWPLOW_COLLECTOR_URL=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=

# For Snowtype in development
SNOWPLOW_CONSOLE_API_KEY=
3 changes: 3 additions & 0 deletions nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
35 changes: 35 additions & 0 deletions nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# 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
20 changes: 20 additions & 0 deletions nextjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Next.js Ecommerce Example

A Next.js ecommerce application showcasing Snowplow Ecommerce tracking, with Stripe.

## Running locally

1. `npm install`

2. Fill the environment variables required in a local env file. A template is provided in `.env.example`. You can copy this file to `.env.local` and fill in the required values.

| Environment Variable | Description |
|-------------------------------------|-----------------------------------------------------------------------------------------------------|
| `NEXT_PUBLIC_SNOWPLOW_COLLECTOR_URL` | The URL of your Snowplow collector. If you don't have a Snowplow collector, you can use [Snowplow Micro](https://docs.snowplow.io/docs/testing-debugging/snowplow-micro/) for testing. |
| `STRIPE_SECRET_KEY` | Your Stripe secret key. If you don't have a Stripe account, you can create one [here](https://stripe.com/). |
| `STRIPE_WEBHOOK_SECRET` | Your Stripe webhook secret. You can find this in your Stripe dashboard. |

> [!IMPORTANT]
> `STRIPE_SECRET_KEY` and `STRIPE_WEBHOOK_SECRET` are required for the application to function correctly.
3. `npm run dev`
6 changes: 6 additions & 0 deletions nextjs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
}

module.exports = nextConfig
Loading

0 comments on commit 152e96f

Please sign in to comment.