Skip to content

HF6-PROJECT/api

Repository files navigation

Project

Coverage Status

API documentation (Swagger)

Open http://localhost:3000/api/docs to view it in the browser.

Available Scripts

In the project directory, you can run:

make dev

To start the app in dev mode.
Open http://localhost:3000 to view it in the browser.

make prod

Build & runs production.

make test

Run the test cases.

make test-coverage

Run the test cases with code coverage.

make prisma-generate

Generate/regenerate the prisma client. This should be done after changing the prisma schema.

make migrate-dev

Migrate the prisma schema to the database and test database. This should only be run in the dev environment.

make migrate-reset

Clears the database and applies migrations. This should only be run in the dev environment.

make migrate-deploy

Deploys the pending migrations to the databases.

Learn More

To learn Fastify, check out the Fastify documentation.

Setup blob storage connection locally

Install & run ngrok

Head to https://ngrok.com/download and download ngrok for your operating system.

Beware: If you are using WSL on Windows, you can just follow the linux guide and set it up in your WSL.

Now create a ngrok tunnel to your API:

ngrok http 3000

# Example using a static domain. This is highly recommended
ngrok http --domain=healthy-monkey-dancing.ngrok-free.app 3000

I recommend heading to https://dashboard.ngrok.com/cloud-edge/domains and creating a static domain, so you won't have to update your .env file in the web application every time you create a new tunnel.

Setup .env files

API

Set the BLOB_READ_WRITE_TOKEN variable to the one from vercel.

Web

Set the PUBLIC_API_URL variable to the ngrok tunnel url. Example: PUBLIC_API_URL="https://healthy-monkey-dancing.ngrok-free.app/api/"

Generate Ed25519 key pair

openssl genpkey -algorithm ed25519 -out private.pem
openssl pkey -in private.pem -pubout -out public.pem