The Star Wars API (SWAPI), reimplemented in Elixir.
This project aims to be almost fully compatible with the original API (https://swapi.dev/), including pagination and search query parameters.
The following software is required for local development:
- Elixir 1.15
- Erlang/OTP 26
- NodeJS 18+
To start the server locally, follow these steps:
- Run
yarn
inside folderassets
to install JavaScript dependencies - Run
mix setup
to install and setup dependencies - Start the API endpoint with
mix phx.server
or inside IEx withiex -S mix phx.server
Now you can visit localhost:4000
from your browser.
The server can also be started under Docker by running docker compose -f dev/docker-compose.yml up
. When started, the API will be accessible under the same port as when running locally (localhost:4000
).
The Postman collection is stored in priv/static/downloads/swapi.postman_collection.json
. Whenever the API documentation changes, the collection should be updated to match.
You can generate a new collection file as follows:
- Start the server.
- Click "Import" in the workspace sidebar in Postman, enter the URL to the OpenAPI doc, e.g.
http://localhost:4000/api/openapi
and import the API as a Postman collection. - Open the "Elixir SWAPI" collection, go to the Variables tab in the main pane and change the
baseUrl
variable tohttps://swapi.profiq.com
. - Right-click the "Elixir SWAPI" collection, click "Export" and choose the Collection 2.1 format.
- Copy the exported collection to
priv/static/downloads/swapi.postman_collection.json
.