college-experiments
v1.0.2
Published
A CLI tool to copy Web Application Development (WAD) experiment starter files into your college project. Covers Node.js HTTP servers, Express static routing, MySQL CRUD, Bcrypt authentication, App Security, REST APIs, React Native with SQLite, and Fetch.
Maintainers
Readme
college-experiments
Copy JavaScript experiment starter files directly into your project with one command.
Introduction
college-experiments is a zero-dependency CLI tool that ships Web Application Development (WAD) experiment starter files. Instead of searching online for boilerplate code, college students can instantly copy any experiment into their working project with a single npx command.
The package copies the selected file — it does not execute it automatically. You run it yourself with node.
Features
- ✅ 8 standalone practical experiments covering Node.js, Express, MySQL, Auth, Security, REST API, React Native SQLite, and Fetch
- ✅ Single command to copy any experiment into your project
- ✅ Custom output directory support
- ✅ Overwrite protection with
--forceflag - ✅ Works with
npx— no global install required - ✅ Cross-platform: Windows, macOS, Linux
- ✅ Zero external dependencies
Requirements
- Node.js
>= 18.0.0 - npm
>= 7.0.0
Installation
Option 1 — Run with npx (no install needed)
npx college-experiments 1Option 2 — Install locally in your project
npm install college-experiments
npx college-experiments listOption 3 — Install globally
npm install -g college-experiments
college-experiments listCLI Usage
Copy an experiment by number
npx college-experiments 1
npx college-experiments 5This copies the corresponding file into an experiments/ directory in your current working directory.
Copy an experiment by name
npx college-experiments experiment-1
npx college-experiments experiment-5List all available experiments
npx college-experiments listOutput:
📚 Available Experiments
─────────────────────────────────────────────────
[1] experiment-1.js — Node.js Basic HTTP Server
[2] experiment-2.js — Express Static Web App
[3] experiment-3.js — MySQL CRUD Operations
[4] experiment-4.js — User Authentication & Sessions
[5] experiment-5.js — Web App Security & Sanitization (XSS & CSRF)
[6] experiment-6.js — RESTful API for To-Do List (CRUD)
[7] experiment-7.js — React Native SQLite Blog App
[8] experiment-8.js — Consuming REST API with FetchCustom output folder
npx college-experiments 3 --output src/practicals
npx college-experiments 3 -o src/practicalsThe destination directory is created automatically if it does not exist.
Overwrite protection
By default, the CLI will not overwrite a file that already exists:
npx college-experiments 3
# ⚠ File already exists: experiments/experiment-3.js
# ℹ Use --force (or -f) to overwrite:
# ℹ npx college-experiments 3 --forceTo force an overwrite:
npx college-experiments 3 --force
npx college-experiments 3 -fHelp
npx college-experiments help
npx college-experiments --helpRunning Copied Experiments
After copying, run the file directly with Node.js:
node experiments/experiment-1.js
node experiments/experiment-2.jsExperiments Overview
| # | File | Topic |
|---|------|-------|
| 1 | experiment-1.js | Node.js Basic HTTP Server (http.createServer) |
| 2 | experiment-2.js | Express Static Web App & Routing |
| 3 | experiment-3.js | MySQL CRUD Operations with Express |
| 4 | experiment-4.js | User Authentication & Sessions (Bcrypt + Express-Session) |
| 5 | experiment-5.js | Web App Security & Sanitization (XSS & CSRF Prevention) |
| 6 | experiment-6.js | RESTful API for To-Do List (CRUD with Postman testing) |
| 7 | experiment-7.js | React Native & SQLite Local Storage Mobile App |
| 8 | experiment-8.js | Consuming REST API & Asynchronous Fetch |
Development Setup
# Clone the repo
git clone https://github.com/your-username/college-experiments.git
cd college-experiments
# No npm install needed — zero dependenciesTesting
Run the full test suite using Node.js's built-in test runner:
npm testCheck what will be included in the published archive:
npm run pack:checkNPM Publishing
⚠️ Never publish automatically. Publishing is always a manual step performed by you.
Step-by-step
# 1. Log in to npm
npm login
# 2. Verify you are logged in
npm whoami
# 3. Run tests
npm test
# 4. Preview what will be published (dry run)
npm pack --dry-run
# 5. Publish
npm publishVerify the published package
In a separate temporary project:
mkdir test-project && cd test-project
npm init -y
npm install college-experiments
npx college-experiments list
npx college-experiments 1
node experiments/experiment-1.jsIf the package name is already taken
Choose a scoped or unique name, for example:
@yourname/college-experiments
college-js-experiments
my-college-experimentsThen update "name" in package.json accordingly before publishing.
Troubleshooting
| Problem | Solution |
|---------|----------|
| command not found: college-experiments | Use npx college-experiments instead, or install globally with npm i -g college-experiments |
| Permission denied creating directory | Run the command as an administrator, or choose a different output path |
| Source file not found in the package | Reinstall: npm install college-experiments |
| File not overwritten | Add the --force flag |
| Node.js version too old | Upgrade Node.js to 18 or later from nodejs.org |
License
MIT © college-experiments contributors
