Generate beautiful SVG badges for your Dev.to articles that can be embedded anywhere! Display your article's title, description, cover image, author info, reactions, and reading time in a customizable card format.
- ๐จ Beautiful Design: Clean, modern card design inspired by Tailwind CSS
- ๐ Theme Support: Light and dark mode themes
- ๐ฑ Responsive: Fixed 450x290px size perfect for README files
- ๐ผ๏ธ Cover Images: Automatically includes article cover images
- ๐ค Author Info: Shows author name and profile picture
- ๐ Stats Display: Reactions count and reading time
- ๐ท๏ธ Tags: Displays up to 3 article tags
- ๐๏ธ Customizable Display: Hide specific components as needed
- โก Fast: Serverless function with 1-hour caching
- ๐ Secure: Sanitizes all text content for safe SVG rendering
The project is hosted on Vercel. You can generate badges using these methods:
Add &theme=dark for dark mode:
Hide specific components using the hide parameter:
Available components to hide:
reactions- Hide the reactions counttags- Hide the article tagsminreads- Hide the reading timeimage- Hide the cover image
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
username |
string | Yes* | Dev.to username | muhammadazis |
slug |
string | Yes* | Article slug | a-journey-to-be-a-pragmatic-programmer-524m |
url |
string | Yes* | Full Dev.to article URL | https://dev.to/muhammadazis/a-journey-to-be-a-pragmatic-programmer-524m |
theme |
string | No | Theme mode (light or dark) |
dark |
hide |
string | No | Comma-separated list of components to hide | reactions,tags,minreads,image |
*Either provide username + slug OR url
The hide parameter accepts a comma-separated list of the following values:
reactions- Hides the reactions counttags- Hides the article tagsminreads- Hides the reading timeimage- Hides the cover image
Note: The title and description are mandatory and cannot be hidden.
- Node.js 14.x or higher
- npm or yarn
- Clone the repository:
git clone https://github.com/azis14/devto-badge.git
cd devto-badge- Install dependencies:
npm install- Run locally with Vercel CLI:
npm install -g vercel
vercel devThe API will be available at http://localhost:3000/api
devto-badge/
โโโ api/
โ โโโ index.js # Main serverless function
โโโ package.json # Project dependencies
โโโ .gitignore # Git ignore file
โโโ README.md # This file
The badge design uses Tailwind-inspired color schemes:
- Background:
#ffffff - Border:
#e5e7eb - Title:
#111827 - Description:
#4b5563 - Author:
#374151 - Stats:
#6b7280 - Tags:
#4f46e5
- Background:
#1f2937 - Border:
#374151 - Title:
#f9fafb - Description:
#9ca3af - Author:
#d1d5db - Stats:
#9ca3af - Tags:
#818cf8
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- 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 licensed under the MIT License - see the LICENSE file for details.
- Dev.to API for providing article data
- Vercel for serverless hosting
- Tailwind CSS for design inspiration
- Large cover images may take longer to load
- Some special characters in titles/descriptions may need additional escaping
If you encounter any issues or have questions, please open an issue on GitHub.
If you like this repo or think it useful, please leave a โญ๏ธ on it.
Made with โค๏ธ by the open-source community