Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4775852
build(deps): add polar sdk dependency
hobbescodes Apr 15, 2025
7c3b621
feature(plugins): add subscription tier to graphql context
hobbescodes Apr 15, 2025
e7c7d85
refactor(plugins): adjust organization and project RBAC plugins
hobbescodes Apr 15, 2025
b3a887e
build(deps): update dependencies
hobbescodes Apr 15, 2025
b86ae52
refactor(schema): add tier to user table, remove polar dependency
hobbescodes Apr 16, 2025
8bea07d
build(deps): remove ts-pattern
hobbescodes Apr 16, 2025
fd477cf
fix: remove unused env variables and exports
hobbescodes Apr 16, 2025
512f2fc
chore: add TODOs regarding ownership transfers
hobbescodes Apr 16, 2025
8487835
refactor(plugins): update members RBAC plugin
hobbescodes Apr 17, 2025
f94800b
refactor(plugins): update members RBAC plugin to disallow adding addi…
hobbescodes Apr 17, 2025
2564793
chore: fix typo
hobbescodes Apr 17, 2025
7ec56c9
refactor(polar): move endpoints to API
hobbescodes Apr 18, 2025
d8e78dc
chore: format
hobbescodes Apr 18, 2025
221758e
Merge branch 'master' into feature/payment-tier-authz
hobbescodes Apr 19, 2025
b0d76a9
chore: format
hobbescodes Apr 19, 2025
dae38ac
chore: prep merge
hobbescodes Apr 22, 2025
0242f7c
chore: merge master
hobbescodes Apr 22, 2025
898334c
refactor: add tags file, remove tier from insert and update mutations
hobbescodes Apr 22, 2025
c92dbc2
chore: prep merge
hobbescodes Apr 22, 2025
1d3a496
Merge branch 'master' into feature/payment-tier-authz
hobbescodes Apr 22, 2025
c368013
chore: update generated artifacts
hobbescodes Apr 22, 2025
da03aae
chore: remove TODO in user RBAC plugin
hobbescodes Apr 22, 2025
c6e1fa1
docs(env): add template comments
coopbri Apr 23, 2025
948ac5d
docs: add README
coopbri Apr 23, 2025
ae89b0c
docs: add license
coopbri Apr 23, 2025
d369f32
chore(plugins): remove TODO in member rbac plugin
hobbescodes Apr 24, 2025
97399f0
refactor(server): add checks to ensure webhook events are scoped to B…
hobbescodes Apr 24, 2025
c4a0fa1
Merge branch 'master' into feature/payment-tier-authz
hobbescodes Apr 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# TODO change once base path changes (https://linear.app/omnidev/issue/OMNI-254/move-apiauth-paths-to-base-path-or-subpath-eg-auth)
AUTH_BASE_URL="https://localhost:8000/api/auth"

CHECKOUT_SUCCESS_URL="https://localhost:3000/confirmation"
6 changes: 6 additions & 0 deletions .env.local.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/backfeed?schema=public"

# payment processing
# NB: for local development, make sure this token is generated for the Polar sandbox environment (https://docs.polar.sh/integrate/sandbox) in the Polar dashboard. If `NODE_ENV` is `development`, the sandbox will be used, otherwise Polar production will be used
POLAR_ACCESS_TOKEN=""
# a webhook secret can be generated at https://sandbox.polar.sh/dashboard/$ORGANIZATION_NAME/settings/webhooks
POLAR_WEBHOOK_SECRET=""

# skip auth check on API (set to SKIP_AUTH="true" to enable skip)
SKIP_AUTH=""
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# TODO change once base path changes (https://linear.app/omnidev/issue/OMNI-254/move-apiauth-paths-to-base-path-or-subpath-eg-auth)
AUTH_BASE_URL="https://identity.omni.dev/api/auth"

CHECKOUT_SUCCESS_URL="https://backfeed.omni.dev/confirmation"
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) Omni LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Backfeed API

Backfeed is an open-source feedback reporting platform.

## Local Development

First, create a Postgres database called `backfeed`. Then, `cp .env.local.template .env.local` and fill in the values.

### Building and Running (Native)

Install dependencies:

```sh
bun install
```

Run database migrations:

```sh
bun db:migrate
```

Run the dev server:

```sh
bun run dev
```

### Webhooks (Payments)

Our Backfeed payment processor, [Polar](https://polar.sh), issues webhooks. Webhooks are used in this project for realtime updates. Webhooks can be managed at https://sandbox.polar.sh/dashboard/$ORGANIZATION_NAME/settings/webhooks.

## License

The code in this repository is licensed under MIT, © Omni LLC. See [LICENSE.md](LICENSE.md) for more information.
299 changes: 121 additions & 178 deletions bun.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions graphile.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PgSimplifyInflectionPreset } from "@graphile/simplify-inflection";
import { PostGraphileConnectionFilterPreset } from "postgraphile-plugin-connection-filter";
import { makePgService } from "postgraphile/adaptors/pg";
import { PostGraphileAmberPreset } from "postgraphile/presets/amber";
import { TagsFilePlugin } from "postgraphile/utils";

import { DATABASE_URL, isProdEnv } from "./src/lib/config/env.config";
import {
Expand Down Expand Up @@ -33,6 +34,9 @@ const preset: GraphileConfig.Preset = {
pgForbidSetofFunctionsToReturnNull: false,
jsonScalarAsString: false,
defaultBehavior: "-type:node -interface:node",
// See https://github.com/graphile-contrib/postgraphile-plugin-connection-filter?tab=readme-ov-file#handling-null-and-empty-objects
connectionFilterAllowNullInput: true,
connectionFilterAllowEmptyObjectInput: true,
},
disablePlugins: ["PgIndexBehaviorsPlugin"],
plugins: [
Expand All @@ -46,6 +50,7 @@ const preset: GraphileConfig.Preset = {
DownvoteRBACPlugin,
UpvoteRBACPlugin,
CommentRBACPlugin,
TagsFilePlugin,
],
grafserv: {
graphiql: false,
Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@types/bun": "^1.2.8",
"@types/node": "^22.13.14",
"@types/pg": "^8.11.11",
"drizzle-kit": "^0.30.6",
"drizzle-kit": "^0.31.0",
"husky": "^9.1.7",
"replace-in-file": "^8.3.0",
"typescript": "^5.8.2"
Expand All @@ -36,19 +36,21 @@
"@envelop/parser-cache": "^8.1.3",
"@envelop/validation-cache": "^8.1.3",
"@escape.tech/graphql-armor": "^3.1.2",
"@graphile/pg-aggregates": "0.2.0-beta.7",
"@graphile/simplify-inflection": "8.0.0-beta.5",
"@graphile/pg-aggregates": "0.2.0-beta.8",
"@graphile/simplify-inflection": "8.0.0-beta.6",
"@polar-sh/hono": "^0.3.0",
"dayjs": "^1.11.13",
"drizzle-orm": "^0.41.0",
"drizzle-orm": "^0.42.0",
"drizzle-seed": "^0.3.1",
"graphile-export": "0.0.2-beta.24",
"graphile-export": "0.0.2-beta.26",
"graphql": "^16.10.0",
"graphql-yoga": "^5.13.2",
"hono": "^4.7.5",
"hono": "^4.7.7",
"jose": "^6.0.10",
"pg": "^8.14.1",
"postgraphile": "5.0.0-beta.37",
"postgraphile-plugin-connection-filter": "3.0.0-beta.7"
"postgraphile": "5.0.0-beta.40",
"postgraphile-plugin-connection-filter": "3.0.0-beta.8",
"zod": "^3.24.3"
},
"trustedDependencies": ["@biomejs/biome", "esbuild"]
}
16 changes: 16 additions & 0 deletions postgraphile.tags.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
version: 1,
config: {
class: {
user: {
attribute: {
tier: {
tags: {
behavior: "-insert -update",
},
},
},
},
},
},
}
Loading