-
Notifications
You must be signed in to change notification settings - Fork 1
Pay As You Go Example #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
slyguy5646
wants to merge
18
commits into
flowglad:main
Choose a base branch
from
slyguy5646:pay-as-you-go
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
bcfa311
added pay as you go example, WIP
slyguy5646 b0797b6
cleaned up scaffolding; chat ui
slyguy5646 49caae8
cleaned up home-client and skeleton
slyguy5646 268fe7e
more cleanup on main dashboard
slyguy5646 dc2b7cb
updated meta title
slyguy5646 e6c3b9f
remove user msg if generation error happens
slyguy5646 1867a43
removed image import
slyguy5646 0335c35
moved price id to env variable
slyguy5646 9bb1e29
updated readme
slyguy5646 fd6abab
added example env var and fixed loose equality
slyguy5646 c0783ba
removed progress bar
slyguy5646 b9ba347
removed unused billing helper
slyguy5646 a3f1358
removed env var for removed progress bar
slyguy5646 3b04973
fixed styling for big messages
slyguy5646 8a76759
removed unused imports
slyguy5646 b03733e
more robust optimistic user message
slyguy5646 86c89e7
removed import
slyguy5646 67c2adb
similar variable style as generation-based
slyguy5646 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Database Configuration | ||
| # PostgreSQL connection string for Drizzle ORM | ||
| # Example: postgresql://user:password@localhost:5432/dbname | ||
| DATABASE_URL=postgresql://user:password@localhost:5432/dbname | ||
|
|
||
| # BetterAuth Configuration | ||
| # Secret key for BetterAuth session encryption | ||
| # Generate with: openssl rand -base64 32 | ||
| BETTER_AUTH_SECRET=your-secret-key-here | ||
|
|
||
| # Application Configuration (Optional) | ||
| # Base URL for the application (used for auth callbacks) | ||
| # Defaults to http://localhost:3000 if not set | ||
| NEXT_PUBLIC_BASE_URL=http://localhost:3000 | ||
|
|
||
| # Server Port (Optional) | ||
| # Defaults to 3000 if not set | ||
| PORT=3000 | ||
|
|
||
| # Flowglad Configuration | ||
| # Secret key for Flowglad billing and subscription management | ||
| # Get your secret key from: https://app.flowglad.com/settings | ||
| FLOWGLAD_SECRET_KEY=sk_test_your_secret_key_here | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| module.exports = { | ||
| root: true, | ||
| parser: '@typescript-eslint/parser', | ||
| plugins: ['@typescript-eslint', 'prettier', 'import', 'unused-imports'], | ||
| extends: [ | ||
| 'eslint:recommended', | ||
| 'plugin:@typescript-eslint/recommended', | ||
| 'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
| 'plugin:import/recommended', | ||
| 'plugin:import/typescript', | ||
| 'next/core-web-vitals', | ||
| 'prettier' | ||
| ], | ||
| parserOptions: { | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module', | ||
| project: './tsconfig.json' | ||
| }, | ||
| settings: { | ||
| 'import/resolver': { | ||
| typescript: true | ||
| } | ||
| }, | ||
| rules: { | ||
| // Prettier integration | ||
| 'prettier/prettier': 'error', | ||
|
|
||
| // STRICT TYPESCRIPT RULES - No any usage / unsafe any flows | ||
| '@typescript-eslint/no-explicit-any': 'error', | ||
| '@typescript-eslint/no-unsafe-assignment': 'error', | ||
| '@typescript-eslint/no-unsafe-call': 'error', | ||
| '@typescript-eslint/no-unsafe-member-access': 'error', | ||
| '@typescript-eslint/no-unsafe-return': 'error', | ||
| '@typescript-eslint/no-unsafe-argument': 'error', | ||
|
|
||
| // No type assertions (as/<>). Prefer proper narrowing. | ||
| '@typescript-eslint/consistent-type-assertions': [ | ||
| 'error', | ||
| { | ||
| assertionStyle: 'never' | ||
| } | ||
| ], | ||
| '@typescript-eslint/no-non-null-assertion': 'error', | ||
|
|
||
| // Additional strict rules | ||
| '@typescript-eslint/strict-boolean-expressions': 'error', | ||
| '@typescript-eslint/prefer-nullish-coalescing': 'error', | ||
| '@typescript-eslint/prefer-optional-chain': 'error', | ||
| '@typescript-eslint/no-floating-promises': 'error', | ||
| '@typescript-eslint/await-thenable': 'error', | ||
| '@typescript-eslint/no-misused-promises': 'error', | ||
| '@typescript-eslint/require-await': 'error', | ||
| '@typescript-eslint/no-unchecked-indexed-access': 'error', | ||
| '@typescript-eslint/no-unnecessary-condition': 'error', | ||
|
|
||
| // Prevent common mistakes | ||
| '@typescript-eslint/no-unused-vars': [ | ||
| 'error', | ||
| { argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true } | ||
| ], | ||
| '@typescript-eslint/no-empty-function': 'error', | ||
| '@typescript-eslint/no-empty-interface': 'error', | ||
| '@typescript-eslint/no-invalid-void-type': 'error', | ||
| '@typescript-eslint/prefer-as-const': 'error', | ||
| '@typescript-eslint/prefer-function-type': 'error', | ||
| '@typescript-eslint/prefer-readonly': 'error', | ||
| '@typescript-eslint/prefer-string-starts-ends-with': 'error', | ||
| '@typescript-eslint/prefer-includes': 'error', | ||
|
|
||
| // Code quality and boundaries | ||
| '@typescript-eslint/explicit-function-return-type': 'error', | ||
| '@typescript-eslint/explicit-module-boundary-types': 'error', | ||
| '@typescript-eslint/no-var-requires': 'error', | ||
| '@typescript-eslint/prefer-namespace-keyword': 'error', | ||
|
|
||
| // Consistency rules | ||
| '@typescript-eslint/consistent-type-definitions': ['error', 'type'], | ||
| '@typescript-eslint/consistent-type-imports': [ | ||
| 'error', | ||
| { prefer: 'type-imports', fixStyle: 'separate-type-imports', disallowTypeAnnotations: false } | ||
| ], | ||
| '@typescript-eslint/ban-ts-comment': [ | ||
| 'error', | ||
| { | ||
| 'ts-ignore': 'ban', | ||
| 'ts-nocheck': 'ban', | ||
| 'ts-check': 'ban', | ||
| 'ts-expect-error': 'allow-with-description', | ||
| minimumDescriptionLength: 3 | ||
| } | ||
| ], | ||
| '@typescript-eslint/ban-types': [ | ||
| 'error', | ||
| { | ||
| extendDefaults: true, | ||
| types: { | ||
| '{}': { | ||
| message: 'Use a more specific type or Record<string, unknown>', | ||
| fixWith: 'Record<string, unknown>' | ||
| } | ||
| } | ||
| } | ||
| ], | ||
|
|
||
| // Import hygiene | ||
| 'import/order': [ | ||
| 'error', | ||
| { | ||
| groups: [ | ||
| 'builtin', | ||
| 'external', | ||
| 'internal', | ||
| ['parent', 'sibling', 'index'] | ||
| ], | ||
| 'newlines-between': 'always', | ||
| alphabetize: { order: 'asc', caseInsensitive: true } | ||
| } | ||
| ], | ||
| 'import/newline-after-import': 'error', | ||
|
|
||
| // Remove unused imports cleanly | ||
| 'unused-imports/no-unused-imports': 'error', | ||
|
|
||
| // General ESLint rules | ||
| 'no-console': ['error', { allow: ['warn', 'error'] }], | ||
| eqeqeq: 'error', | ||
| 'no-throw-literal': 'error', | ||
| 'no-debugger': 'error', | ||
| 'no-alert': 'error', | ||
| 'no-var': 'error', | ||
| 'prefer-const': 'error', | ||
| 'no-unused-expressions': 'error' | ||
| }, | ||
| overrides: [ | ||
| { | ||
| files: ['*.test.ts', '*.test.tsx', '*.spec.ts', '*.spec.tsx'], | ||
| rules: { | ||
| '@typescript-eslint/no-explicit-any': 'off', | ||
| '@typescript-eslint/no-non-null-assertion': 'off', | ||
| 'no-console': 'off' | ||
| } | ||
| } | ||
| ] | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
|
|
||
| # Build outputs | ||
| dist/ | ||
| build/ | ||
| out/ | ||
| .next/ | ||
| .nuxt/ | ||
| .vuepress/dist/ | ||
|
|
||
| # Environment variables | ||
| .env | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
|
|
||
| # IDE and editor files | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS generated files | ||
| .DS_Store | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
| Thumbs.db | ||
|
|
||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage/ | ||
| *.lcov | ||
|
|
||
| # nyc test coverage | ||
| .nyc_output | ||
|
|
||
| # Dependency directories | ||
| jspm_packages/ | ||
|
|
||
| # TypeScript cache | ||
| *.tsbuildinfo | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional eslint cache | ||
| .eslintcache | ||
|
|
||
| # Microbundle cache | ||
| .rpt2_cache/ | ||
| .rts2_cache_cjs/ | ||
| .rts2_cache_es/ | ||
| .rts2_cache_umd/ | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # parcel-bundler cache (https://parceljs.org/) | ||
| .cache | ||
| .parcel-cache | ||
|
|
||
| # Stores VSCode versions used for testing VSCode extensions | ||
| .vscode-test | ||
|
|
||
| # Temporary folders | ||
| tmp/ | ||
| temp/ | ||
|
|
||
| # Package managers - ALWAYS use bun in this project | ||
| package-lock.json | ||
| yarn.lock | ||
| pnpm-lock.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "semi": true, | ||
| "trailingComma": "es5", | ||
| "singleQuote": true, | ||
| "printWidth": 80, | ||
| "tabWidth": 2, | ||
| "useTabs": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Flowglad Inc. | ||
|
|
||
| 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. | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.