Generic Open Data Backend
Store, serve, and manage any type of data with flexible JSON structures, JWT authentication, and a RESTful API design.
Store any type of data using JSON-based structures with categories and types
Secure API with access and refresh tokens, role-based access control
Clean, intuitive endpoints following REST principles with consistent responses
Data is publicly accessible, perfect for open data projects and APIs
Clear documentation, example requests, and consistent response formats
Open-source, MIT licensed, deployment-ready configuration
Data Hub API is a generic open data backend designed to store and serve ANY type of data using categories and flexible JSON structures. The API is designed to be consumed by web apps, mobile apps, dashboards, and external services.
The Data Hub API uses JWT (JSON Web Tokens) for authentication. Public endpoints (GET requests) do not require authentication. Write operations (POST, PUT, DELETE) require an access token with admin role.
/api/auth/loginAuthenticate with username and password
🔒 Admin Only
/api/auth/refreshRefresh access token using refresh token
🔒 Admin Only
/api/auth/logoutLogout current session
🔒 Admin Only
/api/dataGet all data entries (public read access)
Query Params: Optional: categoryId, typeId (query params)
✓ Public Access
/api/data/:idGet data entry by ID (public read access)
✓ Public Access
/api/dataCreate new data entry (admin only)
Request Body: Required: categoryId, typeId, title, content
🔒 Admin Only
/api/data/:idUpdate data entry (admin only)
Request Body: Optional: categoryId, typeId, title, content, source
🔒 Admin Only
/api/data/:idDelete data entry (admin only)
🔒 Admin Only
/api/categoriesGet all categories (public read access)
✓ Public Access
/api/typesGet all data types (public read access)
✓ Public Access
curl -X POST https://your-domain.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "JabesNelma",
"password": "your-password"
}'curl https://your-domain.com/api/datacurl -X POST https://your-domain.com/api/data \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"categoryId": "category-id",
"typeId": "type-id",
"title": "My Data Entry",
"content": {
"key": "value",
"nested": {
"data": "here"
}
},
"source": "example"
}'// Get all data (public)
const response = await fetch('https://your-domain.com/api/data');
const { success, data, message } = await response.json();
if (success) {
console.log('Data entries:', data);
}
// Create data entry (requires admin token)
const createResponse = await fetch('https://your-domain.com/api/data', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
body: JSON.stringify({
categoryId: 'category-id',
typeId: 'type-id',
title: 'New Entry',
content: { key: 'value' },
source: 'my-app'
})
});
const result = await createResponse.json();Use the seed endpoint to create your first admin user:
curl -X POST http://localhost:3000/api/admin/seed \
-H "Content-Type: application/json" \
-d '{
"email": "admin@example.com",
"password": "secure-password",
"seedKey": "admin-setup-key"
}'Login with your admin credentials, get your access token, and start managing data entries.
All API responses follow a consistent format:
{
"success": true,
"data": { ... },
"message": "Operation completed successfully"
}success: Boolean indicating if the request was successful
data: Response data (varies by endpoint)
message: Descriptive message about the operation