Projects
Horus Heresy API
19 November 2025

Horus Heresy API

Next.js
typescript
React
API
Documentation
Sanity
The Horus Heresy API is my first ever public REST API made entirely in Nextjs and with a PostgreSQL database.
The project came about roughly two years ago when i started truly get a grasp of NextJS and the whole Frontend Backend in the same app idea.
My exposure of backends at the time where mostly public REST api's and it seemed fairly straight forward. So I went ahead and published it.
The first version was extremely bare bones. I had about 4 different routes in which a user might be able to get some data. And just one parameter to get a list of allegiances.
Fairly boring, nothing special. The project was just dormant, deployed sure, but maybe 2 weekly visitors.
But then I had my interview for Volvo Group and showed off this project and possibly due to my API documentation I landed the role.
So i picked it up again, rewrote almost the entire project which was extremely fun.
The first major change is the version of Nextjs a steep upgrade from 12's handling of data to 14. API pages looks pretty much the same, its just controlled like the app router is and you adopt this kind of folder structure.
/app/api/legions/{id}/route.ts
The other major change I made is how I fetched and presented the data in the /examples page.
With the things I have learned about Next.js over the years it was incredibly easy to fetch on the server and pass that down to several child components, something I was struggling with with my first iteration.
horus heresy api examples page
Another notable addition is the API documentation and the News page which both use Sanity to present up to date information about how to use the API. It was a real challenge making those schemas but I got a lot of real world experience from my internship that helped me along the way.
Something new I learned during this project was the automatic generation of metadata and JSON-LD that Next.js supports. It was a blast finally getting to try making my tiny hobby-project have that sort of level of extensive SEO behind it. And figuring out the logic was a blast.
Here is a little snippet of some of the WebAPI schema generators looks like.
// Generate WebAPI schema for individual endpoints
export function generateWebApiSchema(endpoint: EndpointInfo, baseUrl: string) {
	return {
		"@context": "https://schema.org",
		"@type": "WebAPI",
		name: `${endpoint.method} ${endpoint.path}`,
		description: endpoint.description,
		url: `${baseUrl}${endpoint.path}`,
		documentation: `${baseUrl}/api-docs`,
		provider: {
			"@type": "Organization",
			name: "Horus Heresy API",
		},
		potentialAction: {
			"@type": "SearchAction",
			target: {
				"@type": "EntryPoint",
				urlTemplate: `${baseUrl}${endpoint.path}`,
				httpMethod: endpoint.method,
			},
		},
	};
}
Another really difficult choice I had was how to rate limit this thing. When you are making smaller hobby project you never expect someone to abuse something, but this is going out there on the real web and I hope for people to visit.
So a major think i chose is to include an API key, this of course greatly limits the amount of users I get, but It saves me from receiving any massive Vercel bill.
In the end, I'm very proud of the project. I learned a lot and had lots of fun. Warhammer is something I'm really passionate about and I hope, with this public REST API, that I can share some of my passion.
Projects

© 2025 Rasmus Bremholm