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