
Purpose of this post
This post publishes the source code used for the crossword web app. The code is loaded only when you open a file.
Tools used
- Next.js 15, React 19, TypeScript: lobby, game room, APIs
- node:sqlite: storing grids and input records
- gemma4 on Ollama: grid design and clue writing. It is called through an OpenAI-compatible API, so it can be swapped for another model.
- Google News RSS and the Korean Wikipedia API: current-affairs headlines and random words
- OpenSubtitles Korean frequency ranking: word grades
Folder layout
- lib/puzzle.ts: difficulty settings, turning a grid into a clue list, criteria checks
- lib/gridFill.ts: grid validation and correction, pre-drawn grids, word filling, the word-joining placer
- lib/dynamicBank.ts: AI grid design, AI clue writing, news and wiki words
- lib/words.ts, freqRanks.ts: word bank and frequency ranks
- lib/db.ts: game record DB, partial saves, cleaning up empty grids
- app/page.tsx, app/play/page.tsx: lobby and game room
- app/api: new grid, record saving, listing and resuming APIs
- components/CrosswordBoard.tsx: drawing the grid
- scripts/text-agent.ts, ai-pipeline-test.ts: tools that test the generator and the AI process as text
To run it, copy .env.local.example to .env.local and fill in the model address. Without a model, grids are built from the word bank and wiki words alone. The game record DB, ad and deployment scripts, and the server monitor are not included.
Full source
32 files · 6,788 lines — open a folder and click a file to load its code.
Project root
.env.local.example
Loading code…
next.config.ts
Loading code…
package.json
Loading code…
tsconfig.json
Loading code…
app/
app/api/game/[code]/move/route.ts
Loading code…
app/api/game/[code]/route.ts
Loading code…
app/api/game/abandon/route.ts
Loading code…
app/api/game/list/route.ts
Loading code…
app/api/game/route.ts
Loading code…
app/api/puzzle/route.ts
Loading code…
app/globals.css
Loading code…
app/layout.tsx
Loading code…
app/page.module.css
Loading code…
app/page.tsx
Loading code…
app/play/page.tsx
Loading code…
app/play/play.module.css
Loading code…
components/
components/CrosswordBoard.module.css
Loading code…
components/CrosswordBoard.tsx
Loading code…
lib/
lib/db.ts
Loading code…
lib/dynamicBank.ts
Loading code…
lib/freqRanks.ts
Loading code…
lib/gameTypes.ts
Loading code…
lib/gridFill.ts
Loading code…
lib/guest.ts
Loading code…
lib/puzzle.ts
Loading code…
lib/recentWords.ts
Loading code…
lib/services.ts
Loading code…
lib/words.ts
Loading code…
scripts/
scripts/ai-pipeline-test.ts
Loading code…
scripts/dev-with-ts.mjs
Loading code…
scripts/text-agent.ts
Loading code…
types/
types/node-sqlite.d.ts
Loading code…
COMMENTS · CHAPTER 04
The full source code and the tools used 0 comments
No comments yet. Leave a question or anything you would like to add.
To post a comment, continue with Google and register a nickname and email address.
Continue with Google