Giter VIP home page Giter VIP logo

nestjs-spells-api's Introduction

NestJS Spell API

Nest Logo

This simple API serves homebrewed spells for my campaigns of Dungeons & Dragons 5th Edition. It is built with NestJS, a framework for building efficient, scalable Node.js server-side applications.

This application is yours to use, modify and distribute as you see fit.

Installation

First, clone this project (HTTPS):

git clone https://github.com/NicoToff/nestjs-spells-api.git

Or (SSH):

git clone [email protected]:NicoToff/nestjs-spells-api.git

Run the app

Development mode

This project use pnpm as package manager. If you need to install it on your system, follow their installation guide.

Install the dependencies:

pnpm install
pnpm dev

You are going to need some API keys to use POST routes and populate your database. The API keys must be in UUID format and are expected to be stored in ENV variables under "API_KEYS" (comma-separated).

A dev-script convieniently creates a .env file for you with random API keys:

pnpm keys:gen --create-env

Then, in local dev environment, these keys are automatically pulled from the .env file directly.

Docker

The project contains a working Dockerfile. Provided you have Docker installed, as well as docker-compose, you can build and run the image with the following command:

docker-compose up -d --build

docker-compose is needed to set up ENV variables for the container.

Fly.io

My personal instance of this API is hosted on Fly.io. If you wish to also deploy this app through them, you'll find a fly.toml file in the repo that you can tailor to your needs.

Authenticate to Fly.io with:

flyctl auth login

You can deploy your own instance with the following command:

pnpm depl

This command will automically set secrets to your Fly.io instance.

If you only wish to create and push new API keys, run:

pnpm keys:gen && pnpm keys:sync

Whichever hosting provider you choose, you'll need to provide API keys as ENV variables.

Fly.io FAQ

You might run into this error:

Error: failed to update VM <id>: You have reached the maximum number of machines for this app.

Fly.io has a free tier that allows you to run 3 VMs at a time, but they also automatically provide redundancy when deploying your app. This means you end up with 2 machines for a single deployment, plus the auto-created "Free builder" => Max limit is indeed reached.

You can either upgrade your plan, or simply limit the number of VMs to 1 for all your apps by running:

fly scale count 1

nestjs-spells-api's People

Contributors

nicotoff avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.