Solutions to the Advent of Code challenges in JavaScript (Node.js).
- Node.js >= 22
- npm dependencies installed with
npm install - Optional
.envfile withAOC_SESSION_COOKIE=your_cookieif you want to scaffold a missing challenge
Warning
Automatic input.txt download is currently disabled in src/template/challengeSetup.js
- Install dependencies with
npm install - Optionally create a
.envfile withAOC_SESSION_COOKIE=your_cookie - Run
npm start <year> <day> - If the target challenge does not exist, the project creates the folder and copies the template
index.js
Examples:
npm start 2024 1npm start 2025 1
| Year | Completed days | Status |
|---|---|---|
| 2022 | 15/25 | 🔄 In progress |
| 2023 | 13/25 | 🔄 In progress |
| 2024 | 11/25 | 🔄 In progress |
| 2025 | 6/25 | 🔄 In progress |
Notes:
- The 2022 total includes
day1today9insrc/2022and archivedday10today15insrc/2022_backup. - The 2025 folder currently uses zero-padded names (
day01today06) and also contains an extraday6directory.
AdventOfCode/
├── index.js # Entry point: node index.js <year> <day>
├── .nvmrc # Node.js version used by the project
├── eslint.config.js # Active ESLint flat config
├── .eslintrc.yml # Legacy ESLint config kept in the repo
├── src/
│ ├── template/ # Template for new challenges
│ │ ├── template.js # Base code for a solution
│ │ └── challengeSetup.js # Auto-setup + input download script
│ ├── 2022/ # Active 2022 solutions (day1-day9)
│ ├── 2022_backup/ # Archived 2022 solutions (day10-day15)
│ ├── 2023/ (day1-day13)
│ ├── 2024/ (day1-day11)
│ └── 2025/ (day01-day06)
├── package.json
├── .prettierignore
└── .prettierrc
| Command | Description |
|---|---|
npm start <year> <day> |
Runs index.js with the Node inspector enabled; if the challenge folder does not exist, it scaffolds it from the template |
npm test |
Runs tests with Mocha (src/**/*.test.js) |
npm run lint |
Runs ESLint on src/**/*.js using eslint.config.js |
npm run debug |
Runs with the Node.js inspector (--inspect-brk) |
npm run prettier |
Runs Prettier on src/**/*.js |
The project uses Mocha + Chai for testing.
npm testTests should be placed next to the solutions using the *.test.js pattern.
- Runtime: Node.js 22
- Language: JavaScript ES modules
- Testing: Mocha + Chai
- Linting: ESLint flat config + eslint-config-prettier
- Formatting: Prettier