Comments (1)
Types of emails we need (as of today)
- Notify org's owner about reaching 90% of the usage limit
- Notify org's owner about the rate-limit
- Notify org's owner about the upcoming end of the trial period
Scheduling
I think the "upcoming end of the trial" email could be sent from Stripe directly.
The first two emails (related to usage limits) should be scheduled by either the usage-estimator
or the rate-limit
service but only if the email hasn't been scheduled yet (within the billing period).
Instead of holding the state (email sent or not yet) in Postgres, the email service could use BullMQ (Redis) with specific job names (rate-limit-org{id}-period{currentPeriod}
).
The problem with this approach is the persistence of data (Redis is in-memory) that can cause sending multiple emails. The data is gone when the pod is restarted (version upgrade of Redis or K8s). We would have to use external storage.
Rendering emails
Who should create an email body?
Should it be done in the email service (data + template id) or by the consumer (email prepared by rate-limit
service)?
Doing it in the email service means it is aware of all the email templates but on the other hand, who cares? Making everything isolated just to make it isolated makes no sense.
How should the body be created?
We need simple HTML with a few CSS rules.
Maybe a type-safe template?
const email = getEmail('template-name-here');
// ^ type-safe: to make sure the template exists
const body = email.body({ ...props });
// ^ type-safe: to make sure we pass all the data
const title = email.title({ ...props });
// ^ type-safe: to make sure we pass all the data
Maybe a combination of TypeScript and mjml? It has an online editor and a big community and a big list of features.
We could have an "email client" that is fully type-safe, holds all the email templates, and connects to the email service nicely. Keeping the emails in a single place is fine. We could use tRPC
here.
emailService.send({
template: 'rate-limit',
address: '[email protected]',
input: {
org: { name: 'GraphQL Hive' },
limit: 1_000_000,
used: 1_100_000,
}
});
from graphql-hive.
Related Issues (20)
- Error: The provided `href` (/[organizationId]/[projectId]) value is missing query values (organizationId... HOT 1
- truncate target links in schema check target footer
- Unable to set @graphql-hive/client token in firebase function HOT 3
- Error: Code: 216. DB::Exception: Query with id = duration_and_count_over_time_hourly-d84101541bb6a is al...
- Error page: make error page more user friendly
- Create an organization page: Make it more user friendly
- date ranger filter: suggest custom number interval HOT 1
- Error when trying to do a check using Github integration HOT 8
- Cannot set a role different than viewer HOT 2
- Allow to add a note when accepting a breaking change HOT 1
- Client name unknown in Insights HOT 1
- Allow to provide a list of emails for sending notifications like "rate limits"
- Not found for a new contract
- hive client usage reporting doesn't work with cloudflare workers HOT 1
- server-4.10.2.tgz: 1 vulnerabilities (highest severity is: 6.1) HOT 1
- find oauth integration via organization name
- persist insights operation/client filter in url
- insights view for multiple targets data
- CORS Issues with Deployed GraphQL Hive HOT 2
- Conditional Breaking Changes for anonymous clients
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-hive.