• Stars
    star
    486
  • Rank 90,527 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

REST API to access D&D 5th Edition SRD database

5e-srd-api

Build Status Uptime Uptime

Discord

REST API to access D&D 5th Edition SRD API

Talk to us on Discord!

How to Run

You can make sure you have the latest version of the database by running:

docker-compose pull

Then run it with docker-compose:

docker-compose up --build

Make API requests by using the root address: http://localhost:3000/api/

You should get a response with the available endpoints for the root:

{
  "ability-scores": "/api/ability-scores",
  "classes": "/api/classes",
  "conditions": "/api/conditions",
  "damage-types": "/api/damage-types",
  "equipment-categories": "/api/equipment-categories",
  "equipment": "/api/equipment",
  "features": "/api/features",
  "languages": "/api/languages",
  "magic-schools": "/api/magic-schools",
  "monsters": "/api/monsters",
  "proficiencies": "/api/proficiencies",
  "races": "/api/races",
  "skills": "/api/skills",
  "spells": "/api/spells",
  "subclasses": "/api/subclasses",
  "subraces": "/api/subraces",
  "traits": "/api/traits",
  "weapon-properties": "/api/weapon-properties"
}

Using a local image of 5e Database

If you are working on a feature which requires changes to both this repo, and the 5e-database repo, it is useful to know how to connect the former to the latter for testing purposes. A simple process for doing so is as follows:

  1. In the file docker-compose.yml, you can replace the line image: bagelbits/5e-database with build: [relativePathToDatabaseRepo]. Make sure not to commit this change, as it is intended for local testing only.

  2. Run your branch of 5e-srd-api using the method outlined in the above section of this readme file. So long as there are no transient errors, the API should build successfully, and your changes to both repos should be noticeable.

Data Issues

If you see anything wrong with the data itself, please open an issue or PR over here.

Running Tests

Unit Tests

You can run unit tests locally by using the command: npm run test:unit

Integration Tests

Integration tests need to be ran in the API docker container for them to function properly. In order to run integration tests locally you can use the command: npm run test:integration:local

Documentation

Public facing API documentation lives here: https://www.dnd5eapi.co/docs.

We use RapiDoc to create the documentation UI from a bundled single file OpenAPI definition created as part of the npm run build task.

Additional details and information on working with the documentation can be found in the /swagger directory's README.

Contributing

  • Fork this repository
  • Create a new branch for your work
  • Push up any changes to your branch, and open a pull request. Don't feel it needs to be perfect — incomplete work is totally fine. We'd love to help get it ready for merging.

Code of Conduct

The Code of Conduct for this repo can be found here.

Contributors