A modern REST API built with Deno, TypeScript, and Hono that serves Philippine Congress data from a Neo4j graph database. Features auto-generated OpenAPI documentation via Swagger UI. Based on data from the bettergovph/open-congress-data repository.
- Runtime: Deno 2.x
- Framework: Hono 4.x
- API Docs: @hono/zod-openapi + Swagger UI
- Validation: Zod
- Database: Neo4j 5.x
- Deno
- Neo4j with bettergovph/open-congress-data set up
Start the development server:
deno task startThe API will be available at http://localhost:8000
- API:
http://localhost:8000/api/*- REST API endpoints - Scalar Docs:
http://localhost:8000/api/scalar- Beautiful API documentation powered by Scalar - Swagger UI:
http://localhost:8000/api- Interactive API documentation - OpenAPI Spec:
http://localhost:8000/api/doc- OpenAPI 3.0 JSON specification
- Home:
http://localhost:8000/- Landing page with quick access links - Congresses:
http://localhost:8000/view/congresses- Browse all Philippine congresses with statistics - Congress Detail:
http://localhost:8000/view/congresses/{congressNumber}- View senators and representatives for a specific congress - Documents:
http://localhost:8000/view/documents- Browse and search legislative documents (House Bills and Senate Bills) - Document Detail:
http://localhost:8000/view/documents/{documentId}- View individual document details, authors, and metadata - People:
http://localhost:8000/view/people- Browse senators and representatives with filtering - Person Detail:
http://localhost:8000/view/people/{personId}- View individual legislator profiles, congress memberships, and authored bills
The application includes a modern web interface for browsing Philippine Congress data:
- Responsive Design: Built with Tailwind CSS, mobile-friendly layouts
- Search & Filters: Filter documents by congress, type, scope; filter people by congress, type, name
- Sortable Tables: Click column headers to sort data
- Detailed Views: Individual pages for each congress, document, and person with complete metadata
- Congress Cards: Visual representation of Senate vs House members and bills filed
- Breadcrumb Navigation: Easy navigation between related pages
- Direct Links: Copy IDs, view API data, access original source documents
All API endpoints are automatically documented using @hono/zod-openapi.
-
Scalar (
/api/scalar) - Modern, beautiful API documentation with:- Clean, responsive design
- Dark mode support
- Code examples in multiple languages
- Interactive API testing
- Superior UX for browsing large APIs
-
Swagger UI (
/api) - Classic API explorer with:- Interactive API explorer
- Request/response schemas with examples
- Type-safe request validation via Zod
- Try-it-out functionality for testing endpoints
To publish your API to Scalar Galaxy (Scalar's API registry):
- Visit https://galaxy.scalar.com/
- Sign up or log in
- Click "Add API" or "Import API"
- Provide your OpenAPI spec URL:
https://your-domain.com/api/doc - Configure API details (name, description, visibility)
- Publish
Your API will be discoverable in Scalar's public registry and get a shareable documentation URL.
Each route file (routes/*.ts) includes comprehensive inline documentation of the Neo4j Cypher queries used:
/**
* GET /congresses
*
* Purpose: List all Philippine congresses with pagination
*
* Neo4j Query:
* - Matches: All Congress nodes
* - Filters: year (start_year/end_year range), ordinal
* - Returns: Congress properties sorted by congress_number DESC
* - Pagination: SKIP offset LIMIT limit
*
* Example: GET /api/congresses?year=2022&limit=10
*/The API queries a Neo4j graph database with the following structure:
- Congress - Congressional sessions (e.g., 20th Congress)
- Group - Chambers (Senate or House of Representatives) within each congress
- Person - Senators and Representatives
- Committee - Congressional committees
- Document - Legislative bills (subtype: HB or SB)
(Person)-[:MEMBER_OF]->(Group)- Person is a member of a chamber (Senate or House)(Group)-[:BELONGS_TO]->(Congress)- Chamber belongs to a congress(Person)-[:AUTHORED]->(Document)- Person authored a bill(Committee)-[:BELONGS_TO]->(Congress)- Committee belongs to a congress(Document)-[:FILED_IN]->(Congress)- Bill was filed in a congress
Note: There is no direct Person-to-Congress relationship. To find which congress a person served in, traverse through the Group (chamber) node: Person → MEMBER_OF → Group → BELONGS_TO → Congress
All Neo4j queries are documented in the route files:
routes/congresses.ts- Congress-related queriesroutes/people.ts- Person-related queriesroutes/bills.ts- Bill-related queriesroutes/stats.ts- Statistics queries
Web UI routes are implemented using server-side rendering with Hono:
routes/view/congresses.tsx- Congress list and detail pagesroutes/view/documents.tsx- Document list pageroutes/view/document-detail.tsx- Document detail pageroutes/view/people.tsx- People list pageroutes/view/person-detail.tsx- Person detail pagecomponents/Layout.tsx- Shared header and footer componentscomponents/LandingPage.tsx- Home page
We want your help. No, really.
There may be a little voice inside your head that is telling you that you're not ready to be an open source contributor; that your skills aren't nearly good enough to contribute. What could you possibly offer a project like this one?
We assure you - the little voice in your head is wrong. If you can write code at all, you can contribute code to open source. Contributing to open source projects is a fantastic way to advance one's coding skills. Writing perfect code isn't the measure of a good developer (that would disqualify all of us!); it's trying to create something, making mistakes, and learning from those mistakes. That's how we all improve, and we are happy to help others learn.
Being an open source contributor doesn't just mean writing code, either. You can help out by writing documentation, tests, or even giving feedback about the project (and yes - that includes giving feedback about the contribution process). Some of these contributions may be the most valuable to the project as a whole, because you're coming to the project with fresh eyes, so you can see the errors and assumptions that seasoned contributors have glossed over.
Remember:
- No contribution is too small
- Everyone started somewhere
- Questions are welcome
- Mistakes are learning opportunities
- Your perspective is valuable
(Impostor syndrome disclaimer adapted from Adrienne Friend)
This repository is dedicated to the public domain under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication.
You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
- No Copyright
- No Rights Reserved
- No Attribution Required
For more information, see the CC0 1.0 Universal license.