├── .eslintrc.json
├── .gitignore
├── README.md
├── next-env.d.ts
├── next.config.js
├── package-lock.json
├── package.json
├── pages
├── _app.js
├── _middleware.ts
└── index.tsx
├── public
├── card.png
└── favicon.ico
├── settings.json
├── styles
└── globals.css
├── tsconfig.json
├── types.ts
└── vercel.json
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
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 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 | .output
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Wordledge
2 |
3 | An implementation of [Wordle](https://www.powerlanguage.co.uk/wordle/) to help
4 | you learn Next.js and Vercel.
5 |
6 | [](https://wordledge.vercel.app)
7 |
8 | Demo: [https://wordledge.vercel.app](https://wordledge.vercel.app)
9 |
10 | ### Development
11 |
12 | To develop locally:
13 |
14 | ```bash
15 | npm run dev
16 | ```
17 |
18 | ### Edge
19 |
20 | In [`pages/middleware.ts`](pages/_middleware.ts) we implement the `/check` endpoint which gets deployed to all Vercel
21 | regions automatically and has no cold boots. Any time you submit, we make a query against `/check`.
22 |
23 | Users get automatically routed to the nearest region. Read more about [Edge Functions](https://vercel.com/edge).
24 |
25 | _Note: Soon, for ergonomic reasons, Next.js will help you run `api/check` as an Edge Function as well._
26 |
27 | ## Credits & License
28 |
29 | - Credits to Josh Wardle for [Wordle](https://www.powerlanguage.co.uk/wordle/)
30 | - Credits to [Katherine Peterson](https://github.com/octokatherine) of [Word Master](https://github.com/octokatherine/word-master) for bugfixes
31 | - Licensed under MIT
32 |
--------------------------------------------------------------------------------
/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/basic-features/typescript for more information.
6 |
--------------------------------------------------------------------------------
/next.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | reactStrictMode: true,
3 | swcMinify: true,
4 | };
5 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wordledge",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "copy-text-to-clipboard": "^3.0.1",
13 | "next": "^12.0.8",
14 | "react": "17.0.2",
15 | "react-confetti": "^6.0.1",
16 | "react-dom": "17.0.2",
17 | "react-hot-toast": "^2.2.0",
18 | "react-use": "^17.3.2"
19 | },
20 | "devDependencies": {
21 | "@types/react": "^17.0.38",
22 | "eslint": "8.6.0",
23 | "eslint-config-next": "12.0.7"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/pages/_app.js:
--------------------------------------------------------------------------------
1 | import "../styles/globals.css";
2 | import Head from "next/head";
3 |
4 | function MyApp({ Component, pageProps }) {
5 | return (
6 | <>
7 |
8 | Wordledge: Wordle on Next.js at the Edge
9 |
10 |
11 |
15 |
19 |
23 |
27 |
28 |
29 | >
30 | );
31 | }
32 |
33 | export default MyApp;
34 |
--------------------------------------------------------------------------------
/pages/_middleware.ts:
--------------------------------------------------------------------------------
1 | import { NextResponse } from "next/server";
2 | import type { NextRequest } from "next/server";
3 |
4 | const DICTIONARY_API_KEY = process.env.DICTIONARY_API_KEY;
5 | const WORD = process.env.WORD || "rauch";
6 |
7 | // e.g.: https://www.dictionaryapi.com/api/v3/references/collegiate/json/test?key={DICTIONARY_API_KEY}
8 | type DictionaryApiWord = {
9 | def: Array