Giter Club home page Giter Club logo

hoppscotch-backend's Introduction

Hoppscotch Backend API

This repository contains an open-source implementation of the Hoppscotch Backend to allow the collaborative features to work on a self-hosted instance of Hoppscotch.

This API has the exact same GraphQL schema as the "official" API.

This API does not store its data in Firebase (which the official probably does), but in a local MySQL database.

Requirements

  • MySQL/Postgres
  • An SMTP mail server
  • A Firebase project & webapp credentials & Admin SDK credentials

Get requirements up and running

MySQL (optional when using docker-compose):

docker run \
--name hoppscotch_api_mysql \
-p 127.0.0.1:3306:3306 \
-e MYSQL_ROOT_PASSWORD=hoppscotch \
-e MYSQL_DATABASE=hoppscotch \
-e MYSQL_USER=hoppscotch \
-e MYSQL_PASSWORD=hoppscotch \
-d mysql:8.0

Next runs:

docker start hoppscotch_api_mysql

Firebase

You will need to create a Firebase project to get this whole thing running (frontend and backend).

Copy the .env.example in the frontend project to .env en fill in your Firebase credentials.

Generate a Firebase Admin SDK service account and reference the JSON from the config.yaml.

Create Firestore Database

Go to Firestore Rules and configure them in your firestore database.

Quickstart

  • Copy the config.example.yaml to config.yaml
  • Start the API by running go run main.go

Quickstart (Docker Compose)

  • Copy config.example.yaml to tmp/config.yaml
  • Put Firebase Admin SDK service account file in tmp folder
  • Ensure file mappings at volumes are correct in docker-compose.yml
  • run docker compose up -d or docker-compose up -d

Deployment

This backend is available as a docker image jerbob92/hoppscotch-backend.

The configuration is expected in the working directory or the folder /etc/api-config.

When using docker, the easiest way is to mount a local configuration folder as /etc/api-config that contains your config.yaml and your Firebase Admin SDK Service User json.

If you're behind a reverse proxy, it might be useful to use /graphql for the normal GraphQL traffic, and use /graphql/ws for the Subscription/WebSocket traffic.

Frontend deployment

To connect to your own backend, you will need to set the VITE_BACKEND_GQL_URL and VITE_BACKEND_WS_URL to the correct URLs for your backend in packages/hoppscotch-app/.env when building the frontend.

hoppscotch-backend's People

Contributors

jerbob92 avatar suraj-tiwari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hoppscotch-backend's Issues

Error: Team Request Deleted Error {"type":"gql_error","error":"can't get DB"}

How I got here:

I created a team, invited a member, member joined, and everything worked fine. The member could see the collection and work.
Now I removed the member from my Team and I kept my eyes on the Network tab. There were lots of "canceled" /graphql requests flooded.

I refreshed the tab and the member disappeared from the team. To cross-check, I checked the invited member and indeed permissions were revoked as expected.

But when I tried to load the main tab, Hoppscotch loaded but after 3 seconds of the page loaded, I got a black screen with the error: Error: Team Request Deleted Error {"type":"gql_error","error":"can't get DB"}.

To fix this, I cleared the cookies of my main tab and sign-in again and things worked fine as expected as nothing happened.

Is there some backend problem with Teams Member Management in the backend?

Facing An Issue Of Teams

Hi,i deployed Frontend
image
and Backend as docker on the server ,
image
frontend proxy x.x.x.x:3000 as post.xlink-xxxx.com
backend proxy x.x.x.x:8989 as postapi.xlink-xxxx.com
this is my .env below .SDK admin doployed as well
image
This is [Firestore Rules]
image
apis feature working fine , login feature working fine
image
actually i deploy backend for the feature "TEAM"
but seems still not working , wonder where did i do wrong
image
And seems in the datebase has no data
image
kingly enlight me? thanks for your time

Howto configure frontend?

First of all, thank you so much for this ;)

I assume several values of your extended .env (feature/local-hosting) needs to be adapted. Can you give a short summary what needs to be changed to connect the frontend with my self-hosted backend?

# Google Analytics ID
GA_ID=UA-61422507-4

# Google Tag Manager ID
GTM_ID=GTM-NMKVBMV

# Firebase config
API_KEY=AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM
AUTH_DOMAIN=postwoman-api.firebaseapp.com
DATABASE_URL=https://postwoman-api.firebaseio.com
PROJECT_ID=postwoman-api
STORAGE_BUCKET=postwoman-api.appspot.com
MESSAGING_SENDER_ID=421993993223
APP_ID=1:421993993223:web:ec0baa8ee8c02ffa1fc6a2
MEASUREMENT_ID=G-BBJ3R80PJT

# Base URL
BASE_URL=https://hoppscotch.io

# Shortcode URL Base
SHORTCODE_BASE_URL=https://hopp.sh

# API
API_URL=https://api.hoppscotch.io/graphql
API_WS_URL=wss://api.hoppscotch.io/graphql

I am not sure about that Google Analytics and Tag manager crap, then which Firebase values needs to me changed and where do I find the values in my console? What is that newly added SHORTCODE_BASE_URL?

Highly appreciate your help

WSS 400 Error

I have properly configured the backend service but when the front end tries to establish a WSS connection, it gets a 400 error. I also tried to connect to "wss://localhost:8989/graphql/ws" using Postman but still getting Error: Unexpected server response: 400.

Can you please help?

Error wss

hello, i have problem while deploying backend with docker, i got error on websocker service
the error was :
failed: WebSocket is closed before the connection is established.

i using nginx as web server, can you help me to solve this issue?

thank you

In users table, email missing

image

image

if email is not verified in "hoppscotch profile", "email" field in the "users" table is missing.

However, even if email verification is performed, the value of the "users" table is not updated.

After email authentication, the user must be deleted and logged in again to enter the email field.

is there any options to update "users" table? or some other solution for this?

Need to run over https...

Hi,
Thanks a lot for your script! Awesome work!

We installed your version and it is working like a charm. But frontend is running on https and need to call the backend api on https too. We are running your backend api in other port because apache is working on production server.

Could you told us how to enable https in backend?

Thanks again!

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.