Commons API Master is an Express.js + PostgreSQL backend that powers the Commons Master React frontend. It provides secure, filtered access to Canadian federal legislative data, including bill status, sessions, and machine-learned categories via uClassify.
Frontend: https://commons-app.netlify.app
Backend: (deployed via Render, Railway, or local environment)
- 📜 Fetch Canadian federal bills from LegisInfo
- 🧠 Assign categories using uClassify API
- 🧮 Filter by status (active/passed), session, house, category
- 🔒 Secure login/registration via JWT
- 💾 PostgreSQL-backed storage
- 🌐 RESTful API used by the Commons Master frontend
GET /api/billsQuery parameters:
status=active|passedsession=43-1senateHouse=senate|commonscategory=<uClassify category>limit,offset
GET /api/bills/:idReturns a single bill by its unique ID.
GET /api/categoriesReturns a list of all available categories.
POST /api/auth/register
POST /api/auth/loginReturns JWT on success.
Protected routes require:
Authorization: Bearer <token>
- Node.js + Express
- PostgreSQL via
pg - Sequelize ORM
- JWT-based auth
- CORS + Helmet + Rate Limiters
- uClassify API for category classification
git clone https://github.com/mxmitch/commons-api-master.git
cd commons-api-master
npm installCreate a .env file in the root with:
PORT=5000
DATABASE_URL=postgres://<username>:<password>@<host>:<port>/<db>
JWT_SECRET=your_secret_key
UCLASSIFY_API_KEY=your_uclassify_api_keynpm run devTests coming soon.
- Works well on Render, Railway, or Heroku
- Ensure the database is seeded before launch
- Add environment variables in the deploy settings
.
├── routes/ # billRoutes, authRoutes, categoryRoutes
├── models/ # Sequelize models (Bill, User)
├── middleware/ # Auth, rate limiting, etc.
├── services/ # uClassify integration
└── index.js # Entry point
MIT — see LICENSE
Built by @mxmitch as part of the Commons Master project
Original legislative source: parl.ca/legisinfo
Classification powered by uClassify