REST API for OSM Notes Analytics and Ingestion. Unified programmatic access to user profiles, country analytics, advanced search capabilities, rankings, comparisons, and real-time metrics. Extends OSM API 0.6 with specialized analytics features.
OSM Notes API provides programmatic access to OpenStreetMap notes analytics data, including:
- User Profiles: Detailed statistics of contributors
- Country Analytics: Aggregated metrics by country
- Advanced Search: Complex filters and dynamic queries
- Rankings: User and country classifications
- Comparisons: Comparative analysis between entities
- Trends: Temporal data analysis
- Notes and Comments: Access to OSM notes and their comments
This API is COMPLEMENTARY to the static JSON system, NOT a replacement.
- β JSON system maintained: The Viewer and other consumers continue using static JSON files
- β API is additional: For use cases requiring dynamic queries or integrations
- β Both coexist: Each system is used according to the specific use case
- Node.js >= 18.0.0
- npm >= 9.0.0
- PostgreSQL 15+ (with access to
osm_notes_dwh) - Redis 7+ (optional but recommended)
# Clone repository
git clone https://github.com/osmlatam/OSM-Notes-API.git
cd OSM-Notes-API
# Install dependencies
npm install
# Configure environment variables
cp .env.example .env
# Edit .env with your configurations
# Build TypeScript
npm run build
# Start application
npm start# Start services
docker-compose -f docker/docker-compose.yml up -d
# View logs
docker-compose -f docker/docker-compose.yml logs -f apiSee docs/INSTALLATION.md for detailed instructions.
Health Check:
curl -H "User-Agent: MyApp/1.0 (contact@example.com)" \
http://localhost:3000/healthGet a Note:
curl -H "User-Agent: MyApp/1.0 (contact@example.com)" \
http://localhost:3000/api/v1/notes/12345Search Notes:
curl -H "User-Agent: MyApp/1.0 (contact@example.com)" \
"http://localhost:3000/api/v1/notes?status=open&country=42&limit=10"Get User Profile:
curl -H "User-Agent: MyApp/1.0 (contact@example.com)" \
http://localhost:3000/api/v1/users/12345Get Country Profile:
curl -H "User-Agent: MyApp/1.0 (contact@example.com)" \
http://localhost:3000/api/v1/countries/42Get Global Analytics:
curl -H "User-Agent: MyApp/1.0 (contact@example.com)" \
http://localhost:3000/api/v1/analytics/globalInteractive API Documentation:
- Swagger UI:
http://localhost:3000/docs - OpenAPI JSON:
http://localhost:3000/docs/json
See docs/USAGE.md for complete usage guide.
- Installation - Complete installation guide
- Usage - API usage manual
- API Reference - OpenAPI/Swagger documentation
- Contributing - Contributor guide
- Changelog - Change history
OSM-Notes-API/
βββ src/ # Source code
β βββ config/ # Configuration
β βββ routes/ # API routes
β βββ controllers/ # Controllers
β βββ services/ # Business logic
β βββ middleware/ # Custom middleware
β βββ utils/ # Utilities
β βββ types/ # TypeScript types
βββ tests/ # Tests
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
β βββ load/ # Load tests
βββ docs/ # Documentation
β βββ INSTALLATION.md # Installation manual
β βββ USAGE.md # Usage manual
β βββ api/ # OpenAPI documentation
βββ docker/ # Docker configuration
βββ package.json # Dependencies and scripts
npm run build # Build TypeScript
npm start # Run compiled application
npm run dev # Development with hot reload
npm test # Run all tests
npm run test:unit # Unit tests only
npm run test:integration # Integration tests only
npm run test:coverage # Tests with coverage report
npm run test:watch # Run tests in watch mode
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint errors automatically
npm run format # Format code with Prettier
npm run format:check # Check code formatting
npm run type-check # Verify TypeScript types- User-Agent required: All requests must include a valid User-Agent with format
AppName/Version (Contact) - Rate Limiting: 50 requests/15min for anonymous users
- Anti-abuse protection: Automatic blocking of known AIs and bots
- Optional OAuth: Available for advanced features (Phase 5)
See docs/USAGE.md for more security details.
Version: 0.1.0 (MVP - Phase 1)
Implementation Phases:
- β
Phase 1: MVP (Core endpoints, basic features, documentation)
- β Notes endpoints (get, search, comments)
- β User profiles endpoint
- β Country profiles endpoint
- β Global analytics endpoint
- β User-Agent validation
- β Rate limiting
- β Anti-abuse protection
- β OpenAPI/Swagger documentation
- β Comprehensive integration tests
- β³ Phase 2: Basic Features (Rankings, comparisons, trends)
- β³ Phase 3: Advanced Features (Advanced search, caching, performance)
- β³ Phase 4: Production (CI/CD, monitoring, scaling)
- β³ Phase 5: Webhooks and Notifications (if needed)
Contributions are welcome. Please read CONTRIBUTING.md for details on our code of conduct and pull request process.
This project is licensed under the MIT License - see LICENSE for details.
For questions or support, please open an issue on GitHub.
Note: This project is part of the OSM Notes ecosystem and is designed to work together with the other projects in the ecosystem.