RozzaysRed / api.opensauced.pizza

API dot Open Sauced is NestJS and SupaBase powered OAS3 backend designed to remove client complexity and provide a structured graph of all @open-sauced integrations

Home Page:https://open-sauced.github.io/api.opensauced.pizza/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Open Sauced

πŸ• Open Sauced Nest Supabase API πŸ•

The path to your next Open Source contribution

DigitalOcean Referral Badge

GitHub code size in bytes GitHub commit activity GitHub issues GitHub Release Discord Twitter

πŸš€ Live release environments

πŸ“– Prerequisites

In order to run the project we need the following software binaries installed on our development machines:

  • node>=16.7.0
  • npm>=8.0.0
  • docker>=20.10.12
  • supabase>=0.18.0

You also need the .env environment file added to your repo for the project to run. To get it, kindly contact @open-sauced/triage team.

Note: For Windows users, the API_HOST key's value in the .env file should be 127.0.0.1, instead of 0.0.0.0, so that the project can run correctly on localhost.

πŸ–₯️ Local development

To install the application:

npm ci

To start a local copy of the app on port 3001:

npm run start:dev

πŸ§ͺ Test

For running the test suite, use the following command. Since the tests run in watch mode by default, some users may encounter errors about too many files being open. In this case, it may be beneficial to install watchman.

npm test

You can request a coverage report by running the following command:

npm run test:coverage

For writing tests, the rule is move business or service logic to the lib folder and write unit tests. Logic that needs to be in a React component, then leverage tools like Cypress or Vitest mocking to write tests.

πŸ“¦ Docker builds

A development preview can also be run from docker:

docker build -t api.opensauced.pizza .
docker run -p 8080:3001 api.opensauced.pizza

Alternatively you can pull the production container and skip all builds:

docker run -dit -p 8080:3001 ghcr.io/open-sauced/api.opensauced.pizza

🎨 Code linting

To check the code and styles quality, use the following command:

npm run lint

This will also display during development, but not break on errors.

To fix the linting errors, use the following command:

npm run format

It is advised to run this command before committing or opening a pull request.

πŸ“• Types

We have a couple of scripts to check and adjust missing types.

In order to dry run what types would be added to package.json:

npm run types:auto-check 

In order to add any missing types to package.json:

npm run types:auto-add

πŸš€ Production deployment

A production deployment is a complete build of the project, including the build of the static assets.

npm run build

πŸ”‘ Database commands

The API is configured to connect to a local Docker backed PostGres instance however you can also connect to a remote Supabase instance by logging in via the UI and copying the connection string from the settings page.

Managing supabase migrations

First thing we have to do for local development is start the studio locally at localhost:54321:

npm run db:start

Make changes

If we are adding a new table structure, first do it visually in the Supabase Studio and test locally.

Check the migration difference with the following command:

npm run db:changes

If everything is fine we can run the following command to apply the changes to the database:

npm run db:commit add_table_name

Test changes

Simplest way to test the migrations are working is to reset the local database:

npm run db:reset

Push changes

If everything is fine we can push the changes to the remote database:

npm run db:push

πŸ”‘ Supabase structure

Click the image to see the schema diagram full documentation.

er

🀝 Contributing

We encourage you to contribute to Open Sauced! Please check out the Contributing guide for guidelines about how to proceed.

πŸ• Community

Got Questions? Join the conversation in our Discord.
Find Open Sauced videos and release overviews on our YouTube Channel.

🎦 Repository Visualization

Below is visual representation of our code repository. It is generated by Octo Repo Visualizer.

This visualization is being updated on release to our default branch by our release workflow.

Visualization of this repository

βš–οΈ LICENSE

MIT Β© Open Sauced

About

API dot Open Sauced is NestJS and SupaBase powered OAS3 backend designed to remove client complexity and provide a structured graph of all @open-sauced integrations

https://open-sauced.github.io/api.opensauced.pizza/

License:MIT License


Languages

Language:TypeScript 92.2%Language:JavaScript 7.0%Language:Dockerfile 0.5%Language:HTML 0.4%