CLI tool for SNAP card freeze/unfreeze automation using Playwright browser automation.
If you have your .env file configured, you can start using the CLI immediately:
# Check your card status
bun run status
# Freeze your card
bun run freeze
# Unfreeze your card
bun run unfreezeInstall dependencies:
bun installCreate a .env file in the project root with your EBT card credentials:
# Copy the example file
cp .env.example .env
# Edit .env with your credentialsThe .env file should contain:
EBT_USER=your_user_id_here
EBT_PASSWORD=your_password_here
EBT_CARD_ID=your_card_id_selector
Note: The .env file is gitignored for security. Never commit credentials to version control.
- Headless Mode Implementation - How we overcame bot detection to enable headless automation
- Session Persistence - Cookie-based session reuse to reduce login frequency
- Development Notes - Implementation details and architecture decisions
The easiest way to run commands with automatic credential loading:
# Check card status
bun run status
# Freeze your SNAP card
bun run freeze
# Unfreeze your SNAP card
bun run unfreeze# Show help
dotenvx run -- bun run src/index.ts --help
# Check card status
dotenvx run -- bun run src/index.ts status
# Freeze card
dotenvx run -- bun run src/index.ts freeze
# Unfreeze card
dotenvx run -- bun run src/index.ts unfreeze
# Run with visible browser (not headless)
dotenvx run -- bun run src/index.ts freeze --headless falseYou can also pass credentials directly as command-line options:
bun run src/index.ts status --user YOUR_USER --password YOUR_PASSWORD --card-id YOUR_CARD_ID
bun run src/index.ts freeze --user YOUR_USER --password YOUR_PASSWORD --card-id YOUR_CARD_ID
bun run src/index.ts unfreeze --user YOUR_USER --password YOUR_PASSWORD --card-id YOUR_CARD_IDChecks the current status of your SNAP card (active or frozen).
dotenvx run -- bun run src/index.ts status [options]This command logs into your account, checks which buttons are available (freeze/unfreeze), and reports the current state of your card. It will not make any changes to your card.
Options:
--headless <boolean>- Run browser in headless mode (default: true)--user <user>- EBT user ID (overrides EBT_USER env var)--password <password>- EBT password (overrides EBT_PASSWORD env var)--card-id <cardId>- Card ID selector (overrides EBT_CARD_ID env var)
Freezes your SNAP card to prevent unauthorized transactions.
dotenvx run -- bun run src/index.ts freeze [options]The command automatically checks if the card is already frozen before attempting to freeze it.
Options:
--headless <boolean>- Run browser in headless mode (default: true)--user <user>- EBT user ID (overrides EBT_USER env var)--password <password>- EBT password (overrides EBT_PASSWORD env var)--card-id <cardId>- Card ID selector (overrides EBT_CARD_ID env var)
Unfreezes your SNAP card to allow transactions.
dotenvx run -- bun run src/index.ts unfreeze [options]The command automatically checks if the card is already unfrozen before attempting to unfreeze it.
Options: Same as freeze command.
This project uses dotenvx for secure credential management:
- Credentials are stored in
.envfile (gitignored) - Never commit credentials to version control
- Use environment variables in production
- Consider using dotenvx encryption for additional security
This project was created using bun init in bun v1.2.21. Bun is a fast all-in-one JavaScript runtime.
src/index.ts- CLI entry point using Commander.jssrc/ebt.ts- Core automation logic using Playwright.env- Credentials (gitignored, create from .env.example)tests/- Playwright tests
Private project.