https://github.com/usrrname/invoicer
https://github.com/usrrname/invoicer
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/usrrname/invoicer
- Owner: usrrname
- Created: 2025-12-24T15:50:12.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-02-16T22:11:04.000Z (4 months ago)
- Last Synced: 2026-02-17T04:54:53.727Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 31.7 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Invoicer
A CLI tool that converts markdown invoice files into PDF documents.
## Usage
Run the CLI tool with an input markdown file and output PDF filename:
```bash
node src/cli.mjs
```
### Example
```bash
node src/cli.mjs invoice-template.md invoice.pdf
```
The generated PDF will be saved in `records/YYYY/MM/` directory structure.
## Input File Format
The markdown input file should contain invoice information in the following format:
```markdown
# Invoice
Invoice ID: INV-2025-001
Date: 2025-12-25
## Payer
- Name: Company Name
- Address: 123 Main St, City, State 12345
- Telephone: (555) 123-4567
## Payee
- Name: Your Name
- Email: your@email.com
- Address: 456 Business Ave, City, State 67890
- Telephone: (555) 987-6543
## Line Items
| Description | Date | Hours | Rate | Amount |
| -------------------- | ----------------------- | ------ | ----- | -------- |
| Web Development | 2024-01-15 | 8 | 150 | 1200.00 |
| Design Services | 2024-01-16 | 4 | 200 | 800.00 |
## Expenses
| Date | Name | Description | Amount |
| ---------- | ---- | --------------------- | ------ |
| 2024-01-10 | Uber | Transport to office | 50.00 |
| 2024-01-15 | Taxi | Transport from office | 30.00 |
```
### Supported Fields
- **Invoice ID**: Unique identifier for the invoice (optional)
- **Date**: Invoice date (optional, defaults to current date)
- **Payer Section**: Contains payer information as list items
- `Name`: Name of the invoice recipient
- `Address`: Address of the recipient
- `Telephone`: Contact phone number
- **Payee Section**: Contains payee information as list items
- `Name`: Name of the person/company issuing the invoice
- `Email`: Email address of the invoicer
- `Address`: Address of the invoicer
- `Telephone`: Contact phone number
- **Line Items Table**: Markdown table with columns: `Description, Date, Hours, Amount` (or optional `Description, Date, Hours, Rate, Amount` for per-line hourly rates)
- **Expenses Table**: Markdown table with columns: Date, Name, Description, Amount
- **Total**: Calculated automatically from line items and expenses
## Project Structure
```
invoicer/
├── src/
│ ├── cli.mjs # Command-line interface
│ ├── markdownParser.mjs # Markdown to Invoice parser
│ ├── pdfGenerator.mjs # Renders data to PDF (HTML+CSS via Puppeteer)
│ ├── invoiceTemplate.mjs # HTML structure and data only (no styling)
│ ├── spinner.mjs # Loading spinner component
│ └── styles.css # All PDF styling (CSS only)
├── test/ # Test files
├── records/ # Generated PDF output directory
│ └── YYYY/MM/ # Organized by year and month
├── invoice-template.md # Example invoice template
├── package.json
├── tsconfig.json # TypeScript config for type checking
└── README.md
```
## Dependencies
- **puppeteer**: Renders HTML+CSS to PDF (styling is in `src/styles.css` only)
- **dotenv**: Environment variable management
### Dev Dependencies
- **typescript**: TypeScript compiler for type checking
- **@types/node**: Node.js type definitions
## Development
### Scripts
- `npm run lint`: Type check the codebase
- `npm run build`: Compile TypeScript (if applicable)
- `npm test`: Run tests
### Type Checking
The project uses TypeScript for type checking (via JSDoc comments). To check types:
```bash
npm run lint
```
## License
ISC