CounterAPI is a fully self-hosted API service to track how many times your projects are used. Powered by FastAPI and SQLite, it's ideal for hobby projects, dev dashboards, or lightweight analytics.
- 🔁 Track project usage with simple HTTP pings
- 🧓 View all counters in a clean JSON format
- 🛠️ Full CRUD: Add, edit, rename, or delete projects
- 📂 Persistent storage using SQLite (file-based)
- 🚀 One-click deploy to Render (completely free)
- 🧪 Comes with Postman Collection for quick testing
- 🛡️ Automatically configures GitHub Wiki fallback for docs
- Frontend (optional): Single-page UI served from Render (index.html)
- Backend: FastAPI app handling all API routes
- Database: Local SQLite (
counters.db
) - Hosting: Render.com (Free tier)
- Deployment: Done via
render.yaml
auto-detected during setup
Click the Fork button and clone it locally:
git clone https://github.com/your-username/CounterAPI.git
cd CounterAPI
Install dependencies:
pip install -r requirements.txt
Start the dev server:
uvicorn main:app --reload
Now open: http://localhost:8000/projects
Just click this button:
Render will:
- Detect
render.yaml
- Ask for a custom web service name (e.g.
yourname-counterapi
) - Deploy it with persistent SQLite database
Once deployed, your base URL will be:
https://<your-custom-name>.onrender.com
POST /projects
{
"name": "my-cool-app",
"description": "My test project"
}
PUT /projects
{
"name": "my-cool-app",
"new_name": "my-updated-app",
"description": "Updated desc"
}
DELETE /projects
{
"name": "my-cool-app"
}
POST /ping
{
"name": "my-cool-app"
}
GET /projects
All endpoints return a JSON response. If a project is not found, a helpful error message with a link to the Wiki is returned automatically.
CounterAPI/
├── main.py # FastAPI logic
├── database.py # SQLite setup
├── requirements.txt # Python dependencies
├── render.yaml # Render deployment descriptor
├── index.html # UI frontend (served by backend)
├── architecture.md # Mermaid diagrams + explanations
├── todo.md # Planned roadmap
└── counters.db # SQLite file (auto-created)
No .env
is required unless you want to override defaults.
Optional environment variables:
Name | Description |
---|---|
RENDER_GIT_REPO_SLUG |
Auto-detected by Render (used for error links) |
RENDER_EXTERNAL_URL |
Auto-detected public API base URL |
We provide a ready-made Postman collection to test all endpoints.
- Download
CounterAPI.postman_collection.json
- Change the
base_url
at the bottom of the file from: - Open Postman
- Click Import → Upload Files → Select the JSON file
- After import, go to the "Variables" tab inside the collection
https://projectcounter.onrender.com
to your own deployed URL, such as:
https://your-custom-name.onrender.com
Now you're ready to test all API routes directly! ✅
- 🐍 Python 3.x
- ⚡ FastAPI
- 📓 SQLite
- ☁️ Render.com
Apache 2.0 – Free for personal, educational, and commercial use.
This project is forkable and beginner-friendly. Feel free to tweak, star, or fork it to build your own tracker!