🧑‍💻 Developer Guide

A practical guide for developers working on the Signposting Toolkit.


1. Overview

The Signposting Toolkit is a Next.js + Prisma + Neon Postgres + Vercel web application designed for GP surgeries.

This guide explains:

It is written for developers joining the project or returning to it after a break.


2. Project Architecture


signposting/

├── docs/                     → Public GitHub Pages documentation

│   └── wiki/

├── prisma/                   → Prisma schema + migrations

│   └── seed.ts               → Database seed

├── src/

│   ├── app/                  → Next.js App Router (pages, routes, UI)

│   ├── components/           → Reusable React components

│   ├── lib/                  → Utilities (RBAC, highlight engine, auth helpers)

│   └── server/               → Server-side logic (actions & services)

├── public/                   → Static assets

├── .env.local                → Local environment variables (not committed)

└── package.json


3. Requirements

Install:


4. Environment Variables

Create a file:

.env.local

Required variables (safe placeholders shown):

DATABASE_URL="postgres://user:password@host/db"
NEXTAUTH_SECRET="development-secret"
NEXTAUTH_URL="http://localhost:3000"

When running locally, Neon or Docker Postgres works fine.

Important:


5. Running the Application Locally

Install dependencies:

pnpm install

Run dev server:

pnpm dev

Visit:

http://localhost:3000

You should see the main signposting homepage.


6. Database Management (Prisma)

Check database connection

pnpm prisma migrate status

Push schema changes (local only)

pnpm prisma db push

Run migrations

pnpm prisma migrate dev

Open Prisma Studio

pnpm prisma studio

Use this for inspecting local data while developing.


7. Seeding the Database

Minimal seed (recommended for development)

pnpm seed:minimal

Full seed (production-like data)

pnpm seed

Reset database and reseed

pnpm prisma migrate reset

This wipes all tables and re-runs the seed files.


8. API Routes and Server Actions — Where Logic Lives

The app uses modern Next.js App Router patterns.

Area Location
Symptom logic src/server/symptoms/
Highlight engine src/lib/highlighting/
AI features src/server/ai/
Admin logic src/server/admin/
RBAC model src/lib/rbac.ts
Appointment directory src/server/appointments/

9. Authentication & RBAC

The app uses a simple but robust RBAC model:

Authentication is handled through a lightweight session-based system.

No part of the application should rely on email-based permissions.

All checks should use RBAC helpers, for example:

if (!can(user).isSuperuser()) {
  // deny access
}

10. Highlighting Engine (Summary)

The highlighting engine scans symptom instructions and applies formatting rules:

The implementation lives in:

src/lib/highlighting/


11. AI Tools (Instruction Editor & Question Generator)

AI features are optional, and fully reviewed by clinicians before going live.

AI endpoints and utilities live under:

src/server/ai/

The system supports:


12. Local Testing Accounts

The seed scripts automatically generate test users, including:

Passwords are output by the seed script.

No real email addresses are used in seeds.


13. Coding Conventions

Linting

pnpm lint

Formatting

pnpm format

Type checks

pnpm typecheck

Follow the existing code style and prefer small, focused pull requests.


14. Deployment Workflow

Production hosting

Production deployments occur via Vercel:

Documentation hosting

Documentation is deployed on:

https://docs.signpostingtool.co.uk

via GitHub Pages with source folder /docs.

Important DNS note

DNS is managed entirely via Cloudflare, not Fasthosts.

Do not suggest changing Fasthosts DNS in future instructions.


15. Conventions for Contributions


16. Support & Contact

For onboarding, demos, or technical questions:

contact@signpostingtool.co.uk


17. Appendix: Architecture Diagram (ASCII)

               ┌────────────────────┐
               │      Browser       │
               └─────────┬──────────┘
                         │
                Next.js App Router
                         │
       ┌─────────────────┴─────────────────┐
       │                                   │
Server Actions                    API Routes (REST-style)
       │                                   │
       └──────────────┬────────────────────┘
                      │
                 Business Logic
                      │
       ┌──────────────┴────────────────┬─────────────┐
       │                               │             │
Symptom Engine                  Highlight Engine   AI Tools
       │                               │             │
       └───────────────────────────────┴─────────────┘
                      │
                   Prisma
                      │
                 Neon Postgres