A Streamlit-based web dashboard for generating random codes and dummy PDF files. Perfect for testing, development, or generating unique identifiers in bulk.
- CSV Code Generator: Generate unique random codes with customizable formats
- Dummy PDF Generator: Create PDF files with unique codes for testing purposes
- Custom Format Support: Define your own code patterns using placeholders
- Bulk Generation: Generate up to 1,000,000 codes or 100 PDFs at once
- Download Ready: Export as CSV files or ZIP archives
- Python 3.7 or higher
- pip (Python package installer)
-
Clone the repository:
git clone https://github.com/JasonAldeo/code-generator.git cd code-generator -
Install required packages:
pip install -r requirements.txt
Or install packages individually:
pip install streamlit reportlab
-
Start the dashboard:
streamlit run dashboard.py
-
Open your browser: The dashboard will automatically open at
http://localhost:8501 -
Choose your generator type:
- CSV Codes: Generate random codes in CSV format
- Dummy PDFs: Generate PDF files with unique codes
- Pattern:
TVLK#####XXX - Example:
TVLK12345ABC
Use these placeholders to create your own patterns:
| Placeholder | Description | Example |
|---|---|---|
{d:X} |
X random digits | {d:5} → 12345 |
{l:X} |
X random uppercase letters | {l:3} → ABC |
{s:X} |
X random lowercase letters | {s:4} → abcd |
ORDER-{d:6}→ORDER-123456USER_{l:2}{d:4}→USER_AB1234temp_{s:3}-{d:3}→temp_xyz-789
- File:
generated_codes.csv - Format: One code per line
- Use case: Import into databases, spreadsheets, or other applications
- File:
dummy_pdfs.zip - Contents: Individual PDF files named
{prefix}_{code}.pdf - Use case: Testing file processing systems, mock data generation
The dashboard includes:
- Sidebar: Generator type selection and info
- Main Panel: Configuration options and generation controls
- Preview: Live preview of generated codes
- Download: Direct download buttons for generated files
- ✅ Unique Codes: All codes within a batch are guaranteed to be unique
- ✅ Duplicate Detection: Automatic detection and regeneration of duplicates
- ✅ Memory Efficient: Files generated in-memory without temporary storage
- ✅ Scalable: Handle large batches efficiently
-
Module not found error:
pip install --upgrade pip pip install -r requirements.txt
-
Port already in use:
streamlit run dashboard.py --server.port 8502
-
Browser doesn't open automatically: Manually navigate to
http://localhost:8501
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Jason Aldeo
- GitHub: @JasonAldeo
- Email: jason.leonard@traveloka.com
⭐ If you found this project helpful, please give it a star!