REST API for browsing NHS-prescription data (BNF taxonomy: Chapters → Sections → Paragraphs → Chemical Substances + stats).
- Read-only endpoints for:
- 📖 Chapters
 - 📑 Sections
 - 📝 Paragraphs
 - ⚗️ Chemical Substances
 
 - Input validation for query and route parameters
 - Consistent error and status policy
 - Pagination and search for large datasets
 
🚧 Work in Progress
- ✅ Read-only endpoints implemented for (BNF) chapters, sections, paragraphs, substances
 - ✅ Input validation for query and route parameters
 - ✅ Consistent status code policy (
200,400,404,500) - 🔜 Read-only endpoints for chemical substance stats
 - 🔜 Rate limiting
 
- Node.js + Express
 - Prisma ORM with PostgreSQL
 - Middleware: Helmet (security), Compression (performance)
 - Validation: Custom validators (
validateCode,validateInt, etc.) 
# Clone repo
git clone https://github.com/juliadyrdal/prescripta-api.git
cd prescripta-api
# Install dependencies
npm install
# Environment setup
cp .env.example .env  
# Run locally
npm run dev 
# Server will run at
http://localhost:3000GET /api/chapters– List all chaptersGET /api/chapters/:code– Fetch a single chapterGET /api/chapters/:code/sections– List sections in a chapter
GET /api/sections– List all sectionsGET /api/sections/:code– Fetch a single sectionGET /api/sections/:code/paragraphs– List paragraphs in a section
GET /api/paragraphs– List all paragraphsGET /api/paragraphs/:code– Fetch a single paragraphGET /api/paragraphs/:code/substances– List substances in a paragraph
GET /api/substances– List substances (with filters)- Query parameters:
search→ Text search on substance nameskip→ Pagination offset (default:0)take→ Pagination limit (default:20, max:100)
 
- Query parameters: