Backend for Frontend Edition
A modern, frontend-friendly Star Wars API with aggregation, expand, filtering and pagination. Educational backend for frontend developers.
Based on SWAPI with extended metadata
Most Star Wars APIs are data-oriented, not UI-oriented. This API uses the Backend for Frontend (BFF) pattern to eliminate waterfall requests.
GET /people/1 # Luke SkywalkerGET /planets/1 # TatooineGET /films/1 # A New HopeGET /films/2 # Empire Strikes BackGET /films/3 # Return of the Jedi
GET https://sw-next-api.vercel.app/api/v1/people/1?expand=homeworld,films1 request includes:
GET https://sw-next-api.vercel.app/api/v1/people/1GET https://sw-next-api.vercel.app/api/v1/people/1?expand=homeworldGET https://sw-next-api.vercel.app/api/v1/people/1?expand=films.characters
GET https://sw-next-api.vercel.app/api/v1/people?page=2&limit=10{
"page": 2,
"limit": 10,
"total": 82,
"pages": 9,
"results": [...]
}GET https://sw-next-api.vercel.app/api/v1/people?search=lukeGET https://sw-next-api.vercel.app/api/v1/people?gender=femaleGET https://sw-next-api.vercel.app/api/v1/people?sort=-name
Characters from the Star Wars universe
All Star Wars films
Planets and locations
Species and alien races
Starships and space vessels
Ground and atmospheric vehicles
Minimal Projections (default)
Related entities return as minimal objects with entityId, id (slug), and name/title
camelCase naming
All fields use camelCase (heightCm, birthYearBBY) with proper types (numbers, not strings)
http://localhost:3000https://sw-next-api.vercel.appAdd base URL to all requests: https://sw-next-api.vercel.app/api/v1/people/1
Returns normalized data with minimal projections for related entities
GET https://sw-next-api.vercel.app/api/v1/people/1{
"entityId": 1,
"id": "luke-skywalker",
"name": "Luke Skywalker",
"heightCm": 172,
"massKg": 77,
"birthYearBBY": -19,
"gender": "male",
"homeworld": {
"entityId": 1,
"id": "tatooine",
"name": "Tatooine"
},
"films": [
{ "entityId": 1, "id": "a-new-hope", "title": "A New Hope", "episode": 4 },
{ "entityId": 2, "id": "the-empire-strikes-back", "title": "The Empire Strikes Back", "episode": 5 },
{ "entityId": 3, "id": "return-of-the-jedi", "title": "Return of the Jedi", "episode": 6 },
{ "entityId": 6, "id": "revenge-of-the-sith", "title": "Revenge of the Sith", "episode": 3 }
],
"species": [],
"vehicles": [
{ "entityId": 14, "id": "snowspeeder", "name": "Snowspeeder" },
{ "entityId": 30, "id": "imperial-speeder-bike", "name": "Imperial Speeder Bike" }
],
"starships": [
{ "entityId": 12, "id": "x-wing", "name": "X-wing" },
{ "entityId": 22, "id": "imperial-shuttle", "name": "Imperial shuttle" }
],
"meta": {
"isForceUser": true,
"isJedi": true,
"isSith": false,
"faction": "rebels"
}
}Unlike SWAPI, this API includes additional metadata for richer queries and filtering
Track Force users with isForceUser, isJedi, isSith
Filter by faction: rebels, empire, republic, separatists, civilian
GET https://sw-next-api.vercel.app/api/v1/people?isJedi=trueGET https://sw-next-api.vercel.app/api/v1/people?faction=rebels
Classify ships as military or civilian with is_military
Track which faction operates each vessel
GET https://sw-next-api.vercel.app/api/v1/starships?faction=empire&is_military=trueFind Imperial military ships