spheron-react-api-stack
reactfire
spheron-react-api-stack | reactfire | |
---|---|---|
7 | 17 | |
0 | 3,477 | |
- | 0.2% | |
10.0 | 4.2 | |
over 1 year ago | 22 days ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
spheron-react-api-stack
-
Can't host a static react site on IPFS because I can't set Content-Security-Policy in the code
Oh that’s interesting I thought that CSP was only handled on the frontend. This is the code that my server is running https://github.com/ChristianOConnor/spheron-react-api-stack/blob/main/server/server.js. It’s just a simple express.js server.
-
React app hosted on IPFS gives "default-src 'self'". 'connect-src' was not explicitly set, so 'default-src' is used as a fallback error
I have a react app here https://github.com/ChristianOConnor/spheron-react-api-stack. I'm trying to host it on IPFS. I deployed this with 2 main steps: 1) cd frontend, npm run build and 2) upload the build folder to pinata.cloud. Before it works on IPFS I had to make a few changes such as converting the paths in the manifest.json to include a ./, for example I changed "main.js": "/static/js/main.HASH_HERE.js", to "main.js": "./static/js/main.HASH_HERE.js". But 1 problem still remains.
-
Looking for a better way to authenticate Google Cloud Function with a service account. Right now I'm storing the credentials json file on the backend
I'm looking for a better way to authenticate Google Cloud Function with a service account. Right now I'm storing the credentials json file on the backend. This is the code for my app https://github.com/ChristianOConnor/spheron-react-api-stack. This app could be deployed on any hosting platform, but at the moment the app is built to deploy on a Web3 protocol called Spheron. TLDR, Spheron runs the backend express server on a web3 friendly content serving/hosting platform called Akash. This means that whoever is hosting my backend express server has access to my GCP service account's credentials. You can see all of the code in the link I provided but just for ease of access this is the server.js file which will be on Akash.
-
Are API keys and Google Cloud Platform service account credentials safe to store as environment variables in Netlify deploy settings?
This is an amazing writeup you made. You certainly know a lot about authentication. I got my git repo to work perfectly https://github.com/ChristianOConnor/google-cloudfunction-callfromreactapp.
-
Can't call Google Cloud Function from a react app. I get googleauth.js:17 Uncaught Error: Cannot find module 'child_process' in my browser's console
I have this app here: https://github.com/ChristianOConnor/google-cloudfunction-callfromreactapp. It is literally just the output of npx create-react-app google-cloudfunction-callfromreactapp --template typescript and making a few changes. I added src/api/google.ts which looks like this: ``` import { JWT } from "google-auth-library"; import keys from 'PATH TO KEYS HERE';
reactfire
-
Angular Fire equivalent for React?
ReactFire
- How can I use Firebase to monitor live circuit tripping in a train IoT project?
-
Can't call Google Cloud Function from a react app. I get googleauth.js:17 Uncaught Error: Cannot find module 'child_process' in my browser's console
Are you using Firebase? If not, you probably should. You can call functions (with Auth) from your react app. There's a framework you can use to help: https://github.com/FirebaseExtended/reactfire
-
Convex vs. Firebase
I was an early developer at Firebase. I think we made Firebase so easy to use and never spoke on about the technicals that the whole software ecosystem now underestimates the complexity involved. I see various Firebase competitors asserting various "mistakes it makes" without really understanding what it delivers, which is understandable because we never marketed it like that because we spoke only about how it can help you build easier.
The idea that n queries instead of a join is slow is not as true as you would think. Firestore supports streaming and pipelines at its core, and can reuse cache across operations. At the end of the day, the data goes over a narrow network channel. If you can saturate the channel, and don't leave any gaps, what's the performance difference if the data comes from a single query or many that are back-to-back. The data is transferred to the client either way. Both Firebase databases are pipelined, so this "many round trip" argument is not a decent argument if the client can issue the queries without waiting for responses (such as the code in this article).
The other is consistency levels and correctness. I constantly see devs call Firebase an eventually consistent database which is wrong, its causally consistent [1], and this makes a huge difference when trying to do OLTP. The offline capabilities are built on the consistency primitives, and it's the only way it can work. So while this convex article is banging on about "End-to-End Correctness Philosophy", they miss the most important quality of correctness, and if they are not careful, will miss the required engineering, and then be unable to deliver an offline cache over real-time streams. I see this playing out with Supabase, I warned them personally before they got into YCombinator that what they were building was not causally consistent. Since then, they have had to rearchitect their real-time features after shipping them. (I have not reviewed their latest design yet so I have no idea whether they have it right yet).
Many things sucked about Firebase. The bespoke security rules and the lack of views. So Convex is on the money shipping functions on the backend. I think Supabase is shipping competitors' mistakes with row-level security language. Personally, I think Firebase's mistakes can be fixed with the addition of an open-source Firebase server [1], as the clients are already open source and the mistakes are all to do with just the server. The real tech was always in the clients anyway (offline cache, connection management, operation queues).
It will be interesting to see if building expressly for React is a good idea. Firebase shipped many adapters, like https://github.com/FirebaseExtended/reactfire, using the "thin-waist" principle of not over-fitting. But Javascript technology moved from callbacks to async while Firebase was in the field, so the current API is not now idiomatic. But convex is setting itself for even more ecosystem fragility, what if React changes API or falls out of favor? This is a big risk! I hope they can roll with whatever happens!
[1] https://observablehq.com/@tomlarkworthy/redis-backend-1
-
Do you have to use an ODM for firestore?
Since you mentioned you're also using React, we have a React specific library (ReactFire) that also helps out quite a bit.
-
Get current user firestore database
Use ReactFire! It's our official library for React and Firebase. It has a bunch of useful hooks that probably handle most of the actions you are looking to do.
-
Intro To ReactFire v4 - Login, Logout Create Account And Protected Routes
This is a quick walkthrough of a code example using ReactFire v4 in an application. The application supports login, logout, create an account, and protected routes. We also walk through two approaches for protecting routes since the AuthCheck component that existed in v3 no longer exists in v4 of ReactFire.
-
Is state management (React Context, Redux) really needed for Firebase?
FWIW check out ReactFire, it gives you hooks and context for Firebase. Will likely feel more natural than using the vanilla platform-agnostic SDK.
-
React Query + Firestore = ❤️
reactfire
What are some alternatives?
React - The library for web and native user interfaces.
react-query-firebase - React Query hooks for managing asynchronous operations with Firebase. Supports Authentication, Analytics, Firestore & Realtime Database.
use-pagination-firestore - 🔥 React hook for non-cumulative pagination of Firebase Firestore collections
strapi-connector-firestore - Strapi database connector for Firestore database on Google Cloud Platform.
rowy - Low-code backend platform. Manage database on spreadsheet-like UI and build cloud functions workflows in JS/TS, all in your browser.
react-famous - React bridge to Famo.us
Redux Slim Async - :alien: A Redux middleware to ease the pain of tracking the status of an async action
react-localstorage - Simple componentized localstorage implementation for Facebook's React.
react-swf - Shockwave Flash Player component for React
react-on-rails - Integration of React + Webpack + Rails + rails/webpacker including server-side rendering of React, enabling a better developer experience and faster client performance.
elm-react-component
react-elm-components - Write React components in Elm